Skip to content

Commit dfe513a

Browse files
committed
Revert "[RISCV] Use selectShiftMaskXLen ComplexPattern for isel of rotates."
This reverts commit 86f7d70. The test cases added for this exposed an pre-existing bug that is failing the expensive checks bot. Reverting so I can revert that patch.
1 parent 6990e74 commit dfe513a

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

llvm/lib/Target/RISCV/RISCVInstrInfoZb.td

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -817,8 +817,8 @@ def : Pat<(xor GPR:$rs1, (not GPR:$rs2)), (XNOR GPR:$rs1, GPR:$rs2)>;
817817
} // Predicates = [HasStdExtZbbOrZbpOrZbkb]
818818

819819
let Predicates = [HasStdExtZbbOrZbpOrZbkb] in {
820-
def : PatGprGpr<shiftop<rotl>, ROL>;
821-
def : PatGprGpr<shiftop<rotr>, ROR>;
820+
def : PatGprGpr<rotl, ROL>;
821+
def : PatGprGpr<rotr, ROR>;
822822

823823
def : PatGprImm<rotr, RORI, uimmlog2xlen>;
824824
// There's no encoding for roli in the the 'B' extension as it can be
@@ -828,8 +828,8 @@ def : Pat<(rotl GPR:$rs1, uimmlog2xlen:$shamt),
828828
} // Predicates = [HasStdExtZbbOrZbpOrZbkb]
829829

830830
let Predicates = [HasStdExtZbbOrZbpOrZbkb, IsRV64] in {
831-
def : PatGprGpr<shiftopw<riscv_rolw>, ROLW>;
832-
def : PatGprGpr<shiftopw<riscv_rorw>, RORW>;
831+
def : PatGprGpr<riscv_rolw, ROLW>;
832+
def : PatGprGpr<riscv_rorw, RORW>;
833833
def : PatGprImm<riscv_rorw, RORIW, uimm5>;
834834
def : Pat<(riscv_rolw GPR:$rs1, uimm5:$rs2),
835835
(RORIW GPR:$rs1, (ImmSubFrom32 uimm5:$rs2))>;

llvm/test/CodeGen/RISCV/rotl-rotr.ll

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,13 +578,15 @@ define signext i32 @rotl_32_mask_multiple(i32 signext %a, i32 signext %b, i32 si
578578
;
579579
; RV32ZBB-LABEL: rotl_32_mask_multiple:
580580
; RV32ZBB: # %bb.0:
581+
; RV32ZBB-NEXT: andi a2, a2, 31
581582
; RV32ZBB-NEXT: rol a0, a0, a2
582583
; RV32ZBB-NEXT: rol a1, a1, a2
583584
; RV32ZBB-NEXT: add a0, a0, a1
584585
; RV32ZBB-NEXT: ret
585586
;
586587
; RV64ZBB-LABEL: rotl_32_mask_multiple:
587588
; RV64ZBB: # %bb.0:
589+
; RV64ZBB-NEXT: andi a2, a2, 31
588590
; RV64ZBB-NEXT: rolw a0, a0, a2
589591
; RV64ZBB-NEXT: rolw a1, a1, a2
590592
; RV64ZBB-NEXT: addw a0, a0, a1
@@ -702,6 +704,7 @@ define i64 @rotl_64_mask_multiple(i64 %a, i64 %b, i64 %amt) nounwind {
702704
;
703705
; RV64ZBB-LABEL: rotl_64_mask_multiple:
704706
; RV64ZBB: # %bb.0:
707+
; RV64ZBB-NEXT: andi a2, a2, 63
705708
; RV64ZBB-NEXT: rol a0, a0, a2
706709
; RV64ZBB-NEXT: rol a1, a1, a2
707710
; RV64ZBB-NEXT: add a0, a0, a1
@@ -741,13 +744,15 @@ define signext i32 @rotr_32_mask_multiple(i32 signext %a, i32 signext %b, i32 si
741744
;
742745
; RV32ZBB-LABEL: rotr_32_mask_multiple:
743746
; RV32ZBB: # %bb.0:
747+
; RV32ZBB-NEXT: andi a2, a2, 31
744748
; RV32ZBB-NEXT: ror a0, a0, a2
745749
; RV32ZBB-NEXT: ror a1, a1, a2
746750
; RV32ZBB-NEXT: add a0, a0, a1
747751
; RV32ZBB-NEXT: ret
748752
;
749753
; RV64ZBB-LABEL: rotr_32_mask_multiple:
750754
; RV64ZBB: # %bb.0:
755+
; RV64ZBB-NEXT: andi a2, a2, 31
751756
; RV64ZBB-NEXT: rorw a0, a0, a2
752757
; RV64ZBB-NEXT: rorw a1, a1, a2
753758
; RV64ZBB-NEXT: addw a0, a0, a1
@@ -863,6 +868,7 @@ define i64 @rotr_64_mask_multiple(i64 %a, i64 %b, i64 %amt) nounwind {
863868
;
864869
; RV64ZBB-LABEL: rotr_64_mask_multiple:
865870
; RV64ZBB: # %bb.0:
871+
; RV64ZBB-NEXT: andi a2, a2, 63
866872
; RV64ZBB-NEXT: ror a0, a0, a2
867873
; RV64ZBB-NEXT: ror a1, a1, a2
868874
; RV64ZBB-NEXT: add a0, a0, a1

0 commit comments

Comments
 (0)