This patch adds shouldScalarizeBinop to RISCV target in order to convert an extract element of a vector binary operation into an extract element followed by a scalar binary operation.
For now, the DAGCombiner only supports to combine the fixed vectors. I will change it in the next revision.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
LGTM.
This is a straight forward port of the X86 logic, and is a reasonable stepping stone. However, I think framing this in terms of legality leaves some potential cases on the floor. Specifically, we can have cases where the scalar op isn't legal, but is still cheaper than the legal vector op.
An example might be a 32 bit udiv. Masking off the high bits requires two extra instructions, but that's probably still profitable over doing the vector op on a long vector.
Long term, I'd propose we frame this in terms of the expected cost of the two forms, not the legality of either side directly.
This has already been approved. Do you have commit access or do you need someone to land on your behalf?
Per our dev policy, review status is not authoritative. I'd previous given an "LGTM". That means "approved". This is long standing policy.