1 ; RUN: llc < %s -mtriple=x86_64-apple-darwin10 -show-mc-encoding | FileCheck %s
3 define i32 @test1(i32 %X, i32* %y) nounwind {
4 %tmp = load i32, i32* %y ; <i32> [#uses=1]
5 %tmp.upgrd.1 = icmp eq i32 %tmp, 0 ; <i1> [#uses=1]
6 br i1 %tmp.upgrd.1, label %ReturnBlock, label %cond_true
8 cond_true: ; preds = %0
11 ReturnBlock: ; preds = %0
14 ; CHECK: cmpl $0, (%rsi)
17 define i32 @test2(i32 %X, i32* %y) nounwind {
18 %tmp = load i32, i32* %y ; <i32> [#uses=1]
19 %tmp1 = shl i32 %tmp, 3 ; <i32> [#uses=1]
20 %tmp1.upgrd.2 = icmp eq i32 %tmp1, 0 ; <i1> [#uses=1]
21 br i1 %tmp1.upgrd.2, label %ReturnBlock, label %cond_true
23 cond_true: ; preds = %0
26 ReturnBlock: ; preds = %0
29 ; CHECK: testl $536870911, (%rsi)
32 define i8 @test2b(i8 %X, i8* %y) nounwind {
33 %tmp = load i8, i8* %y ; <i8> [#uses=1]
34 %tmp1 = shl i8 %tmp, 3 ; <i8> [#uses=1]
35 %tmp1.upgrd.2 = icmp eq i8 %tmp1, 0 ; <i1> [#uses=1]
36 br i1 %tmp1.upgrd.2, label %ReturnBlock, label %cond_true
38 cond_true: ; preds = %0
41 ReturnBlock: ; preds = %0
43 ; CHECK-LABEL: test2b:
44 ; CHECK: testb $31, (%rsi)
47 define i64 @test3(i64 %x) nounwind {
48 %t = icmp eq i64 %x, 0
49 %r = zext i1 %t to i64
52 ; CHECK: testq %rdi, %rdi
54 ; CHECK: movzbl %al, %eax
58 define i64 @test4(i64 %x) nounwind {
59 %t = icmp slt i64 %x, 1
60 %r = zext i1 %t to i64
63 ; CHECK: testq %rdi, %rdi
65 ; CHECK: movzbl %al, %eax
70 define i32 @test5(double %A) nounwind {
72 %tmp2 = fcmp ogt double %A, 1.500000e+02; <i1> [#uses=1]
73 %tmp5 = fcmp ult double %A, 7.500000e+01; <i1> [#uses=1]
74 %bothcond = or i1 %tmp2, %tmp5; <i1> [#uses=1]
75 br i1 %bothcond, label %bb8, label %bb12
78 %tmp9 = tail call i32 (...)* @foo( ) nounwind ; <i32> [#uses=1]
84 ; CHECK: ucomisd LCPI5_0(%rip), %xmm0
85 ; CHECK: ucomisd LCPI5_1(%rip), %xmm0
90 define i32 @test6() nounwind align 2 {
91 %A = alloca {i64, i64}, align 8
92 %B = getelementptr inbounds {i64, i64}, {i64, i64}* %A, i64 0, i32 1
93 %C = load i64, i64* %B
94 %D = icmp eq i64 %C, 0
95 br i1 %D, label %T, label %F
101 ; CHECK-LABEL: test6:
102 ; CHECK: cmpq $0, -8(%rsp)
103 ; CHECK: encoding: [0x48,0x83,0x7c,0x24,0xf8,0x00]
107 define i32 @test7(i64 %res) nounwind {
109 ; CHECK-LABEL: test7:
111 ; CHECK: shrq $32, %rdi
113 %lnot = icmp ult i64 %res, 4294967296
114 %lnot.ext = zext i1 %lnot to i32
118 define i32 @test8(i64 %res) nounwind {
120 ; CHECK-LABEL: test8:
122 ; CHECK: shrq $32, %rdi
123 ; CHECK: cmpq $3, %rdi
124 %lnot = icmp ult i64 %res, 12884901888
125 %lnot.ext = zext i1 %lnot to i32
129 define i32 @test9(i64 %res) nounwind {
131 ; CHECK-LABEL: test9:
133 ; CHECK: shrq $33, %rdi
135 %lnot = icmp ult i64 %res, 8589934592
136 %lnot.ext = zext i1 %lnot to i32
140 define i32 @test10(i64 %res) nounwind {
142 ; CHECK-LABEL: test10:
144 ; CHECK: shrq $32, %rdi
146 %lnot = icmp uge i64 %res, 4294967296
147 %lnot.ext = zext i1 %lnot to i32
152 define i32 @test11(i64 %l) nounwind {
154 ; CHECK-LABEL: test11:
157 ; CHECK: shrq $47, %rdi
158 ; CHECK: cmpq $1, %rdi
159 %shr.mask = and i64 %l, -140737488355328
160 %cmp = icmp eq i64 %shr.mask, 140737488355328
161 %conv = zext i1 %cmp to i32
165 define i32 @test12() uwtable ssp {
166 ; CHECK-LABEL: test12:
168 %1 = call zeroext i1 @test12b()
169 br i1 %1, label %2, label %3
171 ; <label>:2 ; preds = %0
174 ; <label>:3 ; preds = %0
178 declare zeroext i1 @test12b()
180 define i32 @test13(i32 %mask, i32 %base, i32 %intra) {
181 %and = and i32 %mask, 8
182 %tobool = icmp ne i32 %and, 0
183 %cond = select i1 %tobool, i32 %intra, i32 %base
186 ; CHECK-LABEL: test13:
187 ; CHECK: testb $8, %dil
191 define i32 @test14(i32 %mask, i32 %base, i32 %intra) #0 {
192 %s = lshr i32 %mask, 7
193 %tobool = icmp sgt i32 %s, -1
194 %cond = select i1 %tobool, i32 %intra, i32 %base
197 ; CHECK-LABEL: test14:
198 ; CHECK: shrl $7, %edi
199 ; CHECK-NEXT: cmovnsl %edx, %esi
203 define zeroext i1 @test15(i32 %bf.load, i32 %n) {
204 %bf.lshr = lshr i32 %bf.load, 16
205 %cmp2 = icmp eq i32 %bf.lshr, 0
206 %cmp5 = icmp uge i32 %bf.lshr, %n
207 %.cmp5 = or i1 %cmp2, %cmp5
210 ; CHECK-LABEL: test15:
211 ; CHECK: shrl $16, %edi
212 ; CHECK: cmpl %esi, %edi