[llvm] [RISCV][GISEL] instruction-select for G_SPLAT_VECTOR (PR #111193)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 4 13:09:54 PDT 2024


topperc wrote:

> > It would be really nice for the InstructionSelector to know that instructions need to be selected after selecting the current instruction.
> 
> I do have a prototype for this, but I am not sure that the additional complexity it adds to InstructionSelect is worth it compared to just calling select recursively.
> 
> preISelLower is intended for slightly changing an instruction and then continuing selection for that changed instruction. Here, we probably want to create the generic instructions, recursively call select on them and then return from the original select call instead of continuing selection. Introducing earlySelect() would be an option, but this exists primarily for overriding the imported SelectionDAG patterns. Is this necessary here, does SelectionDAG even have imported patterns for G_SPLAT_VECTOR? Can't we just add this lowering code to a function and call it from the normal selection switch statement?

SelectionDAG does not have patterns for G_SPLAT_VECTOR. It only has patterns for G_VMV_V_X_VL and G_VFMV_V_F_VL. As noted earlier, SelectionDAG has a pre-isel peephole to change the opcode. This is done because VP intrinsics directly use the G_VMV_V_X_VL and G_VFMV_V_F_VL opcodes since they come with a VL. Generic shufflevector does not come with a VL so use SPLAT_VECTOR. We standardize on one opcode using the peephole to reduce the isel table size.

There are something like 14 different opcodes that need to be selected based on the opcode and the type. Since those are already in the isel table we would like to use that and not repeat the 14 opcodes manually.

https://github.com/llvm/llvm-project/pull/111193


More information about the llvm-commits mailing list