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: movb {{[0-9]+}}(%esp), %al
10 ; CHECK-NEXT: xorb {{[0-9]+}}(%esp), %al
11 ; CHECK-NEXT: testb $64, %al
12 ; CHECK-NEXT: je LBB0_1
13 ; CHECK-NEXT: ## %bb.2: ## %bb1
14 ; CHECK-NEXT: jmp _bar ## TAILCALL
15 ; CHECK-NEXT: LBB0_1: ## %bb
16 ; CHECK-NEXT: jmp _foo ## TAILCALL
18 %0 = and i32 %a, 16384
19 %1 = icmp ne i32 %0, 0
20 %2 = and i32 %b, 16384
21 %3 = icmp ne i32 %2, 0
23 br i1 %4, label %bb1, label %bb
26 %5 = tail call i32 (...) @foo() nounwind ; <i32> [#uses=1]
30 %6 = tail call i32 (...) @bar() nounwind ; <i32> [#uses=1]
39 ; <rdar://problem/7598384>:
55 define float @test4(float %x, float %y) nounwind readnone optsize ssp {
57 ; CHECK: ## %bb.0: ## %entry
58 ; CHECK-NEXT: pushl %eax
59 ; CHECK-NEXT: cvtss2sd {{[0-9]+}}(%esp), %xmm1
60 ; CHECK-NEXT: cvtss2sd {{[0-9]+}}(%esp), %xmm0
61 ; CHECK-NEXT: mulsd %xmm1, %xmm0
62 ; CHECK-NEXT: xorpd %xmm1, %xmm1
63 ; CHECK-NEXT: ucomisd %xmm1, %xmm0
64 ; CHECK-NEXT: jne LBB1_1
65 ; CHECK-NEXT: jnp LBB1_2
66 ; CHECK-NEXT: LBB1_1: ## %bb1
67 ; CHECK-NEXT: addsd LCPI1_0, %xmm0
68 ; CHECK-NEXT: LBB1_2: ## %bb2
69 ; CHECK-NEXT: cvtsd2ss %xmm0, %xmm0
70 ; CHECK-NEXT: movss %xmm0, (%esp)
71 ; CHECK-NEXT: flds (%esp)
72 ; CHECK-NEXT: popl %eax
75 %0 = fpext float %x to double ; <double> [#uses=1]
76 %1 = fpext float %y to double ; <double> [#uses=1]
77 %2 = fmul double %0, %1 ; <double> [#uses=3]
78 %3 = fcmp oeq double %2, 0.000000e+00 ; <i1> [#uses=1]
79 br i1 %3, label %bb2, label %bb1
83 %4 = fadd double %2, -1.000000e+00 ; <double> [#uses=1]
86 bb2: ; preds = %entry, %bb1
87 %.0.in = phi double [ %4, %bb1 ], [ %2, %entry ] ; <double> [#uses=1]
88 %.0 = fptrunc double %.0.in to float ; <float> [#uses=1]
92 declare i32 @llvm.x86.sse41.ptestz(<4 x float> %p1, <4 x float> %p2) nounwind
93 declare i32 @llvm.x86.sse41.ptestc(<4 x float> %p1, <4 x float> %p2) nounwind
95 define <4 x float> @test5(<4 x float> %a, <4 x float> %b) nounwind {
97 ; CHECK: ## %bb.0: ## %entry
98 ; CHECK-NEXT: ptest %xmm0, %xmm0
99 ; CHECK-NEXT: jne LBB2_2
100 ; CHECK-NEXT: ## %bb.1: ## %bb1
101 ; CHECK-NEXT: addps LCPI2_0, %xmm1
102 ; CHECK-NEXT: movaps %xmm1, %xmm0
104 ; CHECK-NEXT: LBB2_2: ## %bb2
105 ; CHECK-NEXT: divps LCPI2_0, %xmm1
106 ; CHECK-NEXT: movaps %xmm1, %xmm0
110 %res = call i32 @llvm.x86.sse41.ptestz(<4 x float> %a, <4 x float> %a) nounwind
111 %one = icmp ne i32 %res, 0
112 br i1 %one, label %bb1, label %bb2
115 %c = fadd <4 x float> %b, < float 1.000000e+002, float 2.000000e+002, float 3.000000e+002, float 4.000000e+002 >
119 %d = fdiv <4 x float> %b, < float 1.000000e+002, float 2.000000e+002, float 3.000000e+002, float 4.000000e+002 >
123 %e = phi <4 x float> [%c, %bb1], [%d, %bb2]
127 define <4 x float> @test7(<4 x float> %a, <4 x float> %b) nounwind {
128 ; CHECK-LABEL: test7:
129 ; CHECK: ## %bb.0: ## %entry
130 ; CHECK-NEXT: ptest %xmm0, %xmm0
131 ; CHECK-NEXT: jne LBB3_2
132 ; CHECK-NEXT: ## %bb.1: ## %bb1
133 ; CHECK-NEXT: addps LCPI3_0, %xmm1
134 ; CHECK-NEXT: movaps %xmm1, %xmm0
136 ; CHECK-NEXT: LBB3_2: ## %bb2
137 ; CHECK-NEXT: divps LCPI3_0, %xmm1
138 ; CHECK-NEXT: movaps %xmm1, %xmm0
142 %res = call i32 @llvm.x86.sse41.ptestz(<4 x float> %a, <4 x float> %a) nounwind
143 %one = trunc i32 %res to i1
144 br i1 %one, label %bb1, label %bb2
147 %c = fadd <4 x float> %b, < float 1.000000e+002, float 2.000000e+002, float 3.000000e+002, float 4.000000e+002 >
151 %d = fdiv <4 x float> %b, < float 1.000000e+002, float 2.000000e+002, float 3.000000e+002, float 4.000000e+002 >
155 %e = phi <4 x float> [%c, %bb1], [%d, %bb2]
159 define <4 x float> @test8(<4 x float> %a, <4 x float> %b) nounwind {
160 ; CHECK-LABEL: test8:
161 ; CHECK: ## %bb.0: ## %entry
162 ; CHECK-NEXT: ptest %xmm0, %xmm0
163 ; CHECK-NEXT: jae LBB4_2
164 ; CHECK-NEXT: ## %bb.1: ## %bb1
165 ; CHECK-NEXT: addps LCPI4_0, %xmm1
166 ; CHECK-NEXT: movaps %xmm1, %xmm0
168 ; CHECK-NEXT: LBB4_2: ## %bb2
169 ; CHECK-NEXT: divps LCPI4_0, %xmm1
170 ; CHECK-NEXT: movaps %xmm1, %xmm0
174 %res = call i32 @llvm.x86.sse41.ptestc(<4 x float> %a, <4 x float> %a) nounwind
175 %one = icmp ne i32 %res, 0
176 br i1 %one, label %bb1, label %bb2
179 %c = fadd <4 x float> %b, < float 1.000000e+002, float 2.000000e+002, float 3.000000e+002, float 4.000000e+002 >
183 %d = fdiv <4 x float> %b, < float 1.000000e+002, float 2.000000e+002, float 3.000000e+002, float 4.000000e+002 >
187 %e = phi <4 x float> [%c, %bb1], [%d, %bb2]
191 define <4 x float> @test10(<4 x float> %a, <4 x float> %b) nounwind {
192 ; CHECK-LABEL: test10:
193 ; CHECK: ## %bb.0: ## %entry
194 ; CHECK-NEXT: ptest %xmm0, %xmm0
195 ; CHECK-NEXT: jae LBB5_2
196 ; CHECK-NEXT: ## %bb.1: ## %bb1
197 ; CHECK-NEXT: addps LCPI5_0, %xmm1
198 ; CHECK-NEXT: movaps %xmm1, %xmm0
200 ; CHECK-NEXT: LBB5_2: ## %bb2
201 ; CHECK-NEXT: divps LCPI5_0, %xmm1
202 ; CHECK-NEXT: movaps %xmm1, %xmm0
206 %res = call i32 @llvm.x86.sse41.ptestc(<4 x float> %a, <4 x float> %a) nounwind
207 %one = trunc i32 %res to i1
208 br i1 %one, label %bb1, label %bb2
211 %c = fadd <4 x float> %b, < float 1.000000e+002, float 2.000000e+002, float 3.000000e+002, float 4.000000e+002 >
215 %d = fdiv <4 x float> %b, < float 1.000000e+002, float 2.000000e+002, float 3.000000e+002, float 4.000000e+002 >
219 %e = phi <4 x float> [%c, %bb1], [%d, %bb2]
223 define <4 x float> @test11(<4 x float> %a, <4 x float> %b) nounwind {
224 ; CHECK-LABEL: test11:
225 ; CHECK: ## %bb.0: ## %entry
226 ; CHECK-NEXT: ptest %xmm0, %xmm0
227 ; CHECK-NEXT: jne LBB6_2
228 ; CHECK-NEXT: ## %bb.1: ## %bb1
229 ; CHECK-NEXT: addps LCPI6_0, %xmm1
230 ; CHECK-NEXT: movaps %xmm1, %xmm0
232 ; CHECK-NEXT: LBB6_2: ## %bb2
233 ; CHECK-NEXT: divps LCPI6_0, %xmm1
234 ; CHECK-NEXT: movaps %xmm1, %xmm0
238 %res = call i32 @llvm.x86.sse41.ptestz(<4 x float> %a, <4 x float> %a) nounwind
239 %one = icmp eq i32 %res, 1
240 br i1 %one, label %bb1, label %bb2
243 %c = fadd <4 x float> %b, < float 1.000000e+002, float 2.000000e+002, float 3.000000e+002, float 4.000000e+002 >
247 %d = fdiv <4 x float> %b, < float 1.000000e+002, float 2.000000e+002, float 3.000000e+002, float 4.000000e+002 >
251 %e = phi <4 x float> [%c, %bb1], [%d, %bb2]
255 define <4 x float> @test12(<4 x float> %a, <4 x float> %b) nounwind {
256 ; CHECK-LABEL: test12:
257 ; CHECK: ## %bb.0: ## %entry
258 ; CHECK-NEXT: ptest %xmm0, %xmm0
259 ; CHECK-NEXT: je LBB7_2
260 ; CHECK-NEXT: ## %bb.1: ## %bb1
261 ; CHECK-NEXT: addps LCPI7_0, %xmm1
262 ; CHECK-NEXT: movaps %xmm1, %xmm0
264 ; CHECK-NEXT: LBB7_2: ## %bb2
265 ; CHECK-NEXT: divps LCPI7_0, %xmm1
266 ; CHECK-NEXT: movaps %xmm1, %xmm0
270 %res = call i32 @llvm.x86.sse41.ptestz(<4 x float> %a, <4 x float> %a) nounwind
271 %one = icmp ne i32 %res, 1
272 br i1 %one, label %bb1, label %bb2
275 %c = fadd <4 x float> %b, < float 1.000000e+002, float 2.000000e+002, float 3.000000e+002, float 4.000000e+002 >
279 %d = fdiv <4 x float> %b, < float 1.000000e+002, float 2.000000e+002, float 3.000000e+002, float 4.000000e+002 >
283 %e = phi <4 x float> [%c, %bb1], [%d, %bb2]