@@ -506,8 +506,8 @@ def : Pat<(XLenVT (xor GPR:$rs1, invLogicImm:$rs2)), (XNOR GPR:$rs1, invLogicImm
506506} // Predicates = [HasStdExtZbbOrZbkb]
507507
508508let Predicates = [HasStdExtZbbOrZbkb] in {
509- def : PatGprGpr<shiftop< rotl> , ROL>;
510- def : PatGprGpr<shiftop< rotr> , ROR>;
509+ def : PatGprShiftMaskXLen< rotl, ROL>;
510+ def : PatGprShiftMaskXLen< rotr, ROR>;
511511
512512def : PatGprImm<rotr, RORI, uimmlog2xlen>;
513513// There's no encoding for roli in the the 'B' extension as it can be
@@ -517,29 +517,29 @@ def : Pat<(XLenVT (rotl GPR:$rs1, uimmlog2xlen:$shamt)),
517517} // Predicates = [HasStdExtZbbOrZbkb]
518518
519519let Predicates = [HasStdExtZbbOrZbkb, IsRV64] in {
520- def : PatGprGpr<shiftopw< riscv_rolw> , ROLW>;
521- def : PatGprGpr<shiftopw< riscv_rorw> , RORW>;
520+ def : PatGprShiftMask32< riscv_rolw, ROLW>;
521+ def : PatGprShiftMask32< riscv_rorw, RORW>;
522522def : PatGprImm<riscv_rorw, RORIW, uimm5>;
523523def : Pat<(riscv_rolw GPR:$rs1, uimm5:$rs2),
524524 (RORIW GPR:$rs1, (ImmSubFrom32 uimm5:$rs2))>;
525525} // Predicates = [HasStdExtZbbOrZbkb, IsRV64]
526526
527527let Predicates = [HasStdExtZbs] in {
528- def : Pat<(XLenVT (and (not (shiftop< shl> 1, (XLenVT GPR :$rs2) )), GPR:$rs1)),
529- (BCLR GPR:$rs1, GPR :$rs2)>;
528+ def : Pat<(XLenVT (and (not (shl 1, shiftMaskXLen :$rs2)), GPR:$rs1)),
529+ (BCLR GPR:$rs1, shiftMaskXLen :$rs2)>;
530530def : Pat<(XLenVT (and (rotl -2, (XLenVT GPR:$rs2)), GPR:$rs1)),
531531 (BCLR GPR:$rs1, GPR:$rs2)>;
532- def : Pat<(XLenVT (or (shiftop< shl> 1, (XLenVT GPR :$rs2) ), GPR:$rs1)),
533- (BSET GPR:$rs1, GPR :$rs2)>;
534- def : Pat<(XLenVT (xor (shiftop< shl> 1, (XLenVT GPR :$rs2) ), GPR:$rs1)),
535- (BINV GPR:$rs1, GPR :$rs2)>;
536- def : Pat<(XLenVT (and (shiftop< srl> GPR:$rs1, (XLenVT GPR :$rs2) ), 1)),
537- (BEXT GPR:$rs1, GPR :$rs2)>;
538-
539- def : Pat<(XLenVT (shiftop< shl> 1, (XLenVT GPR :$rs2) )),
540- (BSET (XLenVT X0), GPR :$rs2)>;
541- def : Pat<(XLenVT (not (shiftop< shl> -1, (XLenVT GPR :$rs2) ))),
542- (ADDI (XLenVT (BSET (XLenVT X0), GPR :$rs2)), -1)>;
532+ def : Pat<(XLenVT (or (shl 1, shiftMaskXLen :$rs2), GPR:$rs1)),
533+ (BSET GPR:$rs1, shiftMaskXLen :$rs2)>;
534+ def : Pat<(XLenVT (xor (shl 1, shiftMaskXLen :$rs2), GPR:$rs1)),
535+ (BINV GPR:$rs1, shiftMaskXLen :$rs2)>;
536+ def : Pat<(XLenVT (and (srl GPR:$rs1, shiftMaskXLen :$rs2), 1)),
537+ (BEXT GPR:$rs1, shiftMaskXLen :$rs2)>;
538+
539+ def : Pat<(XLenVT (shl 1, shiftMaskXLen :$rs2)),
540+ (BSET (XLenVT X0), shiftMaskXLen :$rs2)>;
541+ def : Pat<(XLenVT (not (shl -1, shiftMaskXLen :$rs2))),
542+ (ADDI (XLenVT (BSET (XLenVT X0), shiftMaskXLen :$rs2)), -1)>;
543543
544544def : Pat<(XLenVT (and GPR:$rs1, BCLRMask:$mask)),
545545 (BCLRI GPR:$rs1, BCLRMask:$mask)>;
0 commit comments