Skip to content

Commit 3e5d282

Browse files
Add files via upload
1 parent a6a33c7 commit 3e5d282

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
; RUN: opt -passes=instcombine -S < %s | FileCheck %s
2+
3+
declare i32 @llvm.cttz.i32(i32, i1)
4+
5+
define i32 @test_cttz_lshr(i32 %x) {
6+
; CHECK-LABEL: @test_cttz_lshr(
7+
; CHECK: call range(i32 0, 33) i32 @llvm.cttz.i32(
8+
; CHECK: lshr exact i32
9+
; CHECK: ret i32
10+
%cttz = call i32 @llvm.cttz.i32(i32 %x, i1 false)
11+
%sh = lshr i32 %x, %cttz
12+
ret i32 %sh
13+
}
14+
15+
define i32 @test_cttz_ashr(i32 %x) {
16+
; CHECK-LABEL: @test_cttz_ashr(
17+
; CHECK: call range(i32 0, 33) i32 @llvm.cttz.i32(
18+
; CHECK: ashr exact i32
19+
; CHECK: ret i32
20+
%cttz = call i32 @llvm.cttz.i32(i32 %x, i1 true)
21+
%sh = ashr i32 %x, %cttz
22+
ret i32 %sh
23+
}
24+

0 commit comments

Comments
 (0)