Skip to content

Commit 1533682

Browse files
authored
[RISCV] Simplify MIPS CCMov patterns. NFC (llvm#125318)
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.
1 parent 06130ed commit 1533682

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

llvm/lib/Target/RISCV/RISCVInstrInfoXMips.td

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -116,24 +116,13 @@ def MIPS_CCMOV : RVInstR4<0b11, 0b011, OPC_CUSTOM_0, (outs GPR:$rd),
116116
}
117117

118118
let Predicates = [UseCCMovInsn] in {
119-
def : Pat<(select (XLenVT (setne (XLenVT GPR:$rs2), (XLenVT 0))),
119+
def : Pat<(select (riscv_setne (XLenVT GPR:$rs2)),
120120
(XLenVT GPR:$rs1), (XLenVT GPR:$rs3)),
121121
(MIPS_CCMOV GPR:$rs1, GPR:$rs2, GPR:$rs3)>;
122-
def : Pat<(select (XLenVT (setne (XLenVT GPR:$x), (XLenVT simm12_plus1:$y))),
123-
(XLenVT GPR:$rs1), (XLenVT GPR:$rs3)),
124-
(MIPS_CCMOV GPR:$rs1, (ADDI GPR:$x, (NegImm simm12_plus1:$y)), GPR:$rs3)>;
125-
def : Pat<(select (XLenVT (setne (XLenVT GPR:$x), (XLenVT GPR:$y))),
126-
(XLenVT GPR:$rs1), (XLenVT GPR:$rs3)),
127-
(MIPS_CCMOV GPR:$rs1, (XOR GPR:$x, GPR:$y), GPR:$rs3)>;
128-
def : Pat<(select (XLenVT (seteq (XLenVT GPR:$rs2), (XLenVT 0))),
122+
def : Pat<(select (riscv_seteq (XLenVT GPR:$rs2)),
129123
(XLenVT GPR:$rs3), (XLenVT GPR:$rs1)),
130124
(MIPS_CCMOV GPR:$rs1, GPR:$rs2, GPR:$rs3)>;
131-
def : Pat<(select (XLenVT (seteq (XLenVT GPR:$x), (XLenVT simm12_plus1:$y))),
132-
(XLenVT GPR:$rs3), (XLenVT GPR:$rs1)),
133-
(MIPS_CCMOV GPR:$rs1, (ADDI GPR:$x, (NegImm simm12_plus1:$y)), GPR:$rs3)>;
134-
def : Pat<(select (XLenVT (seteq (XLenVT GPR:$x), (XLenVT GPR:$y))),
135-
(XLenVT GPR:$rs3), (XLenVT GPR:$rs1)),
136-
(MIPS_CCMOV GPR:$rs1, (XOR GPR:$x, GPR:$y), GPR:$rs3)>;
125+
137126
def : Pat<(select (XLenVT GPR:$rs2), (XLenVT GPR:$rs1), (XLenVT GPR:$rs3)),
138127
(MIPS_CCMOV GPR:$rs1, GPR:$rs2, GPR:$rs3)>;
139128
}

0 commit comments

Comments
 (0)