1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i386-apple-darwin10 -mcpu=corei7-avx -mattr=+avx | FileCheck %s
4 declare i32 @llvm.x86.avx.ptestz.256(<4 x i64> %p1, <4 x i64> %p2) nounwind
5 declare i32 @llvm.x86.avx.ptestc.256(<4 x i64> %p1, <4 x i64> %p2) nounwind
7 define <4 x float> @test1(<4 x i64> %a, <4 x float> %b) nounwind {
9 ; CHECK: ## %bb.0: ## %entry
10 ; CHECK-NEXT: vptest %ymm0, %ymm0
11 ; CHECK-NEXT: jne LBB0_2
12 ; CHECK-NEXT: ## %bb.1: ## %bb1
13 ; CHECK-NEXT: vaddps LCPI0_0, %xmm1, %xmm0
14 ; CHECK-NEXT: vzeroupper
16 ; CHECK-NEXT: LBB0_2: ## %bb2
17 ; CHECK-NEXT: vdivps LCPI0_0, %xmm1, %xmm0
18 ; CHECK-NEXT: vzeroupper
22 %res = call i32 @llvm.x86.avx.ptestz.256(<4 x i64> %a, <4 x i64> %a) nounwind
23 %one = icmp ne i32 %res, 0
24 br i1 %one, label %bb1, label %bb2
27 %c = fadd <4 x float> %b, < float 1.000000e+002, float 2.000000e+002, float 3.000000e+002, float 4.000000e+002 >
31 %d = fdiv <4 x float> %b, < float 1.000000e+002, float 2.000000e+002, float 3.000000e+002, float 4.000000e+002 >
35 %e = phi <4 x float> [%c, %bb1], [%d, %bb2]
39 define <4 x float> @test3(<4 x i64> %a, <4 x float> %b) nounwind {
41 ; CHECK: ## %bb.0: ## %entry
42 ; CHECK-NEXT: vptest %ymm0, %ymm0
43 ; CHECK-NEXT: jne LBB1_2
44 ; CHECK-NEXT: ## %bb.1: ## %bb1
45 ; CHECK-NEXT: vaddps LCPI1_0, %xmm1, %xmm0
46 ; CHECK-NEXT: vzeroupper
48 ; CHECK-NEXT: LBB1_2: ## %bb2
49 ; CHECK-NEXT: vdivps LCPI1_0, %xmm1, %xmm0
50 ; CHECK-NEXT: vzeroupper
54 %res = call i32 @llvm.x86.avx.ptestz.256(<4 x i64> %a, <4 x i64> %a) nounwind
55 %one = trunc i32 %res to i1
56 br i1 %one, label %bb1, label %bb2
59 %c = fadd <4 x float> %b, < float 1.000000e+002, float 2.000000e+002, float 3.000000e+002, float 4.000000e+002 >
63 %d = fdiv <4 x float> %b, < float 1.000000e+002, float 2.000000e+002, float 3.000000e+002, float 4.000000e+002 >
67 %e = phi <4 x float> [%c, %bb1], [%d, %bb2]
71 define <4 x float> @test4(<4 x i64> %a, <4 x float> %b) nounwind {
73 ; CHECK: ## %bb.0: ## %entry
74 ; CHECK-NEXT: vptest %ymm0, %ymm0
75 ; CHECK-NEXT: jae LBB2_2
76 ; CHECK-NEXT: ## %bb.1: ## %bb1
77 ; CHECK-NEXT: vaddps LCPI2_0, %xmm1, %xmm0
78 ; CHECK-NEXT: vzeroupper
80 ; CHECK-NEXT: LBB2_2: ## %bb2
81 ; CHECK-NEXT: vdivps LCPI2_0, %xmm1, %xmm0
82 ; CHECK-NEXT: vzeroupper
86 %res = call i32 @llvm.x86.avx.ptestc.256(<4 x i64> %a, <4 x i64> %a) nounwind
87 %one = icmp ne i32 %res, 0
88 br i1 %one, label %bb1, label %bb2
91 %c = fadd <4 x float> %b, < float 1.000000e+002, float 2.000000e+002, float 3.000000e+002, float 4.000000e+002 >
95 %d = fdiv <4 x float> %b, < float 1.000000e+002, float 2.000000e+002, float 3.000000e+002, float 4.000000e+002 >
99 %e = phi <4 x float> [%c, %bb1], [%d, %bb2]
103 define <4 x float> @test6(<4 x i64> %a, <4 x float> %b) nounwind {
104 ; CHECK-LABEL: test6:
105 ; CHECK: ## %bb.0: ## %entry
106 ; CHECK-NEXT: vptest %ymm0, %ymm0
107 ; CHECK-NEXT: jae LBB3_2
108 ; CHECK-NEXT: ## %bb.1: ## %bb1
109 ; CHECK-NEXT: vaddps LCPI3_0, %xmm1, %xmm0
110 ; CHECK-NEXT: vzeroupper
112 ; CHECK-NEXT: LBB3_2: ## %bb2
113 ; CHECK-NEXT: vdivps LCPI3_0, %xmm1, %xmm0
114 ; CHECK-NEXT: vzeroupper
118 %res = call i32 @llvm.x86.avx.ptestc.256(<4 x i64> %a, <4 x i64> %a) nounwind
119 %one = trunc i32 %res to i1
120 br i1 %one, label %bb1, label %bb2
123 %c = fadd <4 x float> %b, < float 1.000000e+002, float 2.000000e+002, float 3.000000e+002, float 4.000000e+002 >
127 %d = fdiv <4 x float> %b, < float 1.000000e+002, float 2.000000e+002, float 3.000000e+002, float 4.000000e+002 >
131 %e = phi <4 x float> [%c, %bb1], [%d, %bb2]
135 define <4 x float> @test7(<4 x i64> %a, <4 x float> %b) nounwind {
136 ; CHECK-LABEL: test7:
137 ; CHECK: ## %bb.0: ## %entry
138 ; CHECK-NEXT: vptest %ymm0, %ymm0
139 ; CHECK-NEXT: jne LBB4_2
140 ; CHECK-NEXT: ## %bb.1: ## %bb1
141 ; CHECK-NEXT: vaddps LCPI4_0, %xmm1, %xmm0
142 ; CHECK-NEXT: vzeroupper
144 ; CHECK-NEXT: LBB4_2: ## %bb2
145 ; CHECK-NEXT: vdivps LCPI4_0, %xmm1, %xmm0
146 ; CHECK-NEXT: vzeroupper
150 %res = call i32 @llvm.x86.avx.ptestz.256(<4 x i64> %a, <4 x i64> %a) nounwind
151 %one = icmp eq i32 %res, 1
152 br i1 %one, label %bb1, label %bb2
155 %c = fadd <4 x float> %b, < float 1.000000e+002, float 2.000000e+002, float 3.000000e+002, float 4.000000e+002 >
159 %d = fdiv <4 x float> %b, < float 1.000000e+002, float 2.000000e+002, float 3.000000e+002, float 4.000000e+002 >
163 %e = phi <4 x float> [%c, %bb1], [%d, %bb2]
167 define <4 x float> @test8(<4 x i64> %a, <4 x float> %b) nounwind {
168 ; CHECK-LABEL: test8:
169 ; CHECK: ## %bb.0: ## %entry
170 ; CHECK-NEXT: vptest %ymm0, %ymm0
171 ; CHECK-NEXT: je LBB5_2
172 ; CHECK-NEXT: ## %bb.1: ## %bb1
173 ; CHECK-NEXT: vaddps LCPI5_0, %xmm1, %xmm0
174 ; CHECK-NEXT: vzeroupper
176 ; CHECK-NEXT: LBB5_2: ## %bb2
177 ; CHECK-NEXT: vdivps LCPI5_0, %xmm1, %xmm0
178 ; CHECK-NEXT: vzeroupper
182 %res = call i32 @llvm.x86.avx.ptestz.256(<4 x i64> %a, <4 x i64> %a) nounwind
183 %one = icmp ne i32 %res, 1
184 br i1 %one, label %bb1, label %bb2
187 %c = fadd <4 x float> %b, < float 1.000000e+002, float 2.000000e+002, float 3.000000e+002, float 4.000000e+002 >
191 %d = fdiv <4 x float> %b, < float 1.000000e+002, float 2.000000e+002, float 3.000000e+002, float 4.000000e+002 >
195 %e = phi <4 x float> [%c, %bb1], [%d, %bb2]