Add TableGen patterns to select the integer predicates for G_ICMP. We do not select for comparisons between pointers yet.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/lib/Target/RISCV/RISCVGISel.td | ||
---|---|---|
19 | Can't use SDNodeXForm, look into replacing this with a ComplexPattern |
llvm/test/CodeGen/RISCV/GlobalISel/instruction-select/cmp64.mir | ||
---|---|---|
4 | Add pointer tests |
llvm/test/CodeGen/RISCV/GlobalISel/instruction-select/cmp64.mir | ||
---|---|---|
4 | Requires G_PTRTOINT, will be done in future patch |
llvm/lib/Target/RISCV/GISel/RISCVInstructionSelector.cpp | ||
---|---|---|
173 | We don't have to handle this case explicitly as long as we don't match ugt X, -1 in the tablegen pattern. It's completely fine to emit li a1, -1 sltu a0, a1, a0 |
Remove special handling for (setugt rs1, -1) case. Add support for comparing pointers.
llvm/lib/Target/RISCV/GISel/RISCVInstructionSelector.cpp | ||
---|---|---|
202 | Indent | |
llvm/lib/Target/RISCV/RISCVGISel.td | ||
71 | Is this FIXME still needed? | |
96 | simm12Minus1Nonzero -> simm12Minus1NonzeroNonNeg1 | |
98 | Need def : Pat<(XLenVT (setge (XLenVT GPR:$rs1), simm12:$imm)), (XORI (SLTI GPR:$rs1, simm12:$imm), 1)>; def : Pat<(XLenVT (setuge (XLenVT GPR:$rs1), simm12:$imm)), (XORI (SLTIU GPR:$rs1, simm12:$imm), 1)>; def : Pat<(XLenVT (setle (XLenVT GPR:$rs1), simm12Minus1Nonzero:$imm)), (SLTI GPR:$rs1, (ImmPlus1 simm12Minus1Nonzero:$imm))>; def : Pat<(XLenVT (setule (XLenVT GPR:$rs1), simm12Minus1NonzeroNonNeg1:$imm)), (SLTIU GPR:$rs1, (ImmPlus1 simm12Minus1NonzeroNonNeg1:$imm))>; |
Correct bound errors, edit tests to check for negative numbers and add relevant rules to tablegen.
Need tests for comparing pointers to G_CONSTANT
llvm/lib/Target/RISCV/RISCVGISel.td | ||
---|---|---|
98 | Still missing setle and setule patterns with immediates |
llvm/lib/Target/RISCV/GISel/RISCVInstructionSelector.cpp | ||
---|---|---|
164 | This is pretty ugly, I thought tablegen already did something for the pointer types to the int patterns here? |
Added missing rules for sle and ule with immediates. Cleaned up the lowering code for pointers.
llvm/lib/Target/RISCV/GISel/RISCVInstructionSelector.cpp | ||
---|---|---|
164 | We found this patch that was never merged https://reviews.llvm.org/D55914 . Should we re-consider that patch? |
This is pretty ugly, I thought tablegen already did something for the pointer types to the int patterns here?