Legalize G_SHL, G_ASHR and G_LSHR for types narrower and upto (and including) XLen: (i7, i8,
i16 and i32) for rv32 and (i8, i15, i16, i32 and i64) for rv64. This requires
adding some rules to handle G_ANYEXT, G_ZEXT and G_SEXT.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp | ||
---|---|---|
38 | Do you actually need to permit anything besides XLenVT? I would hope if all of these were illegal the artifact combiner would eliminate all the casts in your examples | |
46 | Don't use references with LLT | |
llvm/test/CodeGen/RISCV/GlobalISel/legalizer/rv32/legalize-ashr.mir | ||
4 | Need some < 8 bit and odd intermediate sizes too |
llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp | ||
---|---|---|
59 | X86 did it differently, but it does not support vectors: |
llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp | ||
---|---|---|
34 | XLenLLT is the only legal type on RISCV. | |
llvm/test/CodeGen/RISCV/GlobalISel/legalizer/rv32/legalize-ashr.mir | ||
4 | This doesn't work with odd-sized types right now, I'll update the description and fix that in a future patch. I added one test for i1; but in order to pass it, I needed to change the legalization logic for G_{ANY/Z/S}EXT. Specifically, I allowed the SrcSize and DstSize to be as small as 1 for legal instructions. But neither X86 nor AArch64 allows this, so I'm not sure we should be allowing this. | |
22 | Thank you for catching this. |
llvm/test/CodeGen/RISCV/GlobalISel/legalizer/rv32/legalize-ashr.mir | ||
---|---|---|
4 | To clarify, I meant it didn't work will odd types less than 8. I'll add a test for an odd type. |
llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp | ||
---|---|---|
59 | This needs to be handled in parent revision. |
You claim: " types narrower and upto XLen". But you clamp to XLenLLT?