@@ -1304,6 +1304,14 @@ class QCScaledStPat<PatFrag StoreOp, RVInst Inst>
13041304 : Pat<(StoreOp (i32 GPR:$rd), (AddrRegRegScale7 (i32 GPRMem:$rs1), (i32 GPRNoX0:$rs2), uimm3:$shamt)),
13051305 (Inst GPR:$rd, GPRMem:$rs1, GPRNoX0:$rs2, uimm3:$shamt)>;
13061306
1307+ class QCIMVCCPat<CondCode Cond, QCIMVCC Inst>
1308+ : Pat<(select (XLenVT (setcc (XLenVT GPRNoX0:$rs1), (XLenVT GPRNoX0:$rs2), Cond)), (XLenVT GPRNoX0:$rs3), (XLenVT GPRNoX0:$rd)),
1309+ (Inst GPRNoX0:$rd, GPRNoX0:$rs1, GPRNoX0:$rs2, GPRNoX0:$rs3)>;
1310+
1311+ class QCIMVCCIPat<CondCode Cond, QCIMVCCI Inst>
1312+ : Pat<(select (XLenVT (setcc (XLenVT GPRNoX0:$rs1), simm5:$imm, Cond)), (XLenVT GPRNoX0:$rs3), (XLenVT GPRNoX0:$rd)),
1313+ (Inst GPRNoX0:$rd, GPRNoX0:$rs1, simm5:$imm, GPRNoX0:$rs3)>;
1314+
13071315// Match `riscv_brcc` and lower to the appropriate XQCIBI branch instruction.
13081316class BcciPat<CondCode Cond, QCIBranchInst_rii Inst, DAGOperand InTyImm>
13091317 : Pat<(riscv_brcc (XLenVT GPRNoX0:$rs1), InTyImm:$rs2, Cond, bb:$imm12),
@@ -1438,6 +1446,20 @@ def: Pat<(i32 (ctlz (not (i32 GPR:$rs1)))), (QC_CLO GPR:$rs1)>;
14381446let Predicates = [HasVendorXqciint, IsRV32] in
14391447def : Pat<(riscv_mileaveret_glue), (QC_C_MILEAVERET)>;
14401448
1449+ let Predicates = [HasVendorXqcicm, IsRV32] in {
1450+ def : Pat<(select (XLenVT GPRNoX0:$rs1), (XLenVT GPRNoX0:$rd),(XLenVT GPRNoX0:$rs3)),
1451+ (QC_MVEQI GPRNoX0:$rd, GPRNoX0:$rs1, (XLenVT 0), GPRNoX0:$rs3)>;
1452+
1453+ def : QCIMVCCPat <SETEQ, QC_MVEQ>;
1454+ def : QCIMVCCPat <SETNE, QC_MVNE>;
1455+ def : QCIMVCCPat <SETLT, QC_MVLT>;
1456+ def : QCIMVCCPat <SETULT, QC_MVLTU>;
1457+
1458+ def : QCIMVCCIPat <SETEQ, QC_MVEQI>;
1459+ def : QCIMVCCIPat <SETNE, QC_MVNEI>;
1460+ def : QCIMVCCIPat <SETLT, QC_MVLTI>;
1461+ def : QCIMVCCIPat <SETULT, QC_MVLTUI>;
1462+ }
14411463
14421464//===----------------------------------------------------------------------===/i
14431465// Compress Instruction tablegen backend.
0 commit comments