Skip to content

Commit

Permalink
[RISCV] Add test case show missed opportunity to turn slliw+sraiw int…
Browse files Browse the repository at this point in the history
…o slli+srai.

slliw and sraiw have no compressed encodings. slli and srai
do have compressed encodings.

Pre-commit for D129688
  • Loading branch information
topperc committed Jul 13, 2022
1 parent 1a5c1ee commit e32864b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions llvm/test/CodeGen/RISCV/rv64i-shift-sext.ll
Expand Up @@ -158,3 +158,16 @@ define i64 @test11(i32* %0, i64 %1) {
%5 = ashr exact i64 %4, 32
ret i64 %5
}

; TODO: We should use slli+srai to enable the possibility of compressed
; instructions.
define i32 @test12(i32 signext %0) {
; RV64I-LABEL: test12:
; RV64I: # %bb.0:
; RV64I-NEXT: slliw a0, a0, 17
; RV64I-NEXT: sraiw a0, a0, 15
; RV64I-NEXT: ret
%2 = shl i32 %0, 17
%3 = ashr i32 %2, 15
ret i32 %3
}

0 comments on commit e32864b

Please sign in to comment.