Skip to content

Commit 297670e

Browse files
committed
[RISCV] Add BREV8 and ORC_B to hasAllNBitUsers in RISCVOptWInstrs.
1 parent dc4fc05 commit 297670e

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

llvm/lib/Target/RISCV/RISCVOptWInstrs.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,11 @@ static bool hasAllNBitUsers(const MachineInstr &OrigMI,
323323
Worklist.push_back(std::make_pair(UserMI, Bits));
324324
break;
325325

326+
case RISCV::BREV8:
327+
case RISCV::ORC_B:
328+
Worklist.push_back(std::make_pair(UserMI, Bits));
329+
break;
330+
326331
case RISCV::PseudoCCMOVGPR:
327332
case RISCV::PseudoCCMOVGPRNoX0:
328333
// Either operand 4 or operand 5 is returned by this instruction. If

llvm/test/CodeGen/RISCV/sextw-removal.ll

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1547,10 +1547,9 @@ define signext i32 @test21(i64 %arg1, i64 %arg2, i64 %arg3) {
15471547
; RV64ZBB-NEXT: brev8 a0, a0
15481548
; RV64ZBB-NEXT: andi a0, a0, 1234
15491549
; RV64ZBB-NEXT: addi a2, a2, 1
1550-
; RV64ZBB-NEXT: add a0, a0, a1
1550+
; RV64ZBB-NEXT: addw a0, a0, a1
15511551
; RV64ZBB-NEXT: bltu a2, a3, .LBB25_1
15521552
; RV64ZBB-NEXT: # %bb.2: # %bb7
1553-
; RV64ZBB-NEXT: sext.w a0, a0
15541553
; RV64ZBB-NEXT: ret
15551554
;
15561555
; NOREMOVAL-LABEL: test21:
@@ -1641,10 +1640,9 @@ define signext i32 @test22(i64 %arg1, i64 %arg2, i64 %arg3) {
16411640
; RV64ZBB-NEXT: srli a0, a0, 28
16421641
; RV64ZBB-NEXT: andi a0, a0, 1234
16431642
; RV64ZBB-NEXT: addi a2, a2, 1
1644-
; RV64ZBB-NEXT: add a0, a0, a1
1643+
; RV64ZBB-NEXT: addw a0, a0, a1
16451644
; RV64ZBB-NEXT: bltu a2, a3, .LBB26_1
16461645
; RV64ZBB-NEXT: # %bb.2: # %bb7
1647-
; RV64ZBB-NEXT: sext.w a0, a0
16481646
; RV64ZBB-NEXT: ret
16491647
;
16501648
; NOREMOVAL-LABEL: test22:

0 commit comments

Comments
 (0)