[PATCH] D159131: [RISCV][GlobalISel] Select G_ICMP
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 6 16:22:29 PDT 2023
craig.topper added inline comments.
================
Comment at: llvm/lib/Target/RISCV/GISel/RISCVInstructionSelector.cpp:202
+void RISCVInstructionSelector::renderImmPlus1(MachineInstrBuilder &MIB,
+ const MachineInstr &MI,
+ int OpIdx) const {
----------------
Indent
================
Comment at: llvm/lib/Target/RISCV/RISCVGISel.td:71
+// handled by a RISC-V instruction.
+// FIXME: Handle the immediate cases
+def : Pat<(XLenVT (seteq (XLenVT GPR:$rs1), 0)), (SLTIU GPR:$rs1, 1)>;
----------------
Is this FIXME still needed?
================
Comment at: llvm/lib/Target/RISCV/RISCVGISel.td:96
+ (XORI (SLTI GPR:$rs1, (ImmPlus1 simm12Minus1Nonzero:$imm)), 1)>;
+def : Pat<(XLenVT (setugt (XLenVT GPR:$rs1), simm12Minus1Nonzero:$imm)),
+ (XORI (SLTIU GPR:$rs1,
----------------
simm12Minus1Nonzero -> simm12Minus1NonzeroNonNeg1
================
Comment at: llvm/lib/Target/RISCV/RISCVGISel.td:98
+ (XORI (SLTIU GPR:$rs1,
+ (ImmPlus1 simm12Minus1NonzeroNonNeg1:$imm)), 1)>;
----------------
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))>;
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D159131/new/
https://reviews.llvm.org/D159131
More information about the llvm-commits
mailing list