1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i386-apple-darwin10 -mcpu=penryn | FileCheck %s
6 define i32 @test1(i32 %a, i32 %b) nounwind ssp {
8 ; CHECK: ## %bb.0: ## %entry
9 ; CHECK-NEXT: movzbl {{[0-9]+}}(%esp), %eax
10 ; CHECK-NEXT: xorb {{[0-9]+}}(%esp), %al
11 ; CHECK-NEXT: testb $64, %al
12 ; CHECK-NEXT: jne _bar ## TAILCALL
13 ; CHECK-NEXT: ## %bb.1: ## %bb
14 ; CHECK-NEXT: jmp _foo ## TAILCALL
16 %0 = and i32 %a, 16384
17 %1 = icmp ne i32 %0, 0
18 %2 = and i32 %b, 16384
19 %3 = icmp ne i32 %2, 0
21 br i1 %4, label %bb1, label %bb
24 %5 = tail call i32 (...) @foo() nounwind ; <i32> [#uses=1]
28 %6 = tail call i32 (...) @bar() nounwind ; <i32> [#uses=1]
37 ; <rdar://problem/7598384>:
53 define float @test4(float %x, float %y) nounwind readnone optsize ssp {
55 ; CHECK: ## %bb.0: ## %entry
56 ; CHECK-NEXT: pushl %eax
57 ; CHECK-NEXT: cvtss2sd {{[0-9]+}}(%esp), %xmm1
58 ; CHECK-NEXT: cvtss2sd {{[0-9]+}}(%esp), %xmm0
59 ; CHECK-NEXT: mulsd %xmm1, %xmm0
60 ; CHECK-NEXT: xorpd %xmm1, %xmm1
61 ; CHECK-NEXT: ucomisd %xmm1, %xmm0
62 ; CHECK-NEXT: jne LBB1_1
63 ; CHECK-NEXT: jnp LBB1_2
64 ; CHECK-NEXT: LBB1_1: ## %bb1
65 ; CHECK-NEXT: addsd {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
66 ; CHECK-NEXT: LBB1_2: ## %bb2
67 ; CHECK-NEXT: cvtsd2ss %xmm0, %xmm0
68 ; CHECK-NEXT: movss %xmm0, (%esp)
69 ; CHECK-NEXT: flds (%esp)
70 ; CHECK-NEXT: popl %eax
73 %0 = fpext float %x to double ; <double> [#uses=1]
74 %1 = fpext float %y to double ; <double> [#uses=1]
75 %2 = fmul double %0, %1 ; <double> [#uses=3]
76 %3 = fcmp oeq double %2, 0.000000e+00 ; <i1> [#uses=1]
77 br i1 %3, label %bb2, label %bb1
81 %4 = fadd double %2, -1.000000e+00 ; <double> [#uses=1]
84 bb2: ; preds = %entry, %bb1
85 %.0.in = phi double [ %4, %bb1 ], [ %2, %entry ] ; <double> [#uses=1]
86 %.0 = fptrunc double %.0.in to float ; <float> [#uses=1]
90 declare i32 @llvm.x86.sse41.ptestz(<4 x float> %p1, <4 x float> %p2) nounwind
91 declare i32 @llvm.x86.sse41.ptestc(<4 x float> %p1, <4 x float> %p2) nounwind
93 define <4 x float> @test5(<4 x float> %a, <4 x float> %b) nounwind {
95 ; CHECK: ## %bb.0: ## %entry
96 ; CHECK-NEXT: ptest %xmm0, %xmm0
97 ; CHECK-NEXT: jne LBB2_2
98 ; CHECK-NEXT: ## %bb.1: ## %bb1
99 ; CHECK-NEXT: addps {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1
100 ; CHECK-NEXT: movaps %xmm1, %xmm0
102 ; CHECK-NEXT: LBB2_2: ## %bb2
103 ; CHECK-NEXT: divps {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1
104 ; CHECK-NEXT: movaps %xmm1, %xmm0
108 %res = call i32 @llvm.x86.sse41.ptestz(<4 x float> %a, <4 x float> %a) nounwind
109 %one = icmp ne i32 %res, 0
110 br i1 %one, label %bb1, label %bb2
113 %c = fadd <4 x float> %b, < float 1.000000e+002, float 2.000000e+002, float 3.000000e+002, float 4.000000e+002 >
117 %d = fdiv <4 x float> %b, < float 1.000000e+002, float 2.000000e+002, float 3.000000e+002, float 4.000000e+002 >
121 %e = phi <4 x float> [%c, %bb1], [%d, %bb2]
125 define <4 x float> @test7(<4 x float> %a, <4 x float> %b) nounwind {
126 ; CHECK-LABEL: test7:
127 ; CHECK: ## %bb.0: ## %entry
128 ; CHECK-NEXT: ptest %xmm0, %xmm0
129 ; CHECK-NEXT: jne LBB3_2
130 ; CHECK-NEXT: ## %bb.1: ## %bb1
131 ; CHECK-NEXT: addps {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1
132 ; CHECK-NEXT: movaps %xmm1, %xmm0
134 ; CHECK-NEXT: LBB3_2: ## %bb2
135 ; CHECK-NEXT: divps {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1
136 ; CHECK-NEXT: movaps %xmm1, %xmm0
140 %res = call i32 @llvm.x86.sse41.ptestz(<4 x float> %a, <4 x float> %a) nounwind
141 %one = trunc i32 %res to i1
142 br i1 %one, label %bb1, label %bb2
145 %c = fadd <4 x float> %b, < float 1.000000e+002, float 2.000000e+002, float 3.000000e+002, float 4.000000e+002 >
149 %d = fdiv <4 x float> %b, < float 1.000000e+002, float 2.000000e+002, float 3.000000e+002, float 4.000000e+002 >
153 %e = phi <4 x float> [%c, %bb1], [%d, %bb2]
157 define <4 x float> @test8(<4 x float> %a, <4 x float> %b) nounwind {
158 ; CHECK-LABEL: test8:
159 ; CHECK: ## %bb.0: ## %entry
160 ; CHECK-NEXT: ptest %xmm0, %xmm0
161 ; CHECK-NEXT: jae LBB4_2
162 ; CHECK-NEXT: ## %bb.1: ## %bb1
163 ; CHECK-NEXT: addps {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1
164 ; CHECK-NEXT: movaps %xmm1, %xmm0
166 ; CHECK-NEXT: LBB4_2: ## %bb2
167 ; CHECK-NEXT: divps {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1
168 ; CHECK-NEXT: movaps %xmm1, %xmm0
172 %res = call i32 @llvm.x86.sse41.ptestc(<4 x float> %a, <4 x float> %a) nounwind
173 %one = icmp ne i32 %res, 0
174 br i1 %one, label %bb1, label %bb2
177 %c = fadd <4 x float> %b, < float 1.000000e+002, float 2.000000e+002, float 3.000000e+002, float 4.000000e+002 >
181 %d = fdiv <4 x float> %b, < float 1.000000e+002, float 2.000000e+002, float 3.000000e+002, float 4.000000e+002 >
185 %e = phi <4 x float> [%c, %bb1], [%d, %bb2]
189 define <4 x float> @test10(<4 x float> %a, <4 x float> %b) nounwind {
190 ; CHECK-LABEL: test10:
191 ; CHECK: ## %bb.0: ## %entry
192 ; CHECK-NEXT: ptest %xmm0, %xmm0
193 ; CHECK-NEXT: jae LBB5_2
194 ; CHECK-NEXT: ## %bb.1: ## %bb1
195 ; CHECK-NEXT: addps {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1
196 ; CHECK-NEXT: movaps %xmm1, %xmm0
198 ; CHECK-NEXT: LBB5_2: ## %bb2
199 ; CHECK-NEXT: divps {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1
200 ; CHECK-NEXT: movaps %xmm1, %xmm0
204 %res = call i32 @llvm.x86.sse41.ptestc(<4 x float> %a, <4 x float> %a) nounwind
205 %one = trunc i32 %res to i1
206 br i1 %one, label %bb1, label %bb2
209 %c = fadd <4 x float> %b, < float 1.000000e+002, float 2.000000e+002, float 3.000000e+002, float 4.000000e+002 >
213 %d = fdiv <4 x float> %b, < float 1.000000e+002, float 2.000000e+002, float 3.000000e+002, float 4.000000e+002 >
217 %e = phi <4 x float> [%c, %bb1], [%d, %bb2]
221 define <4 x float> @test11(<4 x float> %a, <4 x float> %b) nounwind {
222 ; CHECK-LABEL: test11:
223 ; CHECK: ## %bb.0: ## %entry
224 ; CHECK-NEXT: ptest %xmm0, %xmm0
225 ; CHECK-NEXT: jne LBB6_2
226 ; CHECK-NEXT: ## %bb.1: ## %bb1
227 ; CHECK-NEXT: addps {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1
228 ; CHECK-NEXT: movaps %xmm1, %xmm0
230 ; CHECK-NEXT: LBB6_2: ## %bb2
231 ; CHECK-NEXT: divps {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1
232 ; CHECK-NEXT: movaps %xmm1, %xmm0
236 %res = call i32 @llvm.x86.sse41.ptestz(<4 x float> %a, <4 x float> %a) nounwind
237 %one = icmp eq i32 %res, 1
238 br i1 %one, label %bb1, label %bb2
241 %c = fadd <4 x float> %b, < float 1.000000e+002, float 2.000000e+002, float 3.000000e+002, float 4.000000e+002 >
245 %d = fdiv <4 x float> %b, < float 1.000000e+002, float 2.000000e+002, float 3.000000e+002, float 4.000000e+002 >
249 %e = phi <4 x float> [%c, %bb1], [%d, %bb2]
253 define <4 x float> @test12(<4 x float> %a, <4 x float> %b) nounwind {
254 ; CHECK-LABEL: test12:
255 ; CHECK: ## %bb.0: ## %entry
256 ; CHECK-NEXT: ptest %xmm0, %xmm0
257 ; CHECK-NEXT: je LBB7_2
258 ; CHECK-NEXT: ## %bb.1: ## %bb1
259 ; CHECK-NEXT: addps {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1
260 ; CHECK-NEXT: movaps %xmm1, %xmm0
262 ; CHECK-NEXT: LBB7_2: ## %bb2
263 ; CHECK-NEXT: divps {{\.?LCPI[0-9]+_[0-9]+}}, %xmm1
264 ; CHECK-NEXT: movaps %xmm1, %xmm0
268 %res = call i32 @llvm.x86.sse41.ptestz(<4 x float> %a, <4 x float> %a) nounwind
269 %one = icmp ne i32 %res, 1
270 br i1 %one, label %bb1, label %bb2
273 %c = fadd <4 x float> %b, < float 1.000000e+002, float 2.000000e+002, float 3.000000e+002, float 4.000000e+002 >
277 %d = fdiv <4 x float> %b, < float 1.000000e+002, float 2.000000e+002, float 3.000000e+002, float 4.000000e+002 >
281 %e = phi <4 x float> [%c, %bb1], [%d, %bb2]