Skip to content

Commit 0ad34a6

Browse files
committed
Pre-commit tests
1 parent 2135148 commit 0ad34a6

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

llvm/test/CodeGen/RISCV/rv64i-shift-sext.ll

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,3 +220,18 @@ define signext i32 @test14(ptr %0, ptr %1, i64 %2) {
220220
%12 = add i32 %9, %11
221221
ret i32 %12
222222
}
223+
224+
; Test that we can propage sign bits through sraw. We should use an slli
225+
; instead of slliw.
226+
define signext i32 @test15(i32 signext %x, i32 signext %y) {
227+
; RV64I-LABEL: test15:
228+
; RV64I: # %bb.0:
229+
; RV64I-NEXT: srli a0, a0, 1
230+
; RV64I-NEXT: sraw a0, a0, a1
231+
; RV64I-NEXT: slliw a0, a0, 1
232+
; RV64I-NEXT: ret
233+
%a = ashr i32 %x, 1
234+
%b = ashr i32 %a, %y
235+
%c = shl i32 %b, 1
236+
ret i32 %c
237+
}

0 commit comments

Comments
 (0)