llvm.org GIT mirror llvm / 9d2051f
Add i8 and i64 testing for ctlz on x86. Also simplify the i16 test. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147249 91177308-0d34-0410-b5e6-96231b3b80d8 Chandler Carruth 8 years ago
1 changed file(s) with 26 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
None ; RUN: llc < %s -march=x86 -mcpu=yonah | FileCheck %s
0 ; RUN: llc < %s -march=x86-64 -mcpu=yonah | FileCheck %s
11
22 declare i32 @llvm.cttz.i32(i32, i1)
3 declare i8 @llvm.ctlz.i8(i8, i1)
34 declare i16 @llvm.ctlz.i16(i16, i1)
45 declare i32 @llvm.ctlz.i32(i32, i1)
6 declare i64 @llvm.ctlz.i64(i64, i1)
57
68 define i32 @cttz_i32(i32 %x) {
79 %tmp = call i32 @llvm.cttz.i32( i32 %x, i1 true )
1214 ; CHECK: ret
1315 }
1416
15 define i16 @ctlz_i16(i16 %x, i16 %y) {
17 define i8 @ctlz_i8(i8 %x) {
1618 entry:
17 %tmp1 = add i16 %x, %y
18 %tmp2 = call i16 @llvm.ctlz.i16( i16 %tmp1, i1 true )
19 %tmp2 = call i8 @llvm.ctlz.i8( i8 %x, i1 true )
20 ret i8 %tmp2
21 ; CHECK: ctlz_i8:
22 ; CHECK: bsrl
23 ; CHECK-NOT: cmov
24 ; CHECK: xorl $7,
25 ; CHECK: ret
26 }
27
28 define i16 @ctlz_i16(i16 %x) {
29 entry:
30 %tmp2 = call i16 @llvm.ctlz.i16( i16 %x, i1 true )
1931 ret i16 %tmp2
2032 ; CHECK: ctlz_i16:
2133 ; CHECK: bsrw
3143 ; CHECK: bsrl
3244 ; CHECK-NOT: cmov
3345 ; CHECK: xorl $31,
46 ; CHECK: ret
47 }
48
49 define i64 @ctlz_i64(i64 %x) {
50 %tmp = call i64 @llvm.ctlz.i64( i64 %x, i1 true )
51 ret i64 %tmp
52 ; CHECK: ctlz_i64:
53 ; CHECK: bsrq
54 ; CHECK-NOT: cmov
55 ; CHECK: xorq $63,
3456 ; CHECK: ret
3557 }
3658