[llvm] [RISCV] Simplify MIPS CCMov patterns. NFC (PR #124816)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 28 10:46:27 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-risc-v
Author: Craig Topper (topperc)
<details>
<summary>Changes</summary>
We have ComplexPatterns that reduce 3 patterns to 1 by handling the ==/!= 0, imm, and register cases. These are used for XTHeadCondMove, Zicond, XVentanaCondOps, and our basic seteq/setne patterns.
---
Full diff: https://github.com/llvm/llvm-project/pull/124816.diff
1 Files Affected:
- (modified) llvm/lib/Target/RISCV/RISCVInstrInfoXMips.td (+3-14)
``````````diff
diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoXMips.td b/llvm/lib/Target/RISCV/RISCVInstrInfoXMips.td
index 281829e99cc56c..a3bdb420745a9d 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfoXMips.td
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfoXMips.td
@@ -116,24 +116,13 @@ def CCMOV : RVInstR4<0b11, 0b011, OPC_CUSTOM_0, (outs GPR:$rd),
}
let Predicates = [UseCCMovInsn] in {
-def : Pat<(select (XLenVT (setne (XLenVT GPR:$rs2), (XLenVT 0))),
+def : Pat<(select (riscv_setne (XLenVT GPR:$rs2)),
(XLenVT GPR:$rs1), (XLenVT GPR:$rs3)),
(CCMOV GPR:$rs1, GPR:$rs2, GPR:$rs3)>;
-def : Pat<(select (XLenVT (setne (XLenVT GPR:$x), (XLenVT simm12_plus1:$y))),
- (XLenVT GPR:$rs1), (XLenVT GPR:$rs3)),
- (CCMOV GPR:$rs1, (ADDI GPR:$x, (NegImm simm12_plus1:$y)), GPR:$rs3)>;
-def : Pat<(select (XLenVT (setne (XLenVT GPR:$x), (XLenVT GPR:$y))),
- (XLenVT GPR:$rs1), (XLenVT GPR:$rs3)),
- (CCMOV GPR:$rs1, (XOR GPR:$x, GPR:$y), GPR:$rs3)>;
-def : Pat<(select (XLenVT (seteq (XLenVT GPR:$rs2), (XLenVT 0))),
+def : Pat<(select (riscv_seteq (XLenVT GPR:$rs2)),
(XLenVT GPR:$rs3), (XLenVT GPR:$rs1)),
(CCMOV GPR:$rs1, GPR:$rs2, GPR:$rs3)>;
-def : Pat<(select (XLenVT (seteq (XLenVT GPR:$x), (XLenVT simm12_plus1:$y))),
- (XLenVT GPR:$rs3), (XLenVT GPR:$rs1)),
- (CCMOV GPR:$rs1, (ADDI GPR:$x, (NegImm simm12_plus1:$y)), GPR:$rs3)>;
-def : Pat<(select (XLenVT (seteq (XLenVT GPR:$x), (XLenVT GPR:$y))),
- (XLenVT GPR:$rs3), (XLenVT GPR:$rs1)),
- (CCMOV GPR:$rs1, (XOR GPR:$x, GPR:$y), GPR:$rs3)>;
+
def : Pat<(select (XLenVT GPR:$rs2), (XLenVT GPR:$rs1), (XLenVT GPR:$rs3)),
(CCMOV GPR:$rs1, GPR:$rs2, GPR:$rs3)>;
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/124816
More information about the llvm-commits
mailing list