[TwoAddressInstructionPass] When looking for a 3 addr conversion after commuting...
[oota-llvm.git] / test / CodeGen / X86 / avx-intrinsics-x86.ll
1 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -march=x86 -mattr=avx,aes,pclmul | FileCheck %s
2
3 define <2 x i64> @test_x86_aesni_aesdec(<2 x i64> %a0, <2 x i64> %a1) {
4 ; CHECK-LABEL: test_x86_aesni_aesdec:
5 ; CHECK:       ## BB#0:
6 ; CHECK-NEXT:    vaesdec %xmm1, %xmm0, %xmm0
7 ; CHECK-NEXT:    retl
8   %res = call <2 x i64> @llvm.x86.aesni.aesdec(<2 x i64> %a0, <2 x i64> %a1) ; <<2 x i64>> [#uses=1]
9   ret <2 x i64> %res
10 }
11 declare <2 x i64> @llvm.x86.aesni.aesdec(<2 x i64>, <2 x i64>) nounwind readnone
12
13
14 define <2 x i64> @test_x86_aesni_aesdeclast(<2 x i64> %a0, <2 x i64> %a1) {
15 ; CHECK-LABEL: test_x86_aesni_aesdeclast:
16 ; CHECK:       ## BB#0:
17 ; CHECK-NEXT:    vaesdeclast %xmm1, %xmm0, %xmm0
18 ; CHECK-NEXT:    retl
19   %res = call <2 x i64> @llvm.x86.aesni.aesdeclast(<2 x i64> %a0, <2 x i64> %a1) ; <<2 x i64>> [#uses=1]
20   ret <2 x i64> %res
21 }
22 declare <2 x i64> @llvm.x86.aesni.aesdeclast(<2 x i64>, <2 x i64>) nounwind readnone
23
24
25 define <2 x i64> @test_x86_aesni_aesenc(<2 x i64> %a0, <2 x i64> %a1) {
26 ; CHECK-LABEL: test_x86_aesni_aesenc:
27 ; CHECK:       ## BB#0:
28 ; CHECK-NEXT:    vaesenc %xmm1, %xmm0, %xmm0
29 ; CHECK-NEXT:    retl
30   %res = call <2 x i64> @llvm.x86.aesni.aesenc(<2 x i64> %a0, <2 x i64> %a1) ; <<2 x i64>> [#uses=1]
31   ret <2 x i64> %res
32 }
33 declare <2 x i64> @llvm.x86.aesni.aesenc(<2 x i64>, <2 x i64>) nounwind readnone
34
35
36 define <2 x i64> @test_x86_aesni_aesenclast(<2 x i64> %a0, <2 x i64> %a1) {
37 ; CHECK-LABEL: test_x86_aesni_aesenclast:
38 ; CHECK:       ## BB#0:
39 ; CHECK-NEXT:    vaesenclast %xmm1, %xmm0, %xmm0
40 ; CHECK-NEXT:    retl
41   %res = call <2 x i64> @llvm.x86.aesni.aesenclast(<2 x i64> %a0, <2 x i64> %a1) ; <<2 x i64>> [#uses=1]
42   ret <2 x i64> %res
43 }
44 declare <2 x i64> @llvm.x86.aesni.aesenclast(<2 x i64>, <2 x i64>) nounwind readnone
45
46
47 define <2 x i64> @test_x86_aesni_aesimc(<2 x i64> %a0) {
48 ; CHECK-LABEL: test_x86_aesni_aesimc:
49 ; CHECK:       ## BB#0:
50 ; CHECK-NEXT:    vaesimc %xmm0, %xmm0
51 ; CHECK-NEXT:    retl
52   %res = call <2 x i64> @llvm.x86.aesni.aesimc(<2 x i64> %a0) ; <<2 x i64>> [#uses=1]
53   ret <2 x i64> %res
54 }
55 declare <2 x i64> @llvm.x86.aesni.aesimc(<2 x i64>) nounwind readnone
56
57
58 define <2 x i64> @test_x86_aesni_aeskeygenassist(<2 x i64> %a0) {
59 ; CHECK-LABEL: test_x86_aesni_aeskeygenassist:
60 ; CHECK:       ## BB#0:
61 ; CHECK-NEXT:    vaeskeygenassist $7, %xmm0, %xmm0
62 ; CHECK-NEXT:    retl
63   %res = call <2 x i64> @llvm.x86.aesni.aeskeygenassist(<2 x i64> %a0, i8 7) ; <<2 x i64>> [#uses=1]
64   ret <2 x i64> %res
65 }
66 declare <2 x i64> @llvm.x86.aesni.aeskeygenassist(<2 x i64>, i8) nounwind readnone
67
68
69 define <2 x double> @test_x86_sse2_add_sd(<2 x double> %a0, <2 x double> %a1) {
70 ; CHECK-LABEL: test_x86_sse2_add_sd:
71 ; CHECK:       ## BB#0:
72 ; CHECK-NEXT:    vaddsd %xmm1, %xmm0, %xmm0
73 ; CHECK-NEXT:    retl
74   %res = call <2 x double> @llvm.x86.sse2.add.sd(<2 x double> %a0, <2 x double> %a1) ; <<2 x double>> [#uses=1]
75   ret <2 x double> %res
76 }
77 declare <2 x double> @llvm.x86.sse2.add.sd(<2 x double>, <2 x double>) nounwind readnone
78
79
80 define <2 x double> @test_x86_sse2_cmp_pd(<2 x double> %a0, <2 x double> %a1) {
81 ; CHECK-LABEL: test_x86_sse2_cmp_pd:
82 ; CHECK:       ## BB#0:
83 ; CHECK-NEXT:    vcmpordpd %xmm1, %xmm0, %xmm0
84 ; CHECK-NEXT:    retl
85   %res = call <2 x double> @llvm.x86.sse2.cmp.pd(<2 x double> %a0, <2 x double> %a1, i8 7) ; <<2 x double>> [#uses=1]
86   ret <2 x double> %res
87 }
88 declare <2 x double> @llvm.x86.sse2.cmp.pd(<2 x double>, <2 x double>, i8) nounwind readnone
89
90
91 define <2 x double> @test_x86_sse2_cmp_sd(<2 x double> %a0, <2 x double> %a1) {
92 ; CHECK-LABEL: test_x86_sse2_cmp_sd:
93 ; CHECK:       ## BB#0:
94 ; CHECK-NEXT:    vcmpordsd %xmm1, %xmm0, %xmm0
95 ; CHECK-NEXT:    retl
96   %res = call <2 x double> @llvm.x86.sse2.cmp.sd(<2 x double> %a0, <2 x double> %a1, i8 7) ; <<2 x double>> [#uses=1]
97   ret <2 x double> %res
98 }
99 declare <2 x double> @llvm.x86.sse2.cmp.sd(<2 x double>, <2 x double>, i8) nounwind readnone
100
101
102 define i32 @test_x86_sse2_comieq_sd(<2 x double> %a0, <2 x double> %a1) {
103 ; CHECK-LABEL: test_x86_sse2_comieq_sd:
104 ; CHECK:       ## BB#0:
105 ; CHECK-NEXT:    vcomisd %xmm1, %xmm0
106 ; CHECK-NEXT:    sete %al
107 ; CHECK-NEXT:    movzbl %al, %eax
108 ; CHECK-NEXT:    retl
109   %res = call i32 @llvm.x86.sse2.comieq.sd(<2 x double> %a0, <2 x double> %a1) ; <i32> [#uses=1]
110   ret i32 %res
111 }
112 declare i32 @llvm.x86.sse2.comieq.sd(<2 x double>, <2 x double>) nounwind readnone
113
114
115 define i32 @test_x86_sse2_comige_sd(<2 x double> %a0, <2 x double> %a1) {
116 ; CHECK-LABEL: test_x86_sse2_comige_sd:
117 ; CHECK:       ## BB#0:
118 ; CHECK-NEXT:    vcomisd %xmm1, %xmm0
119 ; CHECK-NEXT:    setae %al
120 ; CHECK-NEXT:    movzbl %al, %eax
121 ; CHECK-NEXT:    retl
122   %res = call i32 @llvm.x86.sse2.comige.sd(<2 x double> %a0, <2 x double> %a1) ; <i32> [#uses=1]
123   ret i32 %res
124 }
125 declare i32 @llvm.x86.sse2.comige.sd(<2 x double>, <2 x double>) nounwind readnone
126
127
128 define i32 @test_x86_sse2_comigt_sd(<2 x double> %a0, <2 x double> %a1) {
129 ; CHECK-LABEL: test_x86_sse2_comigt_sd:
130 ; CHECK:       ## BB#0:
131 ; CHECK-NEXT:    vcomisd %xmm1, %xmm0
132 ; CHECK-NEXT:    seta %al
133 ; CHECK-NEXT:    movzbl %al, %eax
134 ; CHECK-NEXT:    retl
135   %res = call i32 @llvm.x86.sse2.comigt.sd(<2 x double> %a0, <2 x double> %a1) ; <i32> [#uses=1]
136   ret i32 %res
137 }
138 declare i32 @llvm.x86.sse2.comigt.sd(<2 x double>, <2 x double>) nounwind readnone
139
140
141 define i32 @test_x86_sse2_comile_sd(<2 x double> %a0, <2 x double> %a1) {
142 ; CHECK-LABEL: test_x86_sse2_comile_sd:
143 ; CHECK:       ## BB#0:
144 ; CHECK-NEXT:    vcomisd %xmm1, %xmm0
145 ; CHECK-NEXT:    setbe %al
146 ; CHECK-NEXT:    movzbl %al, %eax
147 ; CHECK-NEXT:    retl
148   %res = call i32 @llvm.x86.sse2.comile.sd(<2 x double> %a0, <2 x double> %a1) ; <i32> [#uses=1]
149   ret i32 %res
150 }
151 declare i32 @llvm.x86.sse2.comile.sd(<2 x double>, <2 x double>) nounwind readnone
152
153
154 define i32 @test_x86_sse2_comilt_sd(<2 x double> %a0, <2 x double> %a1) {
155 ; CHECK-LABEL: test_x86_sse2_comilt_sd:
156 ; CHECK:       ## BB#0:
157 ; CHECK-NEXT:    vcomisd %xmm1, %xmm0
158 ; CHECK-NEXT:    sbbl %eax, %eax
159 ; CHECK-NEXT:    andl $1, %eax
160 ; CHECK-NEXT:    retl
161   %res = call i32 @llvm.x86.sse2.comilt.sd(<2 x double> %a0, <2 x double> %a1) ; <i32> [#uses=1]
162   ret i32 %res
163 }
164 declare i32 @llvm.x86.sse2.comilt.sd(<2 x double>, <2 x double>) nounwind readnone
165
166
167 define i32 @test_x86_sse2_comineq_sd(<2 x double> %a0, <2 x double> %a1) {
168 ; CHECK-LABEL: test_x86_sse2_comineq_sd:
169 ; CHECK:       ## BB#0:
170 ; CHECK-NEXT:    vcomisd %xmm1, %xmm0
171 ; CHECK-NEXT:    setne %al
172 ; CHECK-NEXT:    movzbl %al, %eax
173 ; CHECK-NEXT:    retl
174   %res = call i32 @llvm.x86.sse2.comineq.sd(<2 x double> %a0, <2 x double> %a1) ; <i32> [#uses=1]
175   ret i32 %res
176 }
177 declare i32 @llvm.x86.sse2.comineq.sd(<2 x double>, <2 x double>) nounwind readnone
178
179
180 define <2 x double> @test_x86_sse2_cvtdq2pd(<4 x i32> %a0) {
181 ; CHECK-LABEL: test_x86_sse2_cvtdq2pd:
182 ; CHECK:       ## BB#0:
183 ; CHECK-NEXT:    vcvtdq2pd %xmm0, %xmm0
184 ; CHECK-NEXT:    retl
185   %res = call <2 x double> @llvm.x86.sse2.cvtdq2pd(<4 x i32> %a0) ; <<2 x double>> [#uses=1]
186   ret <2 x double> %res
187 }
188 declare <2 x double> @llvm.x86.sse2.cvtdq2pd(<4 x i32>) nounwind readnone
189
190
191 define <4 x float> @test_x86_sse2_cvtdq2ps(<4 x i32> %a0) {
192 ; CHECK-LABEL: test_x86_sse2_cvtdq2ps:
193 ; CHECK:       ## BB#0:
194 ; CHECK-NEXT:    vcvtdq2ps %xmm0, %xmm0
195 ; CHECK-NEXT:    retl
196   %res = call <4 x float> @llvm.x86.sse2.cvtdq2ps(<4 x i32> %a0) ; <<4 x float>> [#uses=1]
197   ret <4 x float> %res
198 }
199 declare <4 x float> @llvm.x86.sse2.cvtdq2ps(<4 x i32>) nounwind readnone
200
201
202 define <4 x i32> @test_x86_sse2_cvtpd2dq(<2 x double> %a0) {
203 ; CHECK-LABEL: test_x86_sse2_cvtpd2dq:
204 ; CHECK:       ## BB#0:
205 ; CHECK-NEXT:    vcvtpd2dq %xmm0, %xmm0
206 ; CHECK-NEXT:    retl
207   %res = call <4 x i32> @llvm.x86.sse2.cvtpd2dq(<2 x double> %a0) ; <<4 x i32>> [#uses=1]
208   ret <4 x i32> %res
209 }
210 declare <4 x i32> @llvm.x86.sse2.cvtpd2dq(<2 x double>) nounwind readnone
211
212
213 define <4 x float> @test_x86_sse2_cvtpd2ps(<2 x double> %a0) {
214 ; CHECK-LABEL: test_x86_sse2_cvtpd2ps:
215 ; CHECK:       ## BB#0:
216 ; CHECK-NEXT:    vcvtpd2ps %xmm0, %xmm0
217 ; CHECK-NEXT:    retl
218   %res = call <4 x float> @llvm.x86.sse2.cvtpd2ps(<2 x double> %a0) ; <<4 x float>> [#uses=1]
219   ret <4 x float> %res
220 }
221 declare <4 x float> @llvm.x86.sse2.cvtpd2ps(<2 x double>) nounwind readnone
222
223
224 define <4 x i32> @test_x86_sse2_cvtps2dq(<4 x float> %a0) {
225 ; CHECK-LABEL: test_x86_sse2_cvtps2dq:
226 ; CHECK:       ## BB#0:
227 ; CHECK-NEXT:    vcvtps2dq %xmm0, %xmm0
228 ; CHECK-NEXT:    retl
229   %res = call <4 x i32> @llvm.x86.sse2.cvtps2dq(<4 x float> %a0) ; <<4 x i32>> [#uses=1]
230   ret <4 x i32> %res
231 }
232 declare <4 x i32> @llvm.x86.sse2.cvtps2dq(<4 x float>) nounwind readnone
233
234
235 define <2 x double> @test_x86_sse2_cvtps2pd(<4 x float> %a0) {
236 ; CHECK-LABEL: test_x86_sse2_cvtps2pd:
237 ; CHECK:       ## BB#0:
238 ; CHECK-NEXT:    vcvtps2pd %xmm0, %xmm0
239 ; CHECK-NEXT:    retl
240   %res = call <2 x double> @llvm.x86.sse2.cvtps2pd(<4 x float> %a0) ; <<2 x double>> [#uses=1]
241   ret <2 x double> %res
242 }
243 declare <2 x double> @llvm.x86.sse2.cvtps2pd(<4 x float>) nounwind readnone
244
245
246 define i32 @test_x86_sse2_cvtsd2si(<2 x double> %a0) {
247 ; CHECK-LABEL: test_x86_sse2_cvtsd2si:
248 ; CHECK:       ## BB#0:
249 ; CHECK-NEXT:    vcvtsd2si %xmm0, %eax
250 ; CHECK-NEXT:    retl
251   %res = call i32 @llvm.x86.sse2.cvtsd2si(<2 x double> %a0) ; <i32> [#uses=1]
252   ret i32 %res
253 }
254 declare i32 @llvm.x86.sse2.cvtsd2si(<2 x double>) nounwind readnone
255
256
257 define <4 x float> @test_x86_sse2_cvtsd2ss(<4 x float> %a0, <2 x double> %a1) {
258 ; CHECK-LABEL: test_x86_sse2_cvtsd2ss:
259 ; CHECK:       ## BB#0:
260 ; CHECK-NEXT:    vcvtsd2ss %xmm1, %xmm0, %xmm0
261 ; CHECK-NEXT:    retl
262   %res = call <4 x float> @llvm.x86.sse2.cvtsd2ss(<4 x float> %a0, <2 x double> %a1) ; <<4 x float>> [#uses=1]
263   ret <4 x float> %res
264 }
265 declare <4 x float> @llvm.x86.sse2.cvtsd2ss(<4 x float>, <2 x double>) nounwind readnone
266
267
268 define <2 x double> @test_x86_sse2_cvtsi2sd(<2 x double> %a0) {
269 ; CHECK-LABEL: test_x86_sse2_cvtsi2sd:
270 ; CHECK:       ## BB#0:
271 ; CHECK-NEXT:    movl $7, %eax
272 ; CHECK-NEXT:    vcvtsi2sdl %eax, %xmm0, %xmm0
273 ; CHECK-NEXT:    retl
274   %res = call <2 x double> @llvm.x86.sse2.cvtsi2sd(<2 x double> %a0, i32 7) ; <<2 x double>> [#uses=1]
275   ret <2 x double> %res
276 }
277 declare <2 x double> @llvm.x86.sse2.cvtsi2sd(<2 x double>, i32) nounwind readnone
278
279
280 define <2 x double> @test_x86_sse2_cvtss2sd(<2 x double> %a0, <4 x float> %a1) {
281 ; CHECK-LABEL: test_x86_sse2_cvtss2sd:
282 ; CHECK:       ## BB#0:
283 ; CHECK-NEXT:    vcvtss2sd %xmm1, %xmm0, %xmm0
284 ; CHECK-NEXT:    retl
285   %res = call <2 x double> @llvm.x86.sse2.cvtss2sd(<2 x double> %a0, <4 x float> %a1) ; <<2 x double>> [#uses=1]
286   ret <2 x double> %res
287 }
288 declare <2 x double> @llvm.x86.sse2.cvtss2sd(<2 x double>, <4 x float>) nounwind readnone
289
290
291 define <4 x i32> @test_x86_sse2_cvttpd2dq(<2 x double> %a0) {
292 ; CHECK-LABEL: test_x86_sse2_cvttpd2dq:
293 ; CHECK:       ## BB#0:
294 ; CHECK-NEXT:    vcvttpd2dq %xmm0, %xmm0
295 ; CHECK-NEXT:    retl
296   %res = call <4 x i32> @llvm.x86.sse2.cvttpd2dq(<2 x double> %a0) ; <<4 x i32>> [#uses=1]
297   ret <4 x i32> %res
298 }
299 declare <4 x i32> @llvm.x86.sse2.cvttpd2dq(<2 x double>) nounwind readnone
300
301
302 define <4 x i32> @test_x86_sse2_cvttps2dq(<4 x float> %a0) {
303 ; CHECK-LABEL: test_x86_sse2_cvttps2dq:
304 ; CHECK:       ## BB#0:
305 ; CHECK-NEXT:    vcvttps2dq %xmm0, %xmm0
306 ; CHECK-NEXT:    retl
307   %res = call <4 x i32> @llvm.x86.sse2.cvttps2dq(<4 x float> %a0) ; <<4 x i32>> [#uses=1]
308   ret <4 x i32> %res
309 }
310 declare <4 x i32> @llvm.x86.sse2.cvttps2dq(<4 x float>) nounwind readnone
311
312
313 define i32 @test_x86_sse2_cvttsd2si(<2 x double> %a0) {
314 ; CHECK-LABEL: test_x86_sse2_cvttsd2si:
315 ; CHECK:       ## BB#0:
316 ; CHECK-NEXT:    vcvttsd2si %xmm0, %eax
317 ; CHECK-NEXT:    retl
318   %res = call i32 @llvm.x86.sse2.cvttsd2si(<2 x double> %a0) ; <i32> [#uses=1]
319   ret i32 %res
320 }
321 declare i32 @llvm.x86.sse2.cvttsd2si(<2 x double>) nounwind readnone
322
323
324 define <2 x double> @test_x86_sse2_div_sd(<2 x double> %a0, <2 x double> %a1) {
325 ; CHECK-LABEL: test_x86_sse2_div_sd:
326 ; CHECK:       ## BB#0:
327 ; CHECK-NEXT:    vdivsd %xmm1, %xmm0, %xmm0
328 ; CHECK-NEXT:    retl
329   %res = call <2 x double> @llvm.x86.sse2.div.sd(<2 x double> %a0, <2 x double> %a1) ; <<2 x double>> [#uses=1]
330   ret <2 x double> %res
331 }
332 declare <2 x double> @llvm.x86.sse2.div.sd(<2 x double>, <2 x double>) nounwind readnone
333
334
335
336 define <2 x double> @test_x86_sse2_max_pd(<2 x double> %a0, <2 x double> %a1) {
337 ; CHECK-LABEL: test_x86_sse2_max_pd:
338 ; CHECK:       ## BB#0:
339 ; CHECK-NEXT:    vmaxpd %xmm1, %xmm0, %xmm0
340 ; CHECK-NEXT:    retl
341   %res = call <2 x double> @llvm.x86.sse2.max.pd(<2 x double> %a0, <2 x double> %a1) ; <<2 x double>> [#uses=1]
342   ret <2 x double> %res
343 }
344 declare <2 x double> @llvm.x86.sse2.max.pd(<2 x double>, <2 x double>) nounwind readnone
345
346
347 define <2 x double> @test_x86_sse2_max_sd(<2 x double> %a0, <2 x double> %a1) {
348 ; CHECK-LABEL: test_x86_sse2_max_sd:
349 ; CHECK:       ## BB#0:
350 ; CHECK-NEXT:    vmaxsd %xmm1, %xmm0, %xmm0
351 ; CHECK-NEXT:    retl
352   %res = call <2 x double> @llvm.x86.sse2.max.sd(<2 x double> %a0, <2 x double> %a1) ; <<2 x double>> [#uses=1]
353   ret <2 x double> %res
354 }
355 declare <2 x double> @llvm.x86.sse2.max.sd(<2 x double>, <2 x double>) nounwind readnone
356
357
358 define <2 x double> @test_x86_sse2_min_pd(<2 x double> %a0, <2 x double> %a1) {
359 ; CHECK-LABEL: test_x86_sse2_min_pd:
360 ; CHECK:       ## BB#0:
361 ; CHECK-NEXT:    vminpd %xmm1, %xmm0, %xmm0
362 ; CHECK-NEXT:    retl
363   %res = call <2 x double> @llvm.x86.sse2.min.pd(<2 x double> %a0, <2 x double> %a1) ; <<2 x double>> [#uses=1]
364   ret <2 x double> %res
365 }
366 declare <2 x double> @llvm.x86.sse2.min.pd(<2 x double>, <2 x double>) nounwind readnone
367
368
369 define <2 x double> @test_x86_sse2_min_sd(<2 x double> %a0, <2 x double> %a1) {
370 ; CHECK-LABEL: test_x86_sse2_min_sd:
371 ; CHECK:       ## BB#0:
372 ; CHECK-NEXT:    vminsd %xmm1, %xmm0, %xmm0
373 ; CHECK-NEXT:    retl
374   %res = call <2 x double> @llvm.x86.sse2.min.sd(<2 x double> %a0, <2 x double> %a1) ; <<2 x double>> [#uses=1]
375   ret <2 x double> %res
376 }
377 declare <2 x double> @llvm.x86.sse2.min.sd(<2 x double>, <2 x double>) nounwind readnone
378
379
380 define i32 @test_x86_sse2_movmsk_pd(<2 x double> %a0) {
381 ; CHECK-LABEL: test_x86_sse2_movmsk_pd:
382 ; CHECK:       ## BB#0:
383 ; CHECK-NEXT:    vmovmskpd %xmm0, %eax
384 ; CHECK-NEXT:    retl
385   %res = call i32 @llvm.x86.sse2.movmsk.pd(<2 x double> %a0) ; <i32> [#uses=1]
386   ret i32 %res
387 }
388 declare i32 @llvm.x86.sse2.movmsk.pd(<2 x double>) nounwind readnone
389
390
391
392
393 define <2 x double> @test_x86_sse2_mul_sd(<2 x double> %a0, <2 x double> %a1) {
394 ; CHECK-LABEL: test_x86_sse2_mul_sd:
395 ; CHECK:       ## BB#0:
396 ; CHECK-NEXT:    vmulsd %xmm1, %xmm0, %xmm0
397 ; CHECK-NEXT:    retl
398   %res = call <2 x double> @llvm.x86.sse2.mul.sd(<2 x double> %a0, <2 x double> %a1) ; <<2 x double>> [#uses=1]
399   ret <2 x double> %res
400 }
401 declare <2 x double> @llvm.x86.sse2.mul.sd(<2 x double>, <2 x double>) nounwind readnone
402
403
404 define <8 x i16> @test_x86_sse2_packssdw_128(<4 x i32> %a0, <4 x i32> %a1) {
405 ; CHECK-LABEL: test_x86_sse2_packssdw_128:
406 ; CHECK:       ## BB#0:
407 ; CHECK-NEXT:    vpackssdw %xmm1, %xmm0, %xmm0
408 ; CHECK-NEXT:    retl
409   %res = call <8 x i16> @llvm.x86.sse2.packssdw.128(<4 x i32> %a0, <4 x i32> %a1) ; <<8 x i16>> [#uses=1]
410   ret <8 x i16> %res
411 }
412 declare <8 x i16> @llvm.x86.sse2.packssdw.128(<4 x i32>, <4 x i32>) nounwind readnone
413
414
415 define <16 x i8> @test_x86_sse2_packsswb_128(<8 x i16> %a0, <8 x i16> %a1) {
416 ; CHECK-LABEL: test_x86_sse2_packsswb_128:
417 ; CHECK:       ## BB#0:
418 ; CHECK-NEXT:    vpacksswb %xmm1, %xmm0, %xmm0
419 ; CHECK-NEXT:    retl
420   %res = call <16 x i8> @llvm.x86.sse2.packsswb.128(<8 x i16> %a0, <8 x i16> %a1) ; <<16 x i8>> [#uses=1]
421   ret <16 x i8> %res
422 }
423 declare <16 x i8> @llvm.x86.sse2.packsswb.128(<8 x i16>, <8 x i16>) nounwind readnone
424
425
426 define <16 x i8> @test_x86_sse2_packuswb_128(<8 x i16> %a0, <8 x i16> %a1) {
427 ; CHECK-LABEL: test_x86_sse2_packuswb_128:
428 ; CHECK:       ## BB#0:
429 ; CHECK-NEXT:    vpackuswb %xmm1, %xmm0, %xmm0
430 ; CHECK-NEXT:    retl
431   %res = call <16 x i8> @llvm.x86.sse2.packuswb.128(<8 x i16> %a0, <8 x i16> %a1) ; <<16 x i8>> [#uses=1]
432   ret <16 x i8> %res
433 }
434 declare <16 x i8> @llvm.x86.sse2.packuswb.128(<8 x i16>, <8 x i16>) nounwind readnone
435
436
437 define <16 x i8> @test_x86_sse2_padds_b(<16 x i8> %a0, <16 x i8> %a1) {
438 ; CHECK-LABEL: test_x86_sse2_padds_b:
439 ; CHECK:       ## BB#0:
440 ; CHECK-NEXT:    vpaddsb %xmm1, %xmm0, %xmm0
441 ; CHECK-NEXT:    retl
442   %res = call <16 x i8> @llvm.x86.sse2.padds.b(<16 x i8> %a0, <16 x i8> %a1) ; <<16 x i8>> [#uses=1]
443   ret <16 x i8> %res
444 }
445 declare <16 x i8> @llvm.x86.sse2.padds.b(<16 x i8>, <16 x i8>) nounwind readnone
446
447
448 define <8 x i16> @test_x86_sse2_padds_w(<8 x i16> %a0, <8 x i16> %a1) {
449 ; CHECK-LABEL: test_x86_sse2_padds_w:
450 ; CHECK:       ## BB#0:
451 ; CHECK-NEXT:    vpaddsw %xmm1, %xmm0, %xmm0
452 ; CHECK-NEXT:    retl
453   %res = call <8 x i16> @llvm.x86.sse2.padds.w(<8 x i16> %a0, <8 x i16> %a1) ; <<8 x i16>> [#uses=1]
454   ret <8 x i16> %res
455 }
456 declare <8 x i16> @llvm.x86.sse2.padds.w(<8 x i16>, <8 x i16>) nounwind readnone
457
458
459 define <16 x i8> @test_x86_sse2_paddus_b(<16 x i8> %a0, <16 x i8> %a1) {
460 ; CHECK-LABEL: test_x86_sse2_paddus_b:
461 ; CHECK:       ## BB#0:
462 ; CHECK-NEXT:    vpaddusb %xmm1, %xmm0, %xmm0
463 ; CHECK-NEXT:    retl
464   %res = call <16 x i8> @llvm.x86.sse2.paddus.b(<16 x i8> %a0, <16 x i8> %a1) ; <<16 x i8>> [#uses=1]
465   ret <16 x i8> %res
466 }
467 declare <16 x i8> @llvm.x86.sse2.paddus.b(<16 x i8>, <16 x i8>) nounwind readnone
468
469
470 define <8 x i16> @test_x86_sse2_paddus_w(<8 x i16> %a0, <8 x i16> %a1) {
471 ; CHECK-LABEL: test_x86_sse2_paddus_w:
472 ; CHECK:       ## BB#0:
473 ; CHECK-NEXT:    vpaddusw %xmm1, %xmm0, %xmm0
474 ; CHECK-NEXT:    retl
475   %res = call <8 x i16> @llvm.x86.sse2.paddus.w(<8 x i16> %a0, <8 x i16> %a1) ; <<8 x i16>> [#uses=1]
476   ret <8 x i16> %res
477 }
478 declare <8 x i16> @llvm.x86.sse2.paddus.w(<8 x i16>, <8 x i16>) nounwind readnone
479
480
481 define <16 x i8> @test_x86_sse2_pavg_b(<16 x i8> %a0, <16 x i8> %a1) {
482 ; CHECK-LABEL: test_x86_sse2_pavg_b:
483 ; CHECK:       ## BB#0:
484 ; CHECK-NEXT:    vpavgb %xmm1, %xmm0, %xmm0
485 ; CHECK-NEXT:    retl
486   %res = call <16 x i8> @llvm.x86.sse2.pavg.b(<16 x i8> %a0, <16 x i8> %a1) ; <<16 x i8>> [#uses=1]
487   ret <16 x i8> %res
488 }
489 declare <16 x i8> @llvm.x86.sse2.pavg.b(<16 x i8>, <16 x i8>) nounwind readnone
490
491
492 define <8 x i16> @test_x86_sse2_pavg_w(<8 x i16> %a0, <8 x i16> %a1) {
493 ; CHECK-LABEL: test_x86_sse2_pavg_w:
494 ; CHECK:       ## BB#0:
495 ; CHECK-NEXT:    vpavgw %xmm1, %xmm0, %xmm0
496 ; CHECK-NEXT:    retl
497   %res = call <8 x i16> @llvm.x86.sse2.pavg.w(<8 x i16> %a0, <8 x i16> %a1) ; <<8 x i16>> [#uses=1]
498   ret <8 x i16> %res
499 }
500 declare <8 x i16> @llvm.x86.sse2.pavg.w(<8 x i16>, <8 x i16>) nounwind readnone
501
502
503 define <4 x i32> @test_x86_sse2_pmadd_wd(<8 x i16> %a0, <8 x i16> %a1) {
504 ; CHECK-LABEL: test_x86_sse2_pmadd_wd:
505 ; CHECK:       ## BB#0:
506 ; CHECK-NEXT:    vpmaddwd %xmm1, %xmm0, %xmm0
507 ; CHECK-NEXT:    retl
508   %res = call <4 x i32> @llvm.x86.sse2.pmadd.wd(<8 x i16> %a0, <8 x i16> %a1) ; <<4 x i32>> [#uses=1]
509   ret <4 x i32> %res
510 }
511 declare <4 x i32> @llvm.x86.sse2.pmadd.wd(<8 x i16>, <8 x i16>) nounwind readnone
512
513
514 define <8 x i16> @test_x86_sse2_pmaxs_w(<8 x i16> %a0, <8 x i16> %a1) {
515 ; CHECK-LABEL: test_x86_sse2_pmaxs_w:
516 ; CHECK:       ## BB#0:
517 ; CHECK-NEXT:    vpmaxsw %xmm1, %xmm0, %xmm0
518 ; CHECK-NEXT:    retl
519   %res = call <8 x i16> @llvm.x86.sse2.pmaxs.w(<8 x i16> %a0, <8 x i16> %a1) ; <<8 x i16>> [#uses=1]
520   ret <8 x i16> %res
521 }
522 declare <8 x i16> @llvm.x86.sse2.pmaxs.w(<8 x i16>, <8 x i16>) nounwind readnone
523
524
525 define <16 x i8> @test_x86_sse2_pmaxu_b(<16 x i8> %a0, <16 x i8> %a1) {
526 ; CHECK-LABEL: test_x86_sse2_pmaxu_b:
527 ; CHECK:       ## BB#0:
528 ; CHECK-NEXT:    vpmaxub %xmm1, %xmm0, %xmm0
529 ; CHECK-NEXT:    retl
530   %res = call <16 x i8> @llvm.x86.sse2.pmaxu.b(<16 x i8> %a0, <16 x i8> %a1) ; <<16 x i8>> [#uses=1]
531   ret <16 x i8> %res
532 }
533 declare <16 x i8> @llvm.x86.sse2.pmaxu.b(<16 x i8>, <16 x i8>) nounwind readnone
534
535
536 define <8 x i16> @test_x86_sse2_pmins_w(<8 x i16> %a0, <8 x i16> %a1) {
537 ; CHECK-LABEL: test_x86_sse2_pmins_w:
538 ; CHECK:       ## BB#0:
539 ; CHECK-NEXT:    vpminsw %xmm1, %xmm0, %xmm0
540 ; CHECK-NEXT:    retl
541   %res = call <8 x i16> @llvm.x86.sse2.pmins.w(<8 x i16> %a0, <8 x i16> %a1) ; <<8 x i16>> [#uses=1]
542   ret <8 x i16> %res
543 }
544 declare <8 x i16> @llvm.x86.sse2.pmins.w(<8 x i16>, <8 x i16>) nounwind readnone
545
546
547 define <16 x i8> @test_x86_sse2_pminu_b(<16 x i8> %a0, <16 x i8> %a1) {
548 ; CHECK-LABEL: test_x86_sse2_pminu_b:
549 ; CHECK:       ## BB#0:
550 ; CHECK-NEXT:    vpminub %xmm1, %xmm0, %xmm0
551 ; CHECK-NEXT:    retl
552   %res = call <16 x i8> @llvm.x86.sse2.pminu.b(<16 x i8> %a0, <16 x i8> %a1) ; <<16 x i8>> [#uses=1]
553   ret <16 x i8> %res
554 }
555 declare <16 x i8> @llvm.x86.sse2.pminu.b(<16 x i8>, <16 x i8>) nounwind readnone
556
557
558 define i32 @test_x86_sse2_pmovmskb_128(<16 x i8> %a0) {
559 ; CHECK-LABEL: test_x86_sse2_pmovmskb_128:
560 ; CHECK:       ## BB#0:
561 ; CHECK-NEXT:    vpmovmskb %xmm0, %eax
562 ; CHECK-NEXT:    retl
563   %res = call i32 @llvm.x86.sse2.pmovmskb.128(<16 x i8> %a0) ; <i32> [#uses=1]
564   ret i32 %res
565 }
566 declare i32 @llvm.x86.sse2.pmovmskb.128(<16 x i8>) nounwind readnone
567
568
569 define <8 x i16> @test_x86_sse2_pmulh_w(<8 x i16> %a0, <8 x i16> %a1) {
570 ; CHECK-LABEL: test_x86_sse2_pmulh_w:
571 ; CHECK:       ## BB#0:
572 ; CHECK-NEXT:    vpmulhw %xmm1, %xmm0, %xmm0
573 ; CHECK-NEXT:    retl
574   %res = call <8 x i16> @llvm.x86.sse2.pmulh.w(<8 x i16> %a0, <8 x i16> %a1) ; <<8 x i16>> [#uses=1]
575   ret <8 x i16> %res
576 }
577 declare <8 x i16> @llvm.x86.sse2.pmulh.w(<8 x i16>, <8 x i16>) nounwind readnone
578
579
580 define <8 x i16> @test_x86_sse2_pmulhu_w(<8 x i16> %a0, <8 x i16> %a1) {
581 ; CHECK-LABEL: test_x86_sse2_pmulhu_w:
582 ; CHECK:       ## BB#0:
583 ; CHECK-NEXT:    vpmulhuw %xmm1, %xmm0, %xmm0
584 ; CHECK-NEXT:    retl
585   %res = call <8 x i16> @llvm.x86.sse2.pmulhu.w(<8 x i16> %a0, <8 x i16> %a1) ; <<8 x i16>> [#uses=1]
586   ret <8 x i16> %res
587 }
588 declare <8 x i16> @llvm.x86.sse2.pmulhu.w(<8 x i16>, <8 x i16>) nounwind readnone
589
590
591 define <2 x i64> @test_x86_sse2_pmulu_dq(<4 x i32> %a0, <4 x i32> %a1) {
592 ; CHECK-LABEL: test_x86_sse2_pmulu_dq:
593 ; CHECK:       ## BB#0:
594 ; CHECK-NEXT:    vpmuludq %xmm1, %xmm0, %xmm0
595 ; CHECK-NEXT:    retl
596   %res = call <2 x i64> @llvm.x86.sse2.pmulu.dq(<4 x i32> %a0, <4 x i32> %a1) ; <<2 x i64>> [#uses=1]
597   ret <2 x i64> %res
598 }
599 declare <2 x i64> @llvm.x86.sse2.pmulu.dq(<4 x i32>, <4 x i32>) nounwind readnone
600
601
602 define <2 x i64> @test_x86_sse2_psad_bw(<16 x i8> %a0, <16 x i8> %a1) {
603 ; CHECK-LABEL: test_x86_sse2_psad_bw:
604 ; CHECK:       ## BB#0:
605 ; CHECK-NEXT:    vpsadbw %xmm1, %xmm0, %xmm0
606 ; CHECK-NEXT:    retl
607   %res = call <2 x i64> @llvm.x86.sse2.psad.bw(<16 x i8> %a0, <16 x i8> %a1) ; <<2 x i64>> [#uses=1]
608   ret <2 x i64> %res
609 }
610 declare <2 x i64> @llvm.x86.sse2.psad.bw(<16 x i8>, <16 x i8>) nounwind readnone
611
612
613 define <4 x i32> @test_x86_sse2_psll_d(<4 x i32> %a0, <4 x i32> %a1) {
614 ; CHECK-LABEL: test_x86_sse2_psll_d:
615 ; CHECK:       ## BB#0:
616 ; CHECK-NEXT:    vpslld %xmm1, %xmm0, %xmm0
617 ; CHECK-NEXT:    retl
618   %res = call <4 x i32> @llvm.x86.sse2.psll.d(<4 x i32> %a0, <4 x i32> %a1) ; <<4 x i32>> [#uses=1]
619   ret <4 x i32> %res
620 }
621 declare <4 x i32> @llvm.x86.sse2.psll.d(<4 x i32>, <4 x i32>) nounwind readnone
622
623
624 define <2 x i64> @test_x86_sse2_psll_q(<2 x i64> %a0, <2 x i64> %a1) {
625 ; CHECK-LABEL: test_x86_sse2_psll_q:
626 ; CHECK:       ## BB#0:
627 ; CHECK-NEXT:    vpsllq %xmm1, %xmm0, %xmm0
628 ; CHECK-NEXT:    retl
629   %res = call <2 x i64> @llvm.x86.sse2.psll.q(<2 x i64> %a0, <2 x i64> %a1) ; <<2 x i64>> [#uses=1]
630   ret <2 x i64> %res
631 }
632 declare <2 x i64> @llvm.x86.sse2.psll.q(<2 x i64>, <2 x i64>) nounwind readnone
633
634
635 define <8 x i16> @test_x86_sse2_psll_w(<8 x i16> %a0, <8 x i16> %a1) {
636 ; CHECK-LABEL: test_x86_sse2_psll_w:
637 ; CHECK:       ## BB#0:
638 ; CHECK-NEXT:    vpsllw %xmm1, %xmm0, %xmm0
639 ; CHECK-NEXT:    retl
640   %res = call <8 x i16> @llvm.x86.sse2.psll.w(<8 x i16> %a0, <8 x i16> %a1) ; <<8 x i16>> [#uses=1]
641   ret <8 x i16> %res
642 }
643 declare <8 x i16> @llvm.x86.sse2.psll.w(<8 x i16>, <8 x i16>) nounwind readnone
644
645
646 define <4 x i32> @test_x86_sse2_pslli_d(<4 x i32> %a0) {
647 ; CHECK-LABEL: test_x86_sse2_pslli_d:
648 ; CHECK:       ## BB#0:
649 ; CHECK-NEXT:    vpslld $7, %xmm0, %xmm0
650 ; CHECK-NEXT:    retl
651   %res = call <4 x i32> @llvm.x86.sse2.pslli.d(<4 x i32> %a0, i32 7) ; <<4 x i32>> [#uses=1]
652   ret <4 x i32> %res
653 }
654 declare <4 x i32> @llvm.x86.sse2.pslli.d(<4 x i32>, i32) nounwind readnone
655
656
657 define <2 x i64> @test_x86_sse2_pslli_q(<2 x i64> %a0) {
658 ; CHECK-LABEL: test_x86_sse2_pslli_q:
659 ; CHECK:       ## BB#0:
660 ; CHECK-NEXT:    vpsllq $7, %xmm0, %xmm0
661 ; CHECK-NEXT:    retl
662   %res = call <2 x i64> @llvm.x86.sse2.pslli.q(<2 x i64> %a0, i32 7) ; <<2 x i64>> [#uses=1]
663   ret <2 x i64> %res
664 }
665 declare <2 x i64> @llvm.x86.sse2.pslli.q(<2 x i64>, i32) nounwind readnone
666
667
668 define <8 x i16> @test_x86_sse2_pslli_w(<8 x i16> %a0) {
669 ; CHECK-LABEL: test_x86_sse2_pslli_w:
670 ; CHECK:       ## BB#0:
671 ; CHECK-NEXT:    vpsllw $7, %xmm0, %xmm0
672 ; CHECK-NEXT:    retl
673   %res = call <8 x i16> @llvm.x86.sse2.pslli.w(<8 x i16> %a0, i32 7) ; <<8 x i16>> [#uses=1]
674   ret <8 x i16> %res
675 }
676 declare <8 x i16> @llvm.x86.sse2.pslli.w(<8 x i16>, i32) nounwind readnone
677
678
679 define <4 x i32> @test_x86_sse2_psra_d(<4 x i32> %a0, <4 x i32> %a1) {
680 ; CHECK-LABEL: test_x86_sse2_psra_d:
681 ; CHECK:       ## BB#0:
682 ; CHECK-NEXT:    vpsrad %xmm1, %xmm0, %xmm0
683 ; CHECK-NEXT:    retl
684   %res = call <4 x i32> @llvm.x86.sse2.psra.d(<4 x i32> %a0, <4 x i32> %a1) ; <<4 x i32>> [#uses=1]
685   ret <4 x i32> %res
686 }
687 declare <4 x i32> @llvm.x86.sse2.psra.d(<4 x i32>, <4 x i32>) nounwind readnone
688
689
690 define <8 x i16> @test_x86_sse2_psra_w(<8 x i16> %a0, <8 x i16> %a1) {
691 ; CHECK-LABEL: test_x86_sse2_psra_w:
692 ; CHECK:       ## BB#0:
693 ; CHECK-NEXT:    vpsraw %xmm1, %xmm0, %xmm0
694 ; CHECK-NEXT:    retl
695   %res = call <8 x i16> @llvm.x86.sse2.psra.w(<8 x i16> %a0, <8 x i16> %a1) ; <<8 x i16>> [#uses=1]
696   ret <8 x i16> %res
697 }
698 declare <8 x i16> @llvm.x86.sse2.psra.w(<8 x i16>, <8 x i16>) nounwind readnone
699
700
701 define <4 x i32> @test_x86_sse2_psrai_d(<4 x i32> %a0) {
702 ; CHECK-LABEL: test_x86_sse2_psrai_d:
703 ; CHECK:       ## BB#0:
704 ; CHECK-NEXT:    vpsrad $7, %xmm0, %xmm0
705 ; CHECK-NEXT:    retl
706   %res = call <4 x i32> @llvm.x86.sse2.psrai.d(<4 x i32> %a0, i32 7) ; <<4 x i32>> [#uses=1]
707   ret <4 x i32> %res
708 }
709 declare <4 x i32> @llvm.x86.sse2.psrai.d(<4 x i32>, i32) nounwind readnone
710
711
712 define <8 x i16> @test_x86_sse2_psrai_w(<8 x i16> %a0) {
713 ; CHECK-LABEL: test_x86_sse2_psrai_w:
714 ; CHECK:       ## BB#0:
715 ; CHECK-NEXT:    vpsraw $7, %xmm0, %xmm0
716 ; CHECK-NEXT:    retl
717   %res = call <8 x i16> @llvm.x86.sse2.psrai.w(<8 x i16> %a0, i32 7) ; <<8 x i16>> [#uses=1]
718   ret <8 x i16> %res
719 }
720 declare <8 x i16> @llvm.x86.sse2.psrai.w(<8 x i16>, i32) nounwind readnone
721
722
723 define <4 x i32> @test_x86_sse2_psrl_d(<4 x i32> %a0, <4 x i32> %a1) {
724 ; CHECK-LABEL: test_x86_sse2_psrl_d:
725 ; CHECK:       ## BB#0:
726 ; CHECK-NEXT:    vpsrld %xmm1, %xmm0, %xmm0
727 ; CHECK-NEXT:    retl
728   %res = call <4 x i32> @llvm.x86.sse2.psrl.d(<4 x i32> %a0, <4 x i32> %a1) ; <<4 x i32>> [#uses=1]
729   ret <4 x i32> %res
730 }
731 declare <4 x i32> @llvm.x86.sse2.psrl.d(<4 x i32>, <4 x i32>) nounwind readnone
732
733
734 define <2 x i64> @test_x86_sse2_psrl_q(<2 x i64> %a0, <2 x i64> %a1) {
735 ; CHECK-LABEL: test_x86_sse2_psrl_q:
736 ; CHECK:       ## BB#0:
737 ; CHECK-NEXT:    vpsrlq %xmm1, %xmm0, %xmm0
738 ; CHECK-NEXT:    retl
739   %res = call <2 x i64> @llvm.x86.sse2.psrl.q(<2 x i64> %a0, <2 x i64> %a1) ; <<2 x i64>> [#uses=1]
740   ret <2 x i64> %res
741 }
742 declare <2 x i64> @llvm.x86.sse2.psrl.q(<2 x i64>, <2 x i64>) nounwind readnone
743
744
745 define <8 x i16> @test_x86_sse2_psrl_w(<8 x i16> %a0, <8 x i16> %a1) {
746 ; CHECK-LABEL: test_x86_sse2_psrl_w:
747 ; CHECK:       ## BB#0:
748 ; CHECK-NEXT:    vpsrlw %xmm1, %xmm0, %xmm0
749 ; CHECK-NEXT:    retl
750   %res = call <8 x i16> @llvm.x86.sse2.psrl.w(<8 x i16> %a0, <8 x i16> %a1) ; <<8 x i16>> [#uses=1]
751   ret <8 x i16> %res
752 }
753 declare <8 x i16> @llvm.x86.sse2.psrl.w(<8 x i16>, <8 x i16>) nounwind readnone
754
755
756 define <4 x i32> @test_x86_sse2_psrli_d(<4 x i32> %a0) {
757 ; CHECK-LABEL: test_x86_sse2_psrli_d:
758 ; CHECK:       ## BB#0:
759 ; CHECK-NEXT:    vpsrld $7, %xmm0, %xmm0
760 ; CHECK-NEXT:    retl
761   %res = call <4 x i32> @llvm.x86.sse2.psrli.d(<4 x i32> %a0, i32 7) ; <<4 x i32>> [#uses=1]
762   ret <4 x i32> %res
763 }
764 declare <4 x i32> @llvm.x86.sse2.psrli.d(<4 x i32>, i32) nounwind readnone
765
766
767 define <2 x i64> @test_x86_sse2_psrli_q(<2 x i64> %a0) {
768 ; CHECK-LABEL: test_x86_sse2_psrli_q:
769 ; CHECK:       ## BB#0:
770 ; CHECK-NEXT:    vpsrlq $7, %xmm0, %xmm0
771 ; CHECK-NEXT:    retl
772   %res = call <2 x i64> @llvm.x86.sse2.psrli.q(<2 x i64> %a0, i32 7) ; <<2 x i64>> [#uses=1]
773   ret <2 x i64> %res
774 }
775 declare <2 x i64> @llvm.x86.sse2.psrli.q(<2 x i64>, i32) nounwind readnone
776
777
778 define <8 x i16> @test_x86_sse2_psrli_w(<8 x i16> %a0) {
779 ; CHECK-LABEL: test_x86_sse2_psrli_w:
780 ; CHECK:       ## BB#0:
781 ; CHECK-NEXT:    vpsrlw $7, %xmm0, %xmm0
782 ; CHECK-NEXT:    retl
783   %res = call <8 x i16> @llvm.x86.sse2.psrli.w(<8 x i16> %a0, i32 7) ; <<8 x i16>> [#uses=1]
784   ret <8 x i16> %res
785 }
786 declare <8 x i16> @llvm.x86.sse2.psrli.w(<8 x i16>, i32) nounwind readnone
787
788
789 define <16 x i8> @test_x86_sse2_psubs_b(<16 x i8> %a0, <16 x i8> %a1) {
790 ; CHECK-LABEL: test_x86_sse2_psubs_b:
791 ; CHECK:       ## BB#0:
792 ; CHECK-NEXT:    vpsubsb %xmm1, %xmm0, %xmm0
793 ; CHECK-NEXT:    retl
794   %res = call <16 x i8> @llvm.x86.sse2.psubs.b(<16 x i8> %a0, <16 x i8> %a1) ; <<16 x i8>> [#uses=1]
795   ret <16 x i8> %res
796 }
797 declare <16 x i8> @llvm.x86.sse2.psubs.b(<16 x i8>, <16 x i8>) nounwind readnone
798
799
800 define <8 x i16> @test_x86_sse2_psubs_w(<8 x i16> %a0, <8 x i16> %a1) {
801 ; CHECK-LABEL: test_x86_sse2_psubs_w:
802 ; CHECK:       ## BB#0:
803 ; CHECK-NEXT:    vpsubsw %xmm1, %xmm0, %xmm0
804 ; CHECK-NEXT:    retl
805   %res = call <8 x i16> @llvm.x86.sse2.psubs.w(<8 x i16> %a0, <8 x i16> %a1) ; <<8 x i16>> [#uses=1]
806   ret <8 x i16> %res
807 }
808 declare <8 x i16> @llvm.x86.sse2.psubs.w(<8 x i16>, <8 x i16>) nounwind readnone
809
810
811 define <16 x i8> @test_x86_sse2_psubus_b(<16 x i8> %a0, <16 x i8> %a1) {
812 ; CHECK-LABEL: test_x86_sse2_psubus_b:
813 ; CHECK:       ## BB#0:
814 ; CHECK-NEXT:    vpsubusb %xmm1, %xmm0, %xmm0
815 ; CHECK-NEXT:    retl
816   %res = call <16 x i8> @llvm.x86.sse2.psubus.b(<16 x i8> %a0, <16 x i8> %a1) ; <<16 x i8>> [#uses=1]
817   ret <16 x i8> %res
818 }
819 declare <16 x i8> @llvm.x86.sse2.psubus.b(<16 x i8>, <16 x i8>) nounwind readnone
820
821
822 define <8 x i16> @test_x86_sse2_psubus_w(<8 x i16> %a0, <8 x i16> %a1) {
823 ; CHECK-LABEL: test_x86_sse2_psubus_w:
824 ; CHECK:       ## BB#0:
825 ; CHECK-NEXT:    vpsubusw %xmm1, %xmm0, %xmm0
826 ; CHECK-NEXT:    retl
827   %res = call <8 x i16> @llvm.x86.sse2.psubus.w(<8 x i16> %a0, <8 x i16> %a1) ; <<8 x i16>> [#uses=1]
828   ret <8 x i16> %res
829 }
830 declare <8 x i16> @llvm.x86.sse2.psubus.w(<8 x i16>, <8 x i16>) nounwind readnone
831
832
833 define <2 x double> @test_x86_sse2_sqrt_pd(<2 x double> %a0) {
834 ; CHECK-LABEL: test_x86_sse2_sqrt_pd:
835 ; CHECK:       ## BB#0:
836 ; CHECK-NEXT:    vsqrtpd %xmm0, %xmm0
837 ; CHECK-NEXT:    retl
838   %res = call <2 x double> @llvm.x86.sse2.sqrt.pd(<2 x double> %a0) ; <<2 x double>> [#uses=1]
839   ret <2 x double> %res
840 }
841 declare <2 x double> @llvm.x86.sse2.sqrt.pd(<2 x double>) nounwind readnone
842
843
844 define <2 x double> @test_x86_sse2_sqrt_sd(<2 x double> %a0) {
845 ; CHECK-LABEL: test_x86_sse2_sqrt_sd:
846 ; CHECK:       ## BB#0:
847 ; CHECK-NEXT:    vsqrtsd %xmm0, %xmm0, %xmm0
848 ; CHECK-NEXT:    retl
849   %res = call <2 x double> @llvm.x86.sse2.sqrt.sd(<2 x double> %a0) ; <<2 x double>> [#uses=1]
850   ret <2 x double> %res
851 }
852 declare <2 x double> @llvm.x86.sse2.sqrt.sd(<2 x double>) nounwind readnone
853
854
855 define void @test_x86_sse2_storel_dq(i8* %a0, <4 x i32> %a1) {
856 ; CHECK-LABEL: test_x86_sse2_storel_dq:
857 ; CHECK:       ## BB#0:
858 ; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %eax
859 ; CHECK-NEXT:    vmovlps %xmm0, (%eax)
860 ; CHECK-NEXT:    retl
861   call void @llvm.x86.sse2.storel.dq(i8* %a0, <4 x i32> %a1)
862   ret void
863 }
864 declare void @llvm.x86.sse2.storel.dq(i8*, <4 x i32>) nounwind
865
866
867 define void @test_x86_sse2_storeu_dq(i8* %a0, <16 x i8> %a1) {
868   ; add operation forces the execution domain.
869 ; CHECK-LABEL: test_x86_sse2_storeu_dq:
870 ; CHECK:       ## BB#0:
871 ; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %eax
872 ; CHECK-NEXT:    vpaddb LCPI77_0, %xmm0, %xmm0
873 ; CHECK-NEXT:    vmovdqu %xmm0, (%eax)
874 ; CHECK-NEXT:    retl
875   %a2 = add <16 x i8> %a1, <i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1>
876   call void @llvm.x86.sse2.storeu.dq(i8* %a0, <16 x i8> %a2)
877   ret void
878 }
879 declare void @llvm.x86.sse2.storeu.dq(i8*, <16 x i8>) nounwind
880
881
882 define void @test_x86_sse2_storeu_pd(i8* %a0, <2 x double> %a1) {
883   ; fadd operation forces the execution domain.
884 ; CHECK-LABEL: test_x86_sse2_storeu_pd:
885 ; CHECK:       ## BB#0:
886 ; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %eax
887 ; CHECK-NEXT:    vmovsd {{.*#+}} xmm1 = mem[0],zero
888 ; CHECK-NEXT:    vpslldq {{.*#+}} xmm1 = zero,zero,zero,zero,zero,zero,zero,zero,xmm1[0,1,2,3,4,5,6,7]
889 ; CHECK-NEXT:    vaddpd %xmm1, %xmm0, %xmm0
890 ; CHECK-NEXT:    vmovupd %xmm0, (%eax)
891 ; CHECK-NEXT:    retl
892   %a2 = fadd <2 x double> %a1, <double 0x0, double 0x4200000000000000>
893   call void @llvm.x86.sse2.storeu.pd(i8* %a0, <2 x double> %a2)
894   ret void
895 }
896 declare void @llvm.x86.sse2.storeu.pd(i8*, <2 x double>) nounwind
897
898
899 define <2 x double> @test_x86_sse2_sub_sd(<2 x double> %a0, <2 x double> %a1) {
900 ; CHECK-LABEL: test_x86_sse2_sub_sd:
901 ; CHECK:       ## BB#0:
902 ; CHECK-NEXT:    vsubsd %xmm1, %xmm0, %xmm0
903 ; CHECK-NEXT:    retl
904   %res = call <2 x double> @llvm.x86.sse2.sub.sd(<2 x double> %a0, <2 x double> %a1) ; <<2 x double>> [#uses=1]
905   ret <2 x double> %res
906 }
907 declare <2 x double> @llvm.x86.sse2.sub.sd(<2 x double>, <2 x double>) nounwind readnone
908
909
910 define i32 @test_x86_sse2_ucomieq_sd(<2 x double> %a0, <2 x double> %a1) {
911 ; CHECK-LABEL: test_x86_sse2_ucomieq_sd:
912 ; CHECK:       ## BB#0:
913 ; CHECK-NEXT:    vucomisd %xmm1, %xmm0
914 ; CHECK-NEXT:    sete %al
915 ; CHECK-NEXT:    movzbl %al, %eax
916 ; CHECK-NEXT:    retl
917   %res = call i32 @llvm.x86.sse2.ucomieq.sd(<2 x double> %a0, <2 x double> %a1) ; <i32> [#uses=1]
918   ret i32 %res
919 }
920 declare i32 @llvm.x86.sse2.ucomieq.sd(<2 x double>, <2 x double>) nounwind readnone
921
922
923 define i32 @test_x86_sse2_ucomige_sd(<2 x double> %a0, <2 x double> %a1) {
924 ; CHECK-LABEL: test_x86_sse2_ucomige_sd:
925 ; CHECK:       ## BB#0:
926 ; CHECK-NEXT:    vucomisd %xmm1, %xmm0
927 ; CHECK-NEXT:    setae %al
928 ; CHECK-NEXT:    movzbl %al, %eax
929 ; CHECK-NEXT:    retl
930   %res = call i32 @llvm.x86.sse2.ucomige.sd(<2 x double> %a0, <2 x double> %a1) ; <i32> [#uses=1]
931   ret i32 %res
932 }
933 declare i32 @llvm.x86.sse2.ucomige.sd(<2 x double>, <2 x double>) nounwind readnone
934
935
936 define i32 @test_x86_sse2_ucomigt_sd(<2 x double> %a0, <2 x double> %a1) {
937 ; CHECK-LABEL: test_x86_sse2_ucomigt_sd:
938 ; CHECK:       ## BB#0:
939 ; CHECK-NEXT:    vucomisd %xmm1, %xmm0
940 ; CHECK-NEXT:    seta %al
941 ; CHECK-NEXT:    movzbl %al, %eax
942 ; CHECK-NEXT:    retl
943   %res = call i32 @llvm.x86.sse2.ucomigt.sd(<2 x double> %a0, <2 x double> %a1) ; <i32> [#uses=1]
944   ret i32 %res
945 }
946 declare i32 @llvm.x86.sse2.ucomigt.sd(<2 x double>, <2 x double>) nounwind readnone
947
948
949 define i32 @test_x86_sse2_ucomile_sd(<2 x double> %a0, <2 x double> %a1) {
950 ; CHECK-LABEL: test_x86_sse2_ucomile_sd:
951 ; CHECK:       ## BB#0:
952 ; CHECK-NEXT:    vucomisd %xmm1, %xmm0
953 ; CHECK-NEXT:    setbe %al
954 ; CHECK-NEXT:    movzbl %al, %eax
955 ; CHECK-NEXT:    retl
956   %res = call i32 @llvm.x86.sse2.ucomile.sd(<2 x double> %a0, <2 x double> %a1) ; <i32> [#uses=1]
957   ret i32 %res
958 }
959 declare i32 @llvm.x86.sse2.ucomile.sd(<2 x double>, <2 x double>) nounwind readnone
960
961
962 define i32 @test_x86_sse2_ucomilt_sd(<2 x double> %a0, <2 x double> %a1) {
963 ; CHECK-LABEL: test_x86_sse2_ucomilt_sd:
964 ; CHECK:       ## BB#0:
965 ; CHECK-NEXT:    vucomisd %xmm1, %xmm0
966 ; CHECK-NEXT:    sbbl %eax, %eax
967 ; CHECK-NEXT:    andl $1, %eax
968 ; CHECK-NEXT:    retl
969   %res = call i32 @llvm.x86.sse2.ucomilt.sd(<2 x double> %a0, <2 x double> %a1) ; <i32> [#uses=1]
970   ret i32 %res
971 }
972 declare i32 @llvm.x86.sse2.ucomilt.sd(<2 x double>, <2 x double>) nounwind readnone
973
974
975 define i32 @test_x86_sse2_ucomineq_sd(<2 x double> %a0, <2 x double> %a1) {
976 ; CHECK-LABEL: test_x86_sse2_ucomineq_sd:
977 ; CHECK:       ## BB#0:
978 ; CHECK-NEXT:    vucomisd %xmm1, %xmm0
979 ; CHECK-NEXT:    setne %al
980 ; CHECK-NEXT:    movzbl %al, %eax
981 ; CHECK-NEXT:    retl
982   %res = call i32 @llvm.x86.sse2.ucomineq.sd(<2 x double> %a0, <2 x double> %a1) ; <i32> [#uses=1]
983   ret i32 %res
984 }
985 declare i32 @llvm.x86.sse2.ucomineq.sd(<2 x double>, <2 x double>) nounwind readnone
986
987
988 define <2 x double> @test_x86_sse3_addsub_pd(<2 x double> %a0, <2 x double> %a1) {
989 ; CHECK-LABEL: test_x86_sse3_addsub_pd:
990 ; CHECK:       ## BB#0:
991 ; CHECK-NEXT:    vaddsubpd %xmm1, %xmm0, %xmm0
992 ; CHECK-NEXT:    retl
993   %res = call <2 x double> @llvm.x86.sse3.addsub.pd(<2 x double> %a0, <2 x double> %a1) ; <<2 x double>> [#uses=1]
994   ret <2 x double> %res
995 }
996 declare <2 x double> @llvm.x86.sse3.addsub.pd(<2 x double>, <2 x double>) nounwind readnone
997
998
999 define <4 x float> @test_x86_sse3_addsub_ps(<4 x float> %a0, <4 x float> %a1) {
1000 ; CHECK-LABEL: test_x86_sse3_addsub_ps:
1001 ; CHECK:       ## BB#0:
1002 ; CHECK-NEXT:    vaddsubps %xmm1, %xmm0, %xmm0
1003 ; CHECK-NEXT:    retl
1004   %res = call <4 x float> @llvm.x86.sse3.addsub.ps(<4 x float> %a0, <4 x float> %a1) ; <<4 x float>> [#uses=1]
1005   ret <4 x float> %res
1006 }
1007 declare <4 x float> @llvm.x86.sse3.addsub.ps(<4 x float>, <4 x float>) nounwind readnone
1008
1009
1010 define <2 x double> @test_x86_sse3_hadd_pd(<2 x double> %a0, <2 x double> %a1) {
1011 ; CHECK-LABEL: test_x86_sse3_hadd_pd:
1012 ; CHECK:       ## BB#0:
1013 ; CHECK-NEXT:    vhaddpd %xmm1, %xmm0, %xmm0
1014 ; CHECK-NEXT:    retl
1015   %res = call <2 x double> @llvm.x86.sse3.hadd.pd(<2 x double> %a0, <2 x double> %a1) ; <<2 x double>> [#uses=1]
1016   ret <2 x double> %res
1017 }
1018 declare <2 x double> @llvm.x86.sse3.hadd.pd(<2 x double>, <2 x double>) nounwind readnone
1019
1020
1021 define <4 x float> @test_x86_sse3_hadd_ps(<4 x float> %a0, <4 x float> %a1) {
1022 ; CHECK-LABEL: test_x86_sse3_hadd_ps:
1023 ; CHECK:       ## BB#0:
1024 ; CHECK-NEXT:    vhaddps %xmm1, %xmm0, %xmm0
1025 ; CHECK-NEXT:    retl
1026   %res = call <4 x float> @llvm.x86.sse3.hadd.ps(<4 x float> %a0, <4 x float> %a1) ; <<4 x float>> [#uses=1]
1027   ret <4 x float> %res
1028 }
1029 declare <4 x float> @llvm.x86.sse3.hadd.ps(<4 x float>, <4 x float>) nounwind readnone
1030
1031
1032 define <2 x double> @test_x86_sse3_hsub_pd(<2 x double> %a0, <2 x double> %a1) {
1033 ; CHECK-LABEL: test_x86_sse3_hsub_pd:
1034 ; CHECK:       ## BB#0:
1035 ; CHECK-NEXT:    vhsubpd %xmm1, %xmm0, %xmm0
1036 ; CHECK-NEXT:    retl
1037   %res = call <2 x double> @llvm.x86.sse3.hsub.pd(<2 x double> %a0, <2 x double> %a1) ; <<2 x double>> [#uses=1]
1038   ret <2 x double> %res
1039 }
1040 declare <2 x double> @llvm.x86.sse3.hsub.pd(<2 x double>, <2 x double>) nounwind readnone
1041
1042
1043 define <4 x float> @test_x86_sse3_hsub_ps(<4 x float> %a0, <4 x float> %a1) {
1044 ; CHECK-LABEL: test_x86_sse3_hsub_ps:
1045 ; CHECK:       ## BB#0:
1046 ; CHECK-NEXT:    vhsubps %xmm1, %xmm0, %xmm0
1047 ; CHECK-NEXT:    retl
1048   %res = call <4 x float> @llvm.x86.sse3.hsub.ps(<4 x float> %a0, <4 x float> %a1) ; <<4 x float>> [#uses=1]
1049   ret <4 x float> %res
1050 }
1051 declare <4 x float> @llvm.x86.sse3.hsub.ps(<4 x float>, <4 x float>) nounwind readnone
1052
1053
1054 define <16 x i8> @test_x86_sse3_ldu_dq(i8* %a0) {
1055 ; CHECK-LABEL: test_x86_sse3_ldu_dq:
1056 ; CHECK:       ## BB#0:
1057 ; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %eax
1058 ; CHECK-NEXT:    vlddqu (%eax), %xmm0
1059 ; CHECK-NEXT:    retl
1060   %res = call <16 x i8> @llvm.x86.sse3.ldu.dq(i8* %a0) ; <<16 x i8>> [#uses=1]
1061   ret <16 x i8> %res
1062 }
1063 declare <16 x i8> @llvm.x86.sse3.ldu.dq(i8*) nounwind readonly
1064
1065
1066 define <2 x double> @test_x86_sse41_blendvpd(<2 x double> %a0, <2 x double> %a1, <2 x double> %a2) {
1067 ; CHECK-LABEL: test_x86_sse41_blendvpd:
1068 ; CHECK:       ## BB#0:
1069 ; CHECK-NEXT:    vblendvpd %xmm2, %xmm1, %xmm0, %xmm0
1070 ; CHECK-NEXT:    retl
1071   %res = call <2 x double> @llvm.x86.sse41.blendvpd(<2 x double> %a0, <2 x double> %a1, <2 x double> %a2) ; <<2 x double>> [#uses=1]
1072   ret <2 x double> %res
1073 }
1074 declare <2 x double> @llvm.x86.sse41.blendvpd(<2 x double>, <2 x double>, <2 x double>) nounwind readnone
1075
1076
1077 define <4 x float> @test_x86_sse41_blendvps(<4 x float> %a0, <4 x float> %a1, <4 x float> %a2) {
1078 ; CHECK-LABEL: test_x86_sse41_blendvps:
1079 ; CHECK:       ## BB#0:
1080 ; CHECK-NEXT:    vblendvps %xmm2, %xmm1, %xmm0, %xmm0
1081 ; CHECK-NEXT:    retl
1082   %res = call <4 x float> @llvm.x86.sse41.blendvps(<4 x float> %a0, <4 x float> %a1, <4 x float> %a2) ; <<4 x float>> [#uses=1]
1083   ret <4 x float> %res
1084 }
1085 declare <4 x float> @llvm.x86.sse41.blendvps(<4 x float>, <4 x float>, <4 x float>) nounwind readnone
1086
1087
1088 define <2 x double> @test_x86_sse41_dppd(<2 x double> %a0, <2 x double> %a1) {
1089 ; CHECK-LABEL: test_x86_sse41_dppd:
1090 ; CHECK:       ## BB#0:
1091 ; CHECK-NEXT:    vdppd $7, %xmm1, %xmm0, %xmm0
1092 ; CHECK-NEXT:    retl
1093   %res = call <2 x double> @llvm.x86.sse41.dppd(<2 x double> %a0, <2 x double> %a1, i8 7) ; <<2 x double>> [#uses=1]
1094   ret <2 x double> %res
1095 }
1096 declare <2 x double> @llvm.x86.sse41.dppd(<2 x double>, <2 x double>, i8) nounwind readnone
1097
1098
1099 define <4 x float> @test_x86_sse41_dpps(<4 x float> %a0, <4 x float> %a1) {
1100 ; CHECK-LABEL: test_x86_sse41_dpps:
1101 ; CHECK:       ## BB#0:
1102 ; CHECK-NEXT:    vdpps $7, %xmm1, %xmm0, %xmm0
1103 ; CHECK-NEXT:    retl
1104   %res = call <4 x float> @llvm.x86.sse41.dpps(<4 x float> %a0, <4 x float> %a1, i8 7) ; <<4 x float>> [#uses=1]
1105   ret <4 x float> %res
1106 }
1107 declare <4 x float> @llvm.x86.sse41.dpps(<4 x float>, <4 x float>, i8) nounwind readnone
1108
1109
1110 define <4 x float> @test_x86_sse41_insertps(<4 x float> %a0, <4 x float> %a1) {
1111 ; CHECK-LABEL: test_x86_sse41_insertps:
1112 ; CHECK:       ## BB#0:
1113 ; CHECK-NEXT:    vinsertps {{.*#+}} xmm0 = zero,zero,zero,xmm0[3]
1114 ; CHECK-NEXT:    retl
1115   %res = call <4 x float> @llvm.x86.sse41.insertps(<4 x float> %a0, <4 x float> %a1, i8 7) ; <<4 x float>> [#uses=1]
1116   ret <4 x float> %res
1117 }
1118 declare <4 x float> @llvm.x86.sse41.insertps(<4 x float>, <4 x float>, i8) nounwind readnone
1119
1120
1121
1122 define <8 x i16> @test_x86_sse41_mpsadbw(<16 x i8> %a0, <16 x i8> %a1) {
1123 ; CHECK-LABEL: test_x86_sse41_mpsadbw:
1124 ; CHECK:       ## BB#0:
1125 ; CHECK-NEXT:    vmpsadbw $7, %xmm1, %xmm0, %xmm0
1126 ; CHECK-NEXT:    retl
1127   %res = call <8 x i16> @llvm.x86.sse41.mpsadbw(<16 x i8> %a0, <16 x i8> %a1, i8 7) ; <<8 x i16>> [#uses=1]
1128   ret <8 x i16> %res
1129 }
1130 declare <8 x i16> @llvm.x86.sse41.mpsadbw(<16 x i8>, <16 x i8>, i8) nounwind readnone
1131
1132
1133 define <8 x i16> @test_x86_sse41_packusdw(<4 x i32> %a0, <4 x i32> %a1) {
1134 ; CHECK-LABEL: test_x86_sse41_packusdw:
1135 ; CHECK:       ## BB#0:
1136 ; CHECK-NEXT:    vpackusdw %xmm1, %xmm0, %xmm0
1137 ; CHECK-NEXT:    retl
1138   %res = call <8 x i16> @llvm.x86.sse41.packusdw(<4 x i32> %a0, <4 x i32> %a1) ; <<8 x i16>> [#uses=1]
1139   ret <8 x i16> %res
1140 }
1141 declare <8 x i16> @llvm.x86.sse41.packusdw(<4 x i32>, <4 x i32>) nounwind readnone
1142
1143
1144 define <16 x i8> @test_x86_sse41_pblendvb(<16 x i8> %a0, <16 x i8> %a1, <16 x i8> %a2) {
1145 ; CHECK-LABEL: test_x86_sse41_pblendvb:
1146 ; CHECK:       ## BB#0:
1147 ; CHECK-NEXT:    vpblendvb %xmm2, %xmm1, %xmm0, %xmm0
1148 ; CHECK-NEXT:    retl
1149   %res = call <16 x i8> @llvm.x86.sse41.pblendvb(<16 x i8> %a0, <16 x i8> %a1, <16 x i8> %a2) ; <<16 x i8>> [#uses=1]
1150   ret <16 x i8> %res
1151 }
1152 declare <16 x i8> @llvm.x86.sse41.pblendvb(<16 x i8>, <16 x i8>, <16 x i8>) nounwind readnone
1153
1154
1155 define <8 x i16> @test_x86_sse41_phminposuw(<8 x i16> %a0) {
1156 ; CHECK-LABEL: test_x86_sse41_phminposuw:
1157 ; CHECK:       ## BB#0:
1158 ; CHECK-NEXT:    vphminposuw %xmm0, %xmm0
1159 ; CHECK-NEXT:    retl
1160   %res = call <8 x i16> @llvm.x86.sse41.phminposuw(<8 x i16> %a0) ; <<8 x i16>> [#uses=1]
1161   ret <8 x i16> %res
1162 }
1163 declare <8 x i16> @llvm.x86.sse41.phminposuw(<8 x i16>) nounwind readnone
1164
1165
1166 define <16 x i8> @test_x86_sse41_pmaxsb(<16 x i8> %a0, <16 x i8> %a1) {
1167 ; CHECK-LABEL: test_x86_sse41_pmaxsb:
1168 ; CHECK:       ## BB#0:
1169 ; CHECK-NEXT:    vpmaxsb %xmm1, %xmm0, %xmm0
1170 ; CHECK-NEXT:    retl
1171   %res = call <16 x i8> @llvm.x86.sse41.pmaxsb(<16 x i8> %a0, <16 x i8> %a1) ; <<16 x i8>> [#uses=1]
1172   ret <16 x i8> %res
1173 }
1174 declare <16 x i8> @llvm.x86.sse41.pmaxsb(<16 x i8>, <16 x i8>) nounwind readnone
1175
1176
1177 define <4 x i32> @test_x86_sse41_pmaxsd(<4 x i32> %a0, <4 x i32> %a1) {
1178 ; CHECK-LABEL: test_x86_sse41_pmaxsd:
1179 ; CHECK:       ## BB#0:
1180 ; CHECK-NEXT:    vpmaxsd %xmm1, %xmm0, %xmm0
1181 ; CHECK-NEXT:    retl
1182   %res = call <4 x i32> @llvm.x86.sse41.pmaxsd(<4 x i32> %a0, <4 x i32> %a1) ; <<4 x i32>> [#uses=1]
1183   ret <4 x i32> %res
1184 }
1185 declare <4 x i32> @llvm.x86.sse41.pmaxsd(<4 x i32>, <4 x i32>) nounwind readnone
1186
1187
1188 define <4 x i32> @test_x86_sse41_pmaxud(<4 x i32> %a0, <4 x i32> %a1) {
1189 ; CHECK-LABEL: test_x86_sse41_pmaxud:
1190 ; CHECK:       ## BB#0:
1191 ; CHECK-NEXT:    vpmaxud %xmm1, %xmm0, %xmm0
1192 ; CHECK-NEXT:    retl
1193   %res = call <4 x i32> @llvm.x86.sse41.pmaxud(<4 x i32> %a0, <4 x i32> %a1) ; <<4 x i32>> [#uses=1]
1194   ret <4 x i32> %res
1195 }
1196 declare <4 x i32> @llvm.x86.sse41.pmaxud(<4 x i32>, <4 x i32>) nounwind readnone
1197
1198
1199 define <8 x i16> @test_x86_sse41_pmaxuw(<8 x i16> %a0, <8 x i16> %a1) {
1200 ; CHECK-LABEL: test_x86_sse41_pmaxuw:
1201 ; CHECK:       ## BB#0:
1202 ; CHECK-NEXT:    vpmaxuw %xmm1, %xmm0, %xmm0
1203 ; CHECK-NEXT:    retl
1204   %res = call <8 x i16> @llvm.x86.sse41.pmaxuw(<8 x i16> %a0, <8 x i16> %a1) ; <<8 x i16>> [#uses=1]
1205   ret <8 x i16> %res
1206 }
1207 declare <8 x i16> @llvm.x86.sse41.pmaxuw(<8 x i16>, <8 x i16>) nounwind readnone
1208
1209
1210 define <16 x i8> @test_x86_sse41_pminsb(<16 x i8> %a0, <16 x i8> %a1) {
1211 ; CHECK-LABEL: test_x86_sse41_pminsb:
1212 ; CHECK:       ## BB#0:
1213 ; CHECK-NEXT:    vpminsb %xmm1, %xmm0, %xmm0
1214 ; CHECK-NEXT:    retl
1215   %res = call <16 x i8> @llvm.x86.sse41.pminsb(<16 x i8> %a0, <16 x i8> %a1) ; <<16 x i8>> [#uses=1]
1216   ret <16 x i8> %res
1217 }
1218 declare <16 x i8> @llvm.x86.sse41.pminsb(<16 x i8>, <16 x i8>) nounwind readnone
1219
1220
1221 define <4 x i32> @test_x86_sse41_pminsd(<4 x i32> %a0, <4 x i32> %a1) {
1222 ; CHECK-LABEL: test_x86_sse41_pminsd:
1223 ; CHECK:       ## BB#0:
1224 ; CHECK-NEXT:    vpminsd %xmm1, %xmm0, %xmm0
1225 ; CHECK-NEXT:    retl
1226   %res = call <4 x i32> @llvm.x86.sse41.pminsd(<4 x i32> %a0, <4 x i32> %a1) ; <<4 x i32>> [#uses=1]
1227   ret <4 x i32> %res
1228 }
1229 declare <4 x i32> @llvm.x86.sse41.pminsd(<4 x i32>, <4 x i32>) nounwind readnone
1230
1231
1232 define <4 x i32> @test_x86_sse41_pminud(<4 x i32> %a0, <4 x i32> %a1) {
1233 ; CHECK-LABEL: test_x86_sse41_pminud:
1234 ; CHECK:       ## BB#0:
1235 ; CHECK-NEXT:    vpminud %xmm1, %xmm0, %xmm0
1236 ; CHECK-NEXT:    retl
1237   %res = call <4 x i32> @llvm.x86.sse41.pminud(<4 x i32> %a0, <4 x i32> %a1) ; <<4 x i32>> [#uses=1]
1238   ret <4 x i32> %res
1239 }
1240 declare <4 x i32> @llvm.x86.sse41.pminud(<4 x i32>, <4 x i32>) nounwind readnone
1241
1242
1243 define <8 x i16> @test_x86_sse41_pminuw(<8 x i16> %a0, <8 x i16> %a1) {
1244 ; CHECK-LABEL: test_x86_sse41_pminuw:
1245 ; CHECK:       ## BB#0:
1246 ; CHECK-NEXT:    vpminuw %xmm1, %xmm0, %xmm0
1247 ; CHECK-NEXT:    retl
1248   %res = call <8 x i16> @llvm.x86.sse41.pminuw(<8 x i16> %a0, <8 x i16> %a1) ; <<8 x i16>> [#uses=1]
1249   ret <8 x i16> %res
1250 }
1251 declare <8 x i16> @llvm.x86.sse41.pminuw(<8 x i16>, <8 x i16>) nounwind readnone
1252
1253
1254 define <4 x i32> @test_x86_sse41_pmovzxbd(<16 x i8> %a0) {
1255 ; CHECK-LABEL: test_x86_sse41_pmovzxbd:
1256 ; CHECK:       ## BB#0:
1257 ; CHECK-NEXT:    vpmovzxbd {{.*#+}} xmm0 = xmm0[0],zero,zero,zero,xmm0[1],zero,zero,zero,xmm0[2],zero,zero,zero,xmm0[3],zero,zero,zero
1258 ; CHECK-NEXT:    retl
1259   %res = call <4 x i32> @llvm.x86.sse41.pmovzxbd(<16 x i8> %a0) ; <<4 x i32>> [#uses=1]
1260   ret <4 x i32> %res
1261 }
1262 declare <4 x i32> @llvm.x86.sse41.pmovzxbd(<16 x i8>) nounwind readnone
1263
1264
1265 define <2 x i64> @test_x86_sse41_pmovzxbq(<16 x i8> %a0) {
1266 ; CHECK-LABEL: test_x86_sse41_pmovzxbq:
1267 ; CHECK:       ## BB#0:
1268 ; CHECK-NEXT:    vpmovzxbq {{.*#+}} xmm0 = xmm0[0],zero,zero,zero,zero,zero,zero,zero,xmm0[1],zero,zero,zero,zero,zero,zero,zero
1269 ; CHECK-NEXT:    retl
1270   %res = call <2 x i64> @llvm.x86.sse41.pmovzxbq(<16 x i8> %a0) ; <<2 x i64>> [#uses=1]
1271   ret <2 x i64> %res
1272 }
1273 declare <2 x i64> @llvm.x86.sse41.pmovzxbq(<16 x i8>) nounwind readnone
1274
1275
1276 define <8 x i16> @test_x86_sse41_pmovzxbw(<16 x i8> %a0) {
1277 ; CHECK-LABEL: test_x86_sse41_pmovzxbw:
1278 ; CHECK:       ## BB#0:
1279 ; CHECK-NEXT:    vpmovzxbw {{.*#+}} xmm0 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero,xmm0[4],zero,xmm0[5],zero,xmm0[6],zero,xmm0[7],zero
1280 ; CHECK-NEXT:    retl
1281   %res = call <8 x i16> @llvm.x86.sse41.pmovzxbw(<16 x i8> %a0) ; <<8 x i16>> [#uses=1]
1282   ret <8 x i16> %res
1283 }
1284 declare <8 x i16> @llvm.x86.sse41.pmovzxbw(<16 x i8>) nounwind readnone
1285
1286
1287 define <2 x i64> @test_x86_sse41_pmovzxdq(<4 x i32> %a0) {
1288 ; CHECK-LABEL: test_x86_sse41_pmovzxdq:
1289 ; CHECK:       ## BB#0:
1290 ; CHECK-NEXT:    vpmovzxdq {{.*#+}} xmm0 = xmm0[0],zero,xmm0[1],zero
1291 ; CHECK-NEXT:    retl
1292   %res = call <2 x i64> @llvm.x86.sse41.pmovzxdq(<4 x i32> %a0) ; <<2 x i64>> [#uses=1]
1293   ret <2 x i64> %res
1294 }
1295 declare <2 x i64> @llvm.x86.sse41.pmovzxdq(<4 x i32>) nounwind readnone
1296
1297
1298 define <4 x i32> @test_x86_sse41_pmovzxwd(<8 x i16> %a0) {
1299 ; CHECK-LABEL: test_x86_sse41_pmovzxwd:
1300 ; CHECK:       ## BB#0:
1301 ; CHECK-NEXT:    vpmovzxwd {{.*#+}} xmm0 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero
1302 ; CHECK-NEXT:    retl
1303   %res = call <4 x i32> @llvm.x86.sse41.pmovzxwd(<8 x i16> %a0) ; <<4 x i32>> [#uses=1]
1304   ret <4 x i32> %res
1305 }
1306 declare <4 x i32> @llvm.x86.sse41.pmovzxwd(<8 x i16>) nounwind readnone
1307
1308
1309 define <2 x i64> @test_x86_sse41_pmovzxwq(<8 x i16> %a0) {
1310 ; CHECK-LABEL: test_x86_sse41_pmovzxwq:
1311 ; CHECK:       ## BB#0:
1312 ; CHECK-NEXT:    vpmovzxwq {{.*#+}} xmm0 = xmm0[0],zero,zero,zero,xmm0[1],zero,zero,zero
1313 ; CHECK-NEXT:    retl
1314   %res = call <2 x i64> @llvm.x86.sse41.pmovzxwq(<8 x i16> %a0) ; <<2 x i64>> [#uses=1]
1315   ret <2 x i64> %res
1316 }
1317 declare <2 x i64> @llvm.x86.sse41.pmovzxwq(<8 x i16>) nounwind readnone
1318
1319
1320 define <2 x i64> @test_x86_sse41_pmuldq(<4 x i32> %a0, <4 x i32> %a1) {
1321 ; CHECK-LABEL: test_x86_sse41_pmuldq:
1322 ; CHECK:       ## BB#0:
1323 ; CHECK-NEXT:    vpmuldq %xmm1, %xmm0, %xmm0
1324 ; CHECK-NEXT:    retl
1325   %res = call <2 x i64> @llvm.x86.sse41.pmuldq(<4 x i32> %a0, <4 x i32> %a1) ; <<2 x i64>> [#uses=1]
1326   ret <2 x i64> %res
1327 }
1328 declare <2 x i64> @llvm.x86.sse41.pmuldq(<4 x i32>, <4 x i32>) nounwind readnone
1329
1330
1331 define i32 @test_x86_sse41_ptestc(<2 x i64> %a0, <2 x i64> %a1) {
1332 ; CHECK-LABEL: test_x86_sse41_ptestc:
1333 ; CHECK:       ## BB#0:
1334 ; CHECK-NEXT:    vptest %xmm1, %xmm0
1335 ; CHECK-NEXT:    sbbl %eax, %eax
1336 ; CHECK-NEXT:    andl $1, %eax
1337 ; CHECK-NEXT:    retl
1338   %res = call i32 @llvm.x86.sse41.ptestc(<2 x i64> %a0, <2 x i64> %a1) ; <i32> [#uses=1]
1339   ret i32 %res
1340 }
1341 declare i32 @llvm.x86.sse41.ptestc(<2 x i64>, <2 x i64>) nounwind readnone
1342
1343
1344 define i32 @test_x86_sse41_ptestnzc(<2 x i64> %a0, <2 x i64> %a1) {
1345 ; CHECK-LABEL: test_x86_sse41_ptestnzc:
1346 ; CHECK:       ## BB#0:
1347 ; CHECK-NEXT:    vptest %xmm1, %xmm0
1348 ; CHECK-NEXT:    seta %al
1349 ; CHECK-NEXT:    movzbl %al, %eax
1350 ; CHECK-NEXT:    retl
1351   %res = call i32 @llvm.x86.sse41.ptestnzc(<2 x i64> %a0, <2 x i64> %a1) ; <i32> [#uses=1]
1352   ret i32 %res
1353 }
1354 declare i32 @llvm.x86.sse41.ptestnzc(<2 x i64>, <2 x i64>) nounwind readnone
1355
1356
1357 define i32 @test_x86_sse41_ptestz(<2 x i64> %a0, <2 x i64> %a1) {
1358 ; CHECK-LABEL: test_x86_sse41_ptestz:
1359 ; CHECK:       ## BB#0:
1360 ; CHECK-NEXT:    vptest %xmm1, %xmm0
1361 ; CHECK-NEXT:    sete %al
1362 ; CHECK-NEXT:    movzbl %al, %eax
1363 ; CHECK-NEXT:    retl
1364   %res = call i32 @llvm.x86.sse41.ptestz(<2 x i64> %a0, <2 x i64> %a1) ; <i32> [#uses=1]
1365   ret i32 %res
1366 }
1367 declare i32 @llvm.x86.sse41.ptestz(<2 x i64>, <2 x i64>) nounwind readnone
1368
1369
1370 define <2 x double> @test_x86_sse41_round_pd(<2 x double> %a0) {
1371 ; CHECK-LABEL: test_x86_sse41_round_pd:
1372 ; CHECK:       ## BB#0:
1373 ; CHECK-NEXT:    vroundpd $7, %xmm0, %xmm0
1374 ; CHECK-NEXT:    retl
1375   %res = call <2 x double> @llvm.x86.sse41.round.pd(<2 x double> %a0, i32 7) ; <<2 x double>> [#uses=1]
1376   ret <2 x double> %res
1377 }
1378 declare <2 x double> @llvm.x86.sse41.round.pd(<2 x double>, i32) nounwind readnone
1379
1380
1381 define <4 x float> @test_x86_sse41_round_ps(<4 x float> %a0) {
1382 ; CHECK-LABEL: test_x86_sse41_round_ps:
1383 ; CHECK:       ## BB#0:
1384 ; CHECK-NEXT:    vroundps $7, %xmm0, %xmm0
1385 ; CHECK-NEXT:    retl
1386   %res = call <4 x float> @llvm.x86.sse41.round.ps(<4 x float> %a0, i32 7) ; <<4 x float>> [#uses=1]
1387   ret <4 x float> %res
1388 }
1389 declare <4 x float> @llvm.x86.sse41.round.ps(<4 x float>, i32) nounwind readnone
1390
1391
1392 define <2 x double> @test_x86_sse41_round_sd(<2 x double> %a0, <2 x double> %a1) {
1393 ; CHECK-LABEL: test_x86_sse41_round_sd:
1394 ; CHECK:       ## BB#0:
1395 ; CHECK-NEXT:    vroundsd $7, %xmm1, %xmm0, %xmm0
1396 ; CHECK-NEXT:    retl
1397   %res = call <2 x double> @llvm.x86.sse41.round.sd(<2 x double> %a0, <2 x double> %a1, i32 7) ; <<2 x double>> [#uses=1]
1398   ret <2 x double> %res
1399 }
1400 declare <2 x double> @llvm.x86.sse41.round.sd(<2 x double>, <2 x double>, i32) nounwind readnone
1401
1402
1403 define <4 x float> @test_x86_sse41_round_ss(<4 x float> %a0, <4 x float> %a1) {
1404 ; CHECK-LABEL: test_x86_sse41_round_ss:
1405 ; CHECK:       ## BB#0:
1406 ; CHECK-NEXT:    vroundss $7, %xmm1, %xmm0, %xmm0
1407 ; CHECK-NEXT:    retl
1408   %res = call <4 x float> @llvm.x86.sse41.round.ss(<4 x float> %a0, <4 x float> %a1, i32 7) ; <<4 x float>> [#uses=1]
1409   ret <4 x float> %res
1410 }
1411 declare <4 x float> @llvm.x86.sse41.round.ss(<4 x float>, <4 x float>, i32) nounwind readnone
1412
1413
1414 define i32 @test_x86_sse42_pcmpestri128(<16 x i8> %a0, <16 x i8> %a2) {
1415 ; CHECK-LABEL: test_x86_sse42_pcmpestri128:
1416 ; CHECK:       ## BB#0:
1417 ; CHECK-NEXT:    movl $7, %eax
1418 ; CHECK-NEXT:    movl $7, %edx
1419 ; CHECK-NEXT:    vpcmpestri $7, %xmm1, %xmm0
1420 ; CHECK-NEXT:    movl %ecx, %eax
1421 ; CHECK-NEXT:    retl
1422   %res = call i32 @llvm.x86.sse42.pcmpestri128(<16 x i8> %a0, i32 7, <16 x i8> %a2, i32 7, i8 7) ; <i32> [#uses=1]
1423   ret i32 %res
1424 }
1425 declare i32 @llvm.x86.sse42.pcmpestri128(<16 x i8>, i32, <16 x i8>, i32, i8) nounwind readnone
1426
1427
1428 define i32 @test_x86_sse42_pcmpestri128_load(<16 x i8>* %a0, <16 x i8>* %a2) {
1429 ; CHECK-LABEL: test_x86_sse42_pcmpestri128_load:
1430 ; CHECK:       ## BB#0:
1431 ; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %ecx
1432 ; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %eax
1433 ; CHECK-NEXT:    vmovdqa (%eax), %xmm0
1434 ; CHECK-NEXT:    movl $7, %eax
1435 ; CHECK-NEXT:    movl $7, %edx
1436 ; CHECK-NEXT:    vpcmpestri $7, (%ecx), %xmm0
1437 ; CHECK-NEXT:    movl %ecx, %eax
1438 ; CHECK-NEXT:    retl
1439   %1 = load <16 x i8>, <16 x i8>* %a0
1440   %2 = load <16 x i8>, <16 x i8>* %a2
1441   %res = call i32 @llvm.x86.sse42.pcmpestri128(<16 x i8> %1, i32 7, <16 x i8> %2, i32 7, i8 7) ; <i32> [#uses=1]
1442   ret i32 %res
1443 }
1444
1445
1446 define i32 @test_x86_sse42_pcmpestria128(<16 x i8> %a0, <16 x i8> %a2) {
1447 ; CHECK-LABEL: test_x86_sse42_pcmpestria128:
1448 ; CHECK:       ## BB#0:
1449 ; CHECK-NEXT:    movl $7, %eax
1450 ; CHECK-NEXT:    movl $7, %edx
1451 ; CHECK-NEXT:    vpcmpestri $7, %xmm1, %xmm0
1452 ; CHECK-NEXT:    seta %al
1453 ; CHECK-NEXT:    movzbl %al, %eax
1454 ; CHECK-NEXT:    retl
1455   %res = call i32 @llvm.x86.sse42.pcmpestria128(<16 x i8> %a0, i32 7, <16 x i8> %a2, i32 7, i8 7) ; <i32> [#uses=1]
1456   ret i32 %res
1457 }
1458 declare i32 @llvm.x86.sse42.pcmpestria128(<16 x i8>, i32, <16 x i8>, i32, i8) nounwind readnone
1459
1460
1461 define i32 @test_x86_sse42_pcmpestric128(<16 x i8> %a0, <16 x i8> %a2) {
1462 ; CHECK-LABEL: test_x86_sse42_pcmpestric128:
1463 ; CHECK:       ## BB#0:
1464 ; CHECK-NEXT:    movl $7, %eax
1465 ; CHECK-NEXT:    movl $7, %edx
1466 ; CHECK-NEXT:    vpcmpestri $7, %xmm1, %xmm0
1467 ; CHECK-NEXT:    sbbl %eax, %eax
1468 ; CHECK-NEXT:    andl $1, %eax
1469 ; CHECK-NEXT:    retl
1470   %res = call i32 @llvm.x86.sse42.pcmpestric128(<16 x i8> %a0, i32 7, <16 x i8> %a2, i32 7, i8 7) ; <i32> [#uses=1]
1471   ret i32 %res
1472 }
1473 declare i32 @llvm.x86.sse42.pcmpestric128(<16 x i8>, i32, <16 x i8>, i32, i8) nounwind readnone
1474
1475
1476 define i32 @test_x86_sse42_pcmpestrio128(<16 x i8> %a0, <16 x i8> %a2) {
1477 ; CHECK-LABEL: test_x86_sse42_pcmpestrio128:
1478 ; CHECK:       ## BB#0:
1479 ; CHECK-NEXT:    movl $7, %eax
1480 ; CHECK-NEXT:    movl $7, %edx
1481 ; CHECK-NEXT:    vpcmpestri $7, %xmm1, %xmm0
1482 ; CHECK-NEXT:    seto %al
1483 ; CHECK-NEXT:    movzbl %al, %eax
1484 ; CHECK-NEXT:    retl
1485   %res = call i32 @llvm.x86.sse42.pcmpestrio128(<16 x i8> %a0, i32 7, <16 x i8> %a2, i32 7, i8 7) ; <i32> [#uses=1]
1486   ret i32 %res
1487 }
1488 declare i32 @llvm.x86.sse42.pcmpestrio128(<16 x i8>, i32, <16 x i8>, i32, i8) nounwind readnone
1489
1490
1491 define i32 @test_x86_sse42_pcmpestris128(<16 x i8> %a0, <16 x i8> %a2) {
1492 ; CHECK-LABEL: test_x86_sse42_pcmpestris128:
1493 ; CHECK:       ## BB#0:
1494 ; CHECK-NEXT:    movl $7, %eax
1495 ; CHECK-NEXT:    movl $7, %edx
1496 ; CHECK-NEXT:    vpcmpestri $7, %xmm1, %xmm0
1497 ; CHECK-NEXT:    sets %al
1498 ; CHECK-NEXT:    movzbl %al, %eax
1499 ; CHECK-NEXT:    retl
1500   %res = call i32 @llvm.x86.sse42.pcmpestris128(<16 x i8> %a0, i32 7, <16 x i8> %a2, i32 7, i8 7) ; <i32> [#uses=1]
1501   ret i32 %res
1502 }
1503 declare i32 @llvm.x86.sse42.pcmpestris128(<16 x i8>, i32, <16 x i8>, i32, i8) nounwind readnone
1504
1505
1506 define i32 @test_x86_sse42_pcmpestriz128(<16 x i8> %a0, <16 x i8> %a2) {
1507 ; CHECK-LABEL: test_x86_sse42_pcmpestriz128:
1508 ; CHECK:       ## BB#0:
1509 ; CHECK-NEXT:    movl $7, %eax
1510 ; CHECK-NEXT:    movl $7, %edx
1511 ; CHECK-NEXT:    vpcmpestri $7, %xmm1, %xmm0
1512 ; CHECK-NEXT:    sete %al
1513 ; CHECK-NEXT:    movzbl %al, %eax
1514 ; CHECK-NEXT:    retl
1515   %res = call i32 @llvm.x86.sse42.pcmpestriz128(<16 x i8> %a0, i32 7, <16 x i8> %a2, i32 7, i8 7) ; <i32> [#uses=1]
1516   ret i32 %res
1517 }
1518 declare i32 @llvm.x86.sse42.pcmpestriz128(<16 x i8>, i32, <16 x i8>, i32, i8) nounwind readnone
1519
1520
1521 define <16 x i8> @test_x86_sse42_pcmpestrm128(<16 x i8> %a0, <16 x i8> %a2) {
1522 ; CHECK-LABEL: test_x86_sse42_pcmpestrm128:
1523 ; CHECK:       ## BB#0:
1524 ; CHECK-NEXT:    movl $7, %eax
1525 ; CHECK-NEXT:    movl $7, %edx
1526 ; CHECK-NEXT:    vpcmpestrm $7, %xmm1, %xmm0
1527 ; CHECK-NEXT:    retl
1528   %res = call <16 x i8> @llvm.x86.sse42.pcmpestrm128(<16 x i8> %a0, i32 7, <16 x i8> %a2, i32 7, i8 7) ; <<16 x i8>> [#uses=1]
1529   ret <16 x i8> %res
1530 }
1531 declare <16 x i8> @llvm.x86.sse42.pcmpestrm128(<16 x i8>, i32, <16 x i8>, i32, i8) nounwind readnone
1532
1533
1534 define <16 x i8> @test_x86_sse42_pcmpestrm128_load(<16 x i8> %a0, <16 x i8>* %a2) {
1535 ; CHECK-LABEL: test_x86_sse42_pcmpestrm128_load:
1536 ; CHECK:       ## BB#0:
1537 ; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %ecx
1538 ; CHECK-NEXT:    movl $7, %eax
1539 ; CHECK-NEXT:    movl $7, %edx
1540 ; CHECK-NEXT:    vpcmpestrm $7, (%ecx), %xmm0
1541 ; CHECK-NEXT:    retl
1542   %1 = load <16 x i8>, <16 x i8>* %a2
1543   %res = call <16 x i8> @llvm.x86.sse42.pcmpestrm128(<16 x i8> %a0, i32 7, <16 x i8> %1, i32 7, i8 7) ; <<16 x i8>> [#uses=1]
1544   ret <16 x i8> %res
1545 }
1546
1547
1548 define i32 @test_x86_sse42_pcmpistri128(<16 x i8> %a0, <16 x i8> %a1) {
1549 ; CHECK-LABEL: test_x86_sse42_pcmpistri128:
1550 ; CHECK:       ## BB#0:
1551 ; CHECK-NEXT:    vpcmpistri $7, %xmm1, %xmm0
1552 ; CHECK-NEXT:    movl %ecx, %eax
1553 ; CHECK-NEXT:    retl
1554   %res = call i32 @llvm.x86.sse42.pcmpistri128(<16 x i8> %a0, <16 x i8> %a1, i8 7) ; <i32> [#uses=1]
1555   ret i32 %res
1556 }
1557 declare i32 @llvm.x86.sse42.pcmpistri128(<16 x i8>, <16 x i8>, i8) nounwind readnone
1558
1559
1560 define i32 @test_x86_sse42_pcmpistri128_load(<16 x i8>* %a0, <16 x i8>* %a1) {
1561 ; CHECK-LABEL: test_x86_sse42_pcmpistri128_load:
1562 ; CHECK:       ## BB#0:
1563 ; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %eax
1564 ; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %ecx
1565 ; CHECK-NEXT:    vmovdqa (%ecx), %xmm0
1566 ; CHECK-NEXT:    vpcmpistri $7, (%eax), %xmm0
1567 ; CHECK-NEXT:    movl %ecx, %eax
1568 ; CHECK-NEXT:    retl
1569   %1 = load <16 x i8>, <16 x i8>* %a0
1570   %2 = load <16 x i8>, <16 x i8>* %a1
1571   %res = call i32 @llvm.x86.sse42.pcmpistri128(<16 x i8> %1, <16 x i8> %2, i8 7) ; <i32> [#uses=1]
1572   ret i32 %res
1573 }
1574
1575
1576 define i32 @test_x86_sse42_pcmpistria128(<16 x i8> %a0, <16 x i8> %a1) {
1577 ; CHECK-LABEL: test_x86_sse42_pcmpistria128:
1578 ; CHECK:       ## BB#0:
1579 ; CHECK-NEXT:    vpcmpistri $7, %xmm1, %xmm0
1580 ; CHECK-NEXT:    seta %al
1581 ; CHECK-NEXT:    movzbl %al, %eax
1582 ; CHECK-NEXT:    retl
1583   %res = call i32 @llvm.x86.sse42.pcmpistria128(<16 x i8> %a0, <16 x i8> %a1, i8 7) ; <i32> [#uses=1]
1584   ret i32 %res
1585 }
1586 declare i32 @llvm.x86.sse42.pcmpistria128(<16 x i8>, <16 x i8>, i8) nounwind readnone
1587
1588
1589 define i32 @test_x86_sse42_pcmpistric128(<16 x i8> %a0, <16 x i8> %a1) {
1590 ; CHECK-LABEL: test_x86_sse42_pcmpistric128:
1591 ; CHECK:       ## BB#0:
1592 ; CHECK-NEXT:    vpcmpistri $7, %xmm1, %xmm0
1593 ; CHECK-NEXT:    sbbl %eax, %eax
1594 ; CHECK-NEXT:    andl $1, %eax
1595 ; CHECK-NEXT:    retl
1596   %res = call i32 @llvm.x86.sse42.pcmpistric128(<16 x i8> %a0, <16 x i8> %a1, i8 7) ; <i32> [#uses=1]
1597   ret i32 %res
1598 }
1599 declare i32 @llvm.x86.sse42.pcmpistric128(<16 x i8>, <16 x i8>, i8) nounwind readnone
1600
1601
1602 define i32 @test_x86_sse42_pcmpistrio128(<16 x i8> %a0, <16 x i8> %a1) {
1603 ; CHECK-LABEL: test_x86_sse42_pcmpistrio128:
1604 ; CHECK:       ## BB#0:
1605 ; CHECK-NEXT:    vpcmpistri $7, %xmm1, %xmm0
1606 ; CHECK-NEXT:    seto %al
1607 ; CHECK-NEXT:    movzbl %al, %eax
1608 ; CHECK-NEXT:    retl
1609   %res = call i32 @llvm.x86.sse42.pcmpistrio128(<16 x i8> %a0, <16 x i8> %a1, i8 7) ; <i32> [#uses=1]
1610   ret i32 %res
1611 }
1612 declare i32 @llvm.x86.sse42.pcmpistrio128(<16 x i8>, <16 x i8>, i8) nounwind readnone
1613
1614
1615 define i32 @test_x86_sse42_pcmpistris128(<16 x i8> %a0, <16 x i8> %a1) {
1616 ; CHECK-LABEL: test_x86_sse42_pcmpistris128:
1617 ; CHECK:       ## BB#0:
1618 ; CHECK-NEXT:    vpcmpistri $7, %xmm1, %xmm0
1619 ; CHECK-NEXT:    sets %al
1620 ; CHECK-NEXT:    movzbl %al, %eax
1621 ; CHECK-NEXT:    retl
1622   %res = call i32 @llvm.x86.sse42.pcmpistris128(<16 x i8> %a0, <16 x i8> %a1, i8 7) ; <i32> [#uses=1]
1623   ret i32 %res
1624 }
1625 declare i32 @llvm.x86.sse42.pcmpistris128(<16 x i8>, <16 x i8>, i8) nounwind readnone
1626
1627
1628 define i32 @test_x86_sse42_pcmpistriz128(<16 x i8> %a0, <16 x i8> %a1) {
1629 ; CHECK-LABEL: test_x86_sse42_pcmpistriz128:
1630 ; CHECK:       ## BB#0:
1631 ; CHECK-NEXT:    vpcmpistri $7, %xmm1, %xmm0
1632 ; CHECK-NEXT:    sete %al
1633 ; CHECK-NEXT:    movzbl %al, %eax
1634 ; CHECK-NEXT:    retl
1635   %res = call i32 @llvm.x86.sse42.pcmpistriz128(<16 x i8> %a0, <16 x i8> %a1, i8 7) ; <i32> [#uses=1]
1636   ret i32 %res
1637 }
1638 declare i32 @llvm.x86.sse42.pcmpistriz128(<16 x i8>, <16 x i8>, i8) nounwind readnone
1639
1640
1641 define <16 x i8> @test_x86_sse42_pcmpistrm128(<16 x i8> %a0, <16 x i8> %a1) {
1642 ; CHECK-LABEL: test_x86_sse42_pcmpistrm128:
1643 ; CHECK:       ## BB#0:
1644 ; CHECK-NEXT:    vpcmpistrm $7, %xmm1, %xmm0
1645 ; CHECK-NEXT:    retl
1646   %res = call <16 x i8> @llvm.x86.sse42.pcmpistrm128(<16 x i8> %a0, <16 x i8> %a1, i8 7) ; <<16 x i8>> [#uses=1]
1647   ret <16 x i8> %res
1648 }
1649 declare <16 x i8> @llvm.x86.sse42.pcmpistrm128(<16 x i8>, <16 x i8>, i8) nounwind readnone
1650
1651
1652 define <16 x i8> @test_x86_sse42_pcmpistrm128_load(<16 x i8> %a0, <16 x i8>* %a1) {
1653 ; CHECK-LABEL: test_x86_sse42_pcmpistrm128_load:
1654 ; CHECK:       ## BB#0:
1655 ; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %eax
1656 ; CHECK-NEXT:    vpcmpistrm $7, (%eax), %xmm0
1657 ; CHECK-NEXT:    retl
1658   %1 = load <16 x i8>, <16 x i8>* %a1
1659   %res = call <16 x i8> @llvm.x86.sse42.pcmpistrm128(<16 x i8> %a0, <16 x i8> %1, i8 7) ; <<16 x i8>> [#uses=1]
1660   ret <16 x i8> %res
1661 }
1662
1663
1664 define <4 x float> @test_x86_sse_add_ss(<4 x float> %a0, <4 x float> %a1) {
1665 ; CHECK-LABEL: test_x86_sse_add_ss:
1666 ; CHECK:       ## BB#0:
1667 ; CHECK-NEXT:    vaddss %xmm1, %xmm0, %xmm0
1668 ; CHECK-NEXT:    retl
1669   %res = call <4 x float> @llvm.x86.sse.add.ss(<4 x float> %a0, <4 x float> %a1) ; <<4 x float>> [#uses=1]
1670   ret <4 x float> %res
1671 }
1672 declare <4 x float> @llvm.x86.sse.add.ss(<4 x float>, <4 x float>) nounwind readnone
1673
1674
1675 define <4 x float> @test_x86_sse_cmp_ps(<4 x float> %a0, <4 x float> %a1) {
1676 ; CHECK-LABEL: test_x86_sse_cmp_ps:
1677 ; CHECK:       ## BB#0:
1678 ; CHECK-NEXT:    vcmpordps %xmm1, %xmm0, %xmm0
1679 ; CHECK-NEXT:    retl
1680   %res = call <4 x float> @llvm.x86.sse.cmp.ps(<4 x float> %a0, <4 x float> %a1, i8 7) ; <<4 x float>> [#uses=1]
1681   ret <4 x float> %res
1682 }
1683 declare <4 x float> @llvm.x86.sse.cmp.ps(<4 x float>, <4 x float>, i8) nounwind readnone
1684
1685
1686 define <4 x float> @test_x86_sse_cmp_ss(<4 x float> %a0, <4 x float> %a1) {
1687 ; CHECK-LABEL: test_x86_sse_cmp_ss:
1688 ; CHECK:       ## BB#0:
1689 ; CHECK-NEXT:    vcmpordss %xmm1, %xmm0, %xmm0
1690 ; CHECK-NEXT:    retl
1691   %res = call <4 x float> @llvm.x86.sse.cmp.ss(<4 x float> %a0, <4 x float> %a1, i8 7) ; <<4 x float>> [#uses=1]
1692   ret <4 x float> %res
1693 }
1694 declare <4 x float> @llvm.x86.sse.cmp.ss(<4 x float>, <4 x float>, i8) nounwind readnone
1695
1696
1697 define i32 @test_x86_sse_comieq_ss(<4 x float> %a0, <4 x float> %a1) {
1698 ; CHECK-LABEL: test_x86_sse_comieq_ss:
1699 ; CHECK:       ## BB#0:
1700 ; CHECK-NEXT:    vcomiss %xmm1, %xmm0
1701 ; CHECK-NEXT:    sete %al
1702 ; CHECK-NEXT:    movzbl %al, %eax
1703 ; CHECK-NEXT:    retl
1704   %res = call i32 @llvm.x86.sse.comieq.ss(<4 x float> %a0, <4 x float> %a1) ; <i32> [#uses=1]
1705   ret i32 %res
1706 }
1707 declare i32 @llvm.x86.sse.comieq.ss(<4 x float>, <4 x float>) nounwind readnone
1708
1709
1710 define i32 @test_x86_sse_comige_ss(<4 x float> %a0, <4 x float> %a1) {
1711 ; CHECK-LABEL: test_x86_sse_comige_ss:
1712 ; CHECK:       ## BB#0:
1713 ; CHECK-NEXT:    vcomiss %xmm1, %xmm0
1714 ; CHECK-NEXT:    setae %al
1715 ; CHECK-NEXT:    movzbl %al, %eax
1716 ; CHECK-NEXT:    retl
1717   %res = call i32 @llvm.x86.sse.comige.ss(<4 x float> %a0, <4 x float> %a1) ; <i32> [#uses=1]
1718   ret i32 %res
1719 }
1720 declare i32 @llvm.x86.sse.comige.ss(<4 x float>, <4 x float>) nounwind readnone
1721
1722
1723 define i32 @test_x86_sse_comigt_ss(<4 x float> %a0, <4 x float> %a1) {
1724 ; CHECK-LABEL: test_x86_sse_comigt_ss:
1725 ; CHECK:       ## BB#0:
1726 ; CHECK-NEXT:    vcomiss %xmm1, %xmm0
1727 ; CHECK-NEXT:    seta %al
1728 ; CHECK-NEXT:    movzbl %al, %eax
1729 ; CHECK-NEXT:    retl
1730   %res = call i32 @llvm.x86.sse.comigt.ss(<4 x float> %a0, <4 x float> %a1) ; <i32> [#uses=1]
1731   ret i32 %res
1732 }
1733 declare i32 @llvm.x86.sse.comigt.ss(<4 x float>, <4 x float>) nounwind readnone
1734
1735
1736 define i32 @test_x86_sse_comile_ss(<4 x float> %a0, <4 x float> %a1) {
1737 ; CHECK-LABEL: test_x86_sse_comile_ss:
1738 ; CHECK:       ## BB#0:
1739 ; CHECK-NEXT:    vcomiss %xmm1, %xmm0
1740 ; CHECK-NEXT:    setbe %al
1741 ; CHECK-NEXT:    movzbl %al, %eax
1742 ; CHECK-NEXT:    retl
1743   %res = call i32 @llvm.x86.sse.comile.ss(<4 x float> %a0, <4 x float> %a1) ; <i32> [#uses=1]
1744   ret i32 %res
1745 }
1746 declare i32 @llvm.x86.sse.comile.ss(<4 x float>, <4 x float>) nounwind readnone
1747
1748
1749 define i32 @test_x86_sse_comilt_ss(<4 x float> %a0, <4 x float> %a1) {
1750 ; CHECK-LABEL: test_x86_sse_comilt_ss:
1751 ; CHECK:       ## BB#0:
1752 ; CHECK-NEXT:    vcomiss %xmm1, %xmm0
1753 ; CHECK-NEXT:    sbbl %eax, %eax
1754 ; CHECK-NEXT:    andl $1, %eax
1755 ; CHECK-NEXT:    retl
1756   %res = call i32 @llvm.x86.sse.comilt.ss(<4 x float> %a0, <4 x float> %a1) ; <i32> [#uses=1]
1757   ret i32 %res
1758 }
1759 declare i32 @llvm.x86.sse.comilt.ss(<4 x float>, <4 x float>) nounwind readnone
1760
1761
1762 define i32 @test_x86_sse_comineq_ss(<4 x float> %a0, <4 x float> %a1) {
1763 ; CHECK-LABEL: test_x86_sse_comineq_ss:
1764 ; CHECK:       ## BB#0:
1765 ; CHECK-NEXT:    vcomiss %xmm1, %xmm0
1766 ; CHECK-NEXT:    setne %al
1767 ; CHECK-NEXT:    movzbl %al, %eax
1768 ; CHECK-NEXT:    retl
1769   %res = call i32 @llvm.x86.sse.comineq.ss(<4 x float> %a0, <4 x float> %a1) ; <i32> [#uses=1]
1770   ret i32 %res
1771 }
1772 declare i32 @llvm.x86.sse.comineq.ss(<4 x float>, <4 x float>) nounwind readnone
1773
1774
1775 define <4 x float> @test_x86_sse_cvtsi2ss(<4 x float> %a0) {
1776 ; CHECK-LABEL: test_x86_sse_cvtsi2ss:
1777 ; CHECK:       ## BB#0:
1778 ; CHECK-NEXT:    movl $7, %eax
1779 ; CHECK-NEXT:    vcvtsi2ssl %eax, %xmm0, %xmm0
1780 ; CHECK-NEXT:    retl
1781   %res = call <4 x float> @llvm.x86.sse.cvtsi2ss(<4 x float> %a0, i32 7) ; <<4 x float>> [#uses=1]
1782   ret <4 x float> %res
1783 }
1784 declare <4 x float> @llvm.x86.sse.cvtsi2ss(<4 x float>, i32) nounwind readnone
1785
1786
1787 define i32 @test_x86_sse_cvtss2si(<4 x float> %a0) {
1788 ; CHECK-LABEL: test_x86_sse_cvtss2si:
1789 ; CHECK:       ## BB#0:
1790 ; CHECK-NEXT:    vcvtss2si %xmm0, %eax
1791 ; CHECK-NEXT:    retl
1792   %res = call i32 @llvm.x86.sse.cvtss2si(<4 x float> %a0) ; <i32> [#uses=1]
1793   ret i32 %res
1794 }
1795 declare i32 @llvm.x86.sse.cvtss2si(<4 x float>) nounwind readnone
1796
1797
1798 define i32 @test_x86_sse_cvttss2si(<4 x float> %a0) {
1799 ; CHECK-LABEL: test_x86_sse_cvttss2si:
1800 ; CHECK:       ## BB#0:
1801 ; CHECK-NEXT:    vcvttss2si %xmm0, %eax
1802 ; CHECK-NEXT:    retl
1803   %res = call i32 @llvm.x86.sse.cvttss2si(<4 x float> %a0) ; <i32> [#uses=1]
1804   ret i32 %res
1805 }
1806 declare i32 @llvm.x86.sse.cvttss2si(<4 x float>) nounwind readnone
1807
1808
1809 define <4 x float> @test_x86_sse_div_ss(<4 x float> %a0, <4 x float> %a1) {
1810 ; CHECK-LABEL: test_x86_sse_div_ss:
1811 ; CHECK:       ## BB#0:
1812 ; CHECK-NEXT:    vdivss %xmm1, %xmm0, %xmm0
1813 ; CHECK-NEXT:    retl
1814   %res = call <4 x float> @llvm.x86.sse.div.ss(<4 x float> %a0, <4 x float> %a1) ; <<4 x float>> [#uses=1]
1815   ret <4 x float> %res
1816 }
1817 declare <4 x float> @llvm.x86.sse.div.ss(<4 x float>, <4 x float>) nounwind readnone
1818
1819
1820 define void @test_x86_sse_ldmxcsr(i8* %a0) {
1821 ; CHECK-LABEL: test_x86_sse_ldmxcsr:
1822 ; CHECK:       ## BB#0:
1823 ; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %eax
1824 ; CHECK-NEXT:    vldmxcsr (%eax)
1825 ; CHECK-NEXT:    retl
1826   call void @llvm.x86.sse.ldmxcsr(i8* %a0)
1827   ret void
1828 }
1829 declare void @llvm.x86.sse.ldmxcsr(i8*) nounwind
1830
1831
1832
1833 define <4 x float> @test_x86_sse_max_ps(<4 x float> %a0, <4 x float> %a1) {
1834 ; CHECK-LABEL: test_x86_sse_max_ps:
1835 ; CHECK:       ## BB#0:
1836 ; CHECK-NEXT:    vmaxps %xmm1, %xmm0, %xmm0
1837 ; CHECK-NEXT:    retl
1838   %res = call <4 x float> @llvm.x86.sse.max.ps(<4 x float> %a0, <4 x float> %a1) ; <<4 x float>> [#uses=1]
1839   ret <4 x float> %res
1840 }
1841 declare <4 x float> @llvm.x86.sse.max.ps(<4 x float>, <4 x float>) nounwind readnone
1842
1843
1844 define <4 x float> @test_x86_sse_max_ss(<4 x float> %a0, <4 x float> %a1) {
1845 ; CHECK-LABEL: test_x86_sse_max_ss:
1846 ; CHECK:       ## BB#0:
1847 ; CHECK-NEXT:    vmaxss %xmm1, %xmm0, %xmm0
1848 ; CHECK-NEXT:    retl
1849   %res = call <4 x float> @llvm.x86.sse.max.ss(<4 x float> %a0, <4 x float> %a1) ; <<4 x float>> [#uses=1]
1850   ret <4 x float> %res
1851 }
1852 declare <4 x float> @llvm.x86.sse.max.ss(<4 x float>, <4 x float>) nounwind readnone
1853
1854
1855 define <4 x float> @test_x86_sse_min_ps(<4 x float> %a0, <4 x float> %a1) {
1856 ; CHECK-LABEL: test_x86_sse_min_ps:
1857 ; CHECK:       ## BB#0:
1858 ; CHECK-NEXT:    vminps %xmm1, %xmm0, %xmm0
1859 ; CHECK-NEXT:    retl
1860   %res = call <4 x float> @llvm.x86.sse.min.ps(<4 x float> %a0, <4 x float> %a1) ; <<4 x float>> [#uses=1]
1861   ret <4 x float> %res
1862 }
1863 declare <4 x float> @llvm.x86.sse.min.ps(<4 x float>, <4 x float>) nounwind readnone
1864
1865
1866 define <4 x float> @test_x86_sse_min_ss(<4 x float> %a0, <4 x float> %a1) {
1867 ; CHECK-LABEL: test_x86_sse_min_ss:
1868 ; CHECK:       ## BB#0:
1869 ; CHECK-NEXT:    vminss %xmm1, %xmm0, %xmm0
1870 ; CHECK-NEXT:    retl
1871   %res = call <4 x float> @llvm.x86.sse.min.ss(<4 x float> %a0, <4 x float> %a1) ; <<4 x float>> [#uses=1]
1872   ret <4 x float> %res
1873 }
1874 declare <4 x float> @llvm.x86.sse.min.ss(<4 x float>, <4 x float>) nounwind readnone
1875
1876
1877 define i32 @test_x86_sse_movmsk_ps(<4 x float> %a0) {
1878 ; CHECK-LABEL: test_x86_sse_movmsk_ps:
1879 ; CHECK:       ## BB#0:
1880 ; CHECK-NEXT:    vmovmskps %xmm0, %eax
1881 ; CHECK-NEXT:    retl
1882   %res = call i32 @llvm.x86.sse.movmsk.ps(<4 x float> %a0) ; <i32> [#uses=1]
1883   ret i32 %res
1884 }
1885 declare i32 @llvm.x86.sse.movmsk.ps(<4 x float>) nounwind readnone
1886
1887
1888
1889 define <4 x float> @test_x86_sse_mul_ss(<4 x float> %a0, <4 x float> %a1) {
1890 ; CHECK-LABEL: test_x86_sse_mul_ss:
1891 ; CHECK:       ## BB#0:
1892 ; CHECK-NEXT:    vmulss %xmm1, %xmm0, %xmm0
1893 ; CHECK-NEXT:    retl
1894   %res = call <4 x float> @llvm.x86.sse.mul.ss(<4 x float> %a0, <4 x float> %a1) ; <<4 x float>> [#uses=1]
1895   ret <4 x float> %res
1896 }
1897 declare <4 x float> @llvm.x86.sse.mul.ss(<4 x float>, <4 x float>) nounwind readnone
1898
1899
1900 define <4 x float> @test_x86_sse_rcp_ps(<4 x float> %a0) {
1901 ; CHECK-LABEL: test_x86_sse_rcp_ps:
1902 ; CHECK:       ## BB#0:
1903 ; CHECK-NEXT:    vrcpps %xmm0, %xmm0
1904 ; CHECK-NEXT:    retl
1905   %res = call <4 x float> @llvm.x86.sse.rcp.ps(<4 x float> %a0) ; <<4 x float>> [#uses=1]
1906   ret <4 x float> %res
1907 }
1908 declare <4 x float> @llvm.x86.sse.rcp.ps(<4 x float>) nounwind readnone
1909
1910
1911 define <4 x float> @test_x86_sse_rcp_ss(<4 x float> %a0) {
1912 ; CHECK-LABEL: test_x86_sse_rcp_ss:
1913 ; CHECK:       ## BB#0:
1914 ; CHECK-NEXT:    vrcpss %xmm0, %xmm0, %xmm0
1915 ; CHECK-NEXT:    retl
1916   %res = call <4 x float> @llvm.x86.sse.rcp.ss(<4 x float> %a0) ; <<4 x float>> [#uses=1]
1917   ret <4 x float> %res
1918 }
1919 declare <4 x float> @llvm.x86.sse.rcp.ss(<4 x float>) nounwind readnone
1920
1921
1922 define <4 x float> @test_x86_sse_rsqrt_ps(<4 x float> %a0) {
1923 ; CHECK-LABEL: test_x86_sse_rsqrt_ps:
1924 ; CHECK:       ## BB#0:
1925 ; CHECK-NEXT:    vrsqrtps %xmm0, %xmm0
1926 ; CHECK-NEXT:    retl
1927   %res = call <4 x float> @llvm.x86.sse.rsqrt.ps(<4 x float> %a0) ; <<4 x float>> [#uses=1]
1928   ret <4 x float> %res
1929 }
1930 declare <4 x float> @llvm.x86.sse.rsqrt.ps(<4 x float>) nounwind readnone
1931
1932
1933 define <4 x float> @test_x86_sse_rsqrt_ss(<4 x float> %a0) {
1934 ; CHECK-LABEL: test_x86_sse_rsqrt_ss:
1935 ; CHECK:       ## BB#0:
1936 ; CHECK-NEXT:    vrsqrtss %xmm0, %xmm0, %xmm0
1937 ; CHECK-NEXT:    retl
1938   %res = call <4 x float> @llvm.x86.sse.rsqrt.ss(<4 x float> %a0) ; <<4 x float>> [#uses=1]
1939   ret <4 x float> %res
1940 }
1941 declare <4 x float> @llvm.x86.sse.rsqrt.ss(<4 x float>) nounwind readnone
1942
1943
1944 define <4 x float> @test_x86_sse_sqrt_ps(<4 x float> %a0) {
1945 ; CHECK-LABEL: test_x86_sse_sqrt_ps:
1946 ; CHECK:       ## BB#0:
1947 ; CHECK-NEXT:    vsqrtps %xmm0, %xmm0
1948 ; CHECK-NEXT:    retl
1949   %res = call <4 x float> @llvm.x86.sse.sqrt.ps(<4 x float> %a0) ; <<4 x float>> [#uses=1]
1950   ret <4 x float> %res
1951 }
1952 declare <4 x float> @llvm.x86.sse.sqrt.ps(<4 x float>) nounwind readnone
1953
1954
1955 define <4 x float> @test_x86_sse_sqrt_ss(<4 x float> %a0) {
1956 ; CHECK-LABEL: test_x86_sse_sqrt_ss:
1957 ; CHECK:       ## BB#0:
1958 ; CHECK-NEXT:    vsqrtss %xmm0, %xmm0, %xmm0
1959 ; CHECK-NEXT:    retl
1960   %res = call <4 x float> @llvm.x86.sse.sqrt.ss(<4 x float> %a0) ; <<4 x float>> [#uses=1]
1961   ret <4 x float> %res
1962 }
1963 declare <4 x float> @llvm.x86.sse.sqrt.ss(<4 x float>) nounwind readnone
1964
1965
1966 define void @test_x86_sse_stmxcsr(i8* %a0) {
1967 ; CHECK-LABEL: test_x86_sse_stmxcsr:
1968 ; CHECK:       ## BB#0:
1969 ; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %eax
1970 ; CHECK-NEXT:    vstmxcsr (%eax)
1971 ; CHECK-NEXT:    retl
1972   call void @llvm.x86.sse.stmxcsr(i8* %a0)
1973   ret void
1974 }
1975 declare void @llvm.x86.sse.stmxcsr(i8*) nounwind
1976
1977
1978 define void @test_x86_sse_storeu_ps(i8* %a0, <4 x float> %a1) {
1979 ; CHECK-LABEL: test_x86_sse_storeu_ps:
1980 ; CHECK:       ## BB#0:
1981 ; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %eax
1982 ; CHECK-NEXT:    vmovups %xmm0, (%eax)
1983 ; CHECK-NEXT:    retl
1984   call void @llvm.x86.sse.storeu.ps(i8* %a0, <4 x float> %a1)
1985   ret void
1986 }
1987 declare void @llvm.x86.sse.storeu.ps(i8*, <4 x float>) nounwind
1988
1989
1990 define <4 x float> @test_x86_sse_sub_ss(<4 x float> %a0, <4 x float> %a1) {
1991 ; CHECK-LABEL: test_x86_sse_sub_ss:
1992 ; CHECK:       ## BB#0:
1993 ; CHECK-NEXT:    vsubss %xmm1, %xmm0, %xmm0
1994 ; CHECK-NEXT:    retl
1995   %res = call <4 x float> @llvm.x86.sse.sub.ss(<4 x float> %a0, <4 x float> %a1) ; <<4 x float>> [#uses=1]
1996   ret <4 x float> %res
1997 }
1998 declare <4 x float> @llvm.x86.sse.sub.ss(<4 x float>, <4 x float>) nounwind readnone
1999
2000
2001 define i32 @test_x86_sse_ucomieq_ss(<4 x float> %a0, <4 x float> %a1) {
2002 ; CHECK-LABEL: test_x86_sse_ucomieq_ss:
2003 ; CHECK:       ## BB#0:
2004 ; CHECK-NEXT:    vucomiss %xmm1, %xmm0
2005 ; CHECK-NEXT:    sete %al
2006 ; CHECK-NEXT:    movzbl %al, %eax
2007 ; CHECK-NEXT:    retl
2008   %res = call i32 @llvm.x86.sse.ucomieq.ss(<4 x float> %a0, <4 x float> %a1) ; <i32> [#uses=1]
2009   ret i32 %res
2010 }
2011 declare i32 @llvm.x86.sse.ucomieq.ss(<4 x float>, <4 x float>) nounwind readnone
2012
2013
2014 define i32 @test_x86_sse_ucomige_ss(<4 x float> %a0, <4 x float> %a1) {
2015 ; CHECK-LABEL: test_x86_sse_ucomige_ss:
2016 ; CHECK:       ## BB#0:
2017 ; CHECK-NEXT:    vucomiss %xmm1, %xmm0
2018 ; CHECK-NEXT:    setae %al
2019 ; CHECK-NEXT:    movzbl %al, %eax
2020 ; CHECK-NEXT:    retl
2021   %res = call i32 @llvm.x86.sse.ucomige.ss(<4 x float> %a0, <4 x float> %a1) ; <i32> [#uses=1]
2022   ret i32 %res
2023 }
2024 declare i32 @llvm.x86.sse.ucomige.ss(<4 x float>, <4 x float>) nounwind readnone
2025
2026
2027 define i32 @test_x86_sse_ucomigt_ss(<4 x float> %a0, <4 x float> %a1) {
2028 ; CHECK-LABEL: test_x86_sse_ucomigt_ss:
2029 ; CHECK:       ## BB#0:
2030 ; CHECK-NEXT:    vucomiss %xmm1, %xmm0
2031 ; CHECK-NEXT:    seta %al
2032 ; CHECK-NEXT:    movzbl %al, %eax
2033 ; CHECK-NEXT:    retl
2034   %res = call i32 @llvm.x86.sse.ucomigt.ss(<4 x float> %a0, <4 x float> %a1) ; <i32> [#uses=1]
2035   ret i32 %res
2036 }
2037 declare i32 @llvm.x86.sse.ucomigt.ss(<4 x float>, <4 x float>) nounwind readnone
2038
2039
2040 define i32 @test_x86_sse_ucomile_ss(<4 x float> %a0, <4 x float> %a1) {
2041 ; CHECK-LABEL: test_x86_sse_ucomile_ss:
2042 ; CHECK:       ## BB#0:
2043 ; CHECK-NEXT:    vucomiss %xmm1, %xmm0
2044 ; CHECK-NEXT:    setbe %al
2045 ; CHECK-NEXT:    movzbl %al, %eax
2046 ; CHECK-NEXT:    retl
2047   %res = call i32 @llvm.x86.sse.ucomile.ss(<4 x float> %a0, <4 x float> %a1) ; <i32> [#uses=1]
2048   ret i32 %res
2049 }
2050 declare i32 @llvm.x86.sse.ucomile.ss(<4 x float>, <4 x float>) nounwind readnone
2051
2052
2053 define i32 @test_x86_sse_ucomilt_ss(<4 x float> %a0, <4 x float> %a1) {
2054 ; CHECK-LABEL: test_x86_sse_ucomilt_ss:
2055 ; CHECK:       ## BB#0:
2056 ; CHECK-NEXT:    vucomiss %xmm1, %xmm0
2057 ; CHECK-NEXT:    sbbl %eax, %eax
2058 ; CHECK-NEXT:    andl $1, %eax
2059 ; CHECK-NEXT:    retl
2060   %res = call i32 @llvm.x86.sse.ucomilt.ss(<4 x float> %a0, <4 x float> %a1) ; <i32> [#uses=1]
2061   ret i32 %res
2062 }
2063 declare i32 @llvm.x86.sse.ucomilt.ss(<4 x float>, <4 x float>) nounwind readnone
2064
2065
2066 define i32 @test_x86_sse_ucomineq_ss(<4 x float> %a0, <4 x float> %a1) {
2067 ; CHECK-LABEL: test_x86_sse_ucomineq_ss:
2068 ; CHECK:       ## BB#0:
2069 ; CHECK-NEXT:    vucomiss %xmm1, %xmm0
2070 ; CHECK-NEXT:    setne %al
2071 ; CHECK-NEXT:    movzbl %al, %eax
2072 ; CHECK-NEXT:    retl
2073   %res = call i32 @llvm.x86.sse.ucomineq.ss(<4 x float> %a0, <4 x float> %a1) ; <i32> [#uses=1]
2074   ret i32 %res
2075 }
2076 declare i32 @llvm.x86.sse.ucomineq.ss(<4 x float>, <4 x float>) nounwind readnone
2077
2078
2079 define <16 x i8> @test_x86_ssse3_pabs_b_128(<16 x i8> %a0) {
2080 ; CHECK-LABEL: test_x86_ssse3_pabs_b_128:
2081 ; CHECK:       ## BB#0:
2082 ; CHECK-NEXT:    vpabsb %xmm0, %xmm0
2083 ; CHECK-NEXT:    retl
2084   %res = call <16 x i8> @llvm.x86.ssse3.pabs.b.128(<16 x i8> %a0) ; <<16 x i8>> [#uses=1]
2085   ret <16 x i8> %res
2086 }
2087 declare <16 x i8> @llvm.x86.ssse3.pabs.b.128(<16 x i8>) nounwind readnone
2088
2089
2090 define <4 x i32> @test_x86_ssse3_pabs_d_128(<4 x i32> %a0) {
2091 ; CHECK-LABEL: test_x86_ssse3_pabs_d_128:
2092 ; CHECK:       ## BB#0:
2093 ; CHECK-NEXT:    vpabsd %xmm0, %xmm0
2094 ; CHECK-NEXT:    retl
2095   %res = call <4 x i32> @llvm.x86.ssse3.pabs.d.128(<4 x i32> %a0) ; <<4 x i32>> [#uses=1]
2096   ret <4 x i32> %res
2097 }
2098 declare <4 x i32> @llvm.x86.ssse3.pabs.d.128(<4 x i32>) nounwind readnone
2099
2100
2101 define <8 x i16> @test_x86_ssse3_pabs_w_128(<8 x i16> %a0) {
2102 ; CHECK-LABEL: test_x86_ssse3_pabs_w_128:
2103 ; CHECK:       ## BB#0:
2104 ; CHECK-NEXT:    vpabsw %xmm0, %xmm0
2105 ; CHECK-NEXT:    retl
2106   %res = call <8 x i16> @llvm.x86.ssse3.pabs.w.128(<8 x i16> %a0) ; <<8 x i16>> [#uses=1]
2107   ret <8 x i16> %res
2108 }
2109 declare <8 x i16> @llvm.x86.ssse3.pabs.w.128(<8 x i16>) nounwind readnone
2110
2111
2112 define <4 x i32> @test_x86_ssse3_phadd_d_128(<4 x i32> %a0, <4 x i32> %a1) {
2113 ; CHECK-LABEL: test_x86_ssse3_phadd_d_128:
2114 ; CHECK:       ## BB#0:
2115 ; CHECK-NEXT:    vphaddd %xmm1, %xmm0, %xmm0
2116 ; CHECK-NEXT:    retl
2117   %res = call <4 x i32> @llvm.x86.ssse3.phadd.d.128(<4 x i32> %a0, <4 x i32> %a1) ; <<4 x i32>> [#uses=1]
2118   ret <4 x i32> %res
2119 }
2120 declare <4 x i32> @llvm.x86.ssse3.phadd.d.128(<4 x i32>, <4 x i32>) nounwind readnone
2121
2122
2123 define <8 x i16> @test_x86_ssse3_phadd_sw_128(<8 x i16> %a0, <8 x i16> %a1) {
2124 ; CHECK-LABEL: test_x86_ssse3_phadd_sw_128:
2125 ; CHECK:       ## BB#0:
2126 ; CHECK-NEXT:    vphaddsw %xmm1, %xmm0, %xmm0
2127 ; CHECK-NEXT:    retl
2128   %res = call <8 x i16> @llvm.x86.ssse3.phadd.sw.128(<8 x i16> %a0, <8 x i16> %a1) ; <<8 x i16>> [#uses=1]
2129   ret <8 x i16> %res
2130 }
2131 declare <8 x i16> @llvm.x86.ssse3.phadd.sw.128(<8 x i16>, <8 x i16>) nounwind readnone
2132
2133
2134 define <8 x i16> @test_x86_ssse3_phadd_w_128(<8 x i16> %a0, <8 x i16> %a1) {
2135 ; CHECK-LABEL: test_x86_ssse3_phadd_w_128:
2136 ; CHECK:       ## BB#0:
2137 ; CHECK-NEXT:    vphaddw %xmm1, %xmm0, %xmm0
2138 ; CHECK-NEXT:    retl
2139   %res = call <8 x i16> @llvm.x86.ssse3.phadd.w.128(<8 x i16> %a0, <8 x i16> %a1) ; <<8 x i16>> [#uses=1]
2140   ret <8 x i16> %res
2141 }
2142 declare <8 x i16> @llvm.x86.ssse3.phadd.w.128(<8 x i16>, <8 x i16>) nounwind readnone
2143
2144
2145 define <4 x i32> @test_x86_ssse3_phsub_d_128(<4 x i32> %a0, <4 x i32> %a1) {
2146 ; CHECK-LABEL: test_x86_ssse3_phsub_d_128:
2147 ; CHECK:       ## BB#0:
2148 ; CHECK-NEXT:    vphsubd %xmm1, %xmm0, %xmm0
2149 ; CHECK-NEXT:    retl
2150   %res = call <4 x i32> @llvm.x86.ssse3.phsub.d.128(<4 x i32> %a0, <4 x i32> %a1) ; <<4 x i32>> [#uses=1]
2151   ret <4 x i32> %res
2152 }
2153 declare <4 x i32> @llvm.x86.ssse3.phsub.d.128(<4 x i32>, <4 x i32>) nounwind readnone
2154
2155
2156 define <8 x i16> @test_x86_ssse3_phsub_sw_128(<8 x i16> %a0, <8 x i16> %a1) {
2157 ; CHECK-LABEL: test_x86_ssse3_phsub_sw_128:
2158 ; CHECK:       ## BB#0:
2159 ; CHECK-NEXT:    vphsubsw %xmm1, %xmm0, %xmm0
2160 ; CHECK-NEXT:    retl
2161   %res = call <8 x i16> @llvm.x86.ssse3.phsub.sw.128(<8 x i16> %a0, <8 x i16> %a1) ; <<8 x i16>> [#uses=1]
2162   ret <8 x i16> %res
2163 }
2164 declare <8 x i16> @llvm.x86.ssse3.phsub.sw.128(<8 x i16>, <8 x i16>) nounwind readnone
2165
2166
2167 define <8 x i16> @test_x86_ssse3_phsub_w_128(<8 x i16> %a0, <8 x i16> %a1) {
2168 ; CHECK-LABEL: test_x86_ssse3_phsub_w_128:
2169 ; CHECK:       ## BB#0:
2170 ; CHECK-NEXT:    vphsubw %xmm1, %xmm0, %xmm0
2171 ; CHECK-NEXT:    retl
2172   %res = call <8 x i16> @llvm.x86.ssse3.phsub.w.128(<8 x i16> %a0, <8 x i16> %a1) ; <<8 x i16>> [#uses=1]
2173   ret <8 x i16> %res
2174 }
2175 declare <8 x i16> @llvm.x86.ssse3.phsub.w.128(<8 x i16>, <8 x i16>) nounwind readnone
2176
2177
2178 define <8 x i16> @test_x86_ssse3_pmadd_ub_sw_128(<16 x i8> %a0, <16 x i8> %a1) {
2179 ; CHECK-LABEL: test_x86_ssse3_pmadd_ub_sw_128:
2180 ; CHECK:       ## BB#0:
2181 ; CHECK-NEXT:    vpmaddubsw %xmm1, %xmm0, %xmm0
2182 ; CHECK-NEXT:    retl
2183   %res = call <8 x i16> @llvm.x86.ssse3.pmadd.ub.sw.128(<16 x i8> %a0, <16 x i8> %a1) ; <<8 x i16>> [#uses=1]
2184   ret <8 x i16> %res
2185 }
2186 declare <8 x i16> @llvm.x86.ssse3.pmadd.ub.sw.128(<16 x i8>, <16 x i8>) nounwind readnone
2187
2188
2189 define <8 x i16> @test_x86_ssse3_pmul_hr_sw_128(<8 x i16> %a0, <8 x i16> %a1) {
2190 ; CHECK-LABEL: test_x86_ssse3_pmul_hr_sw_128:
2191 ; CHECK:       ## BB#0:
2192 ; CHECK-NEXT:    vpmulhrsw %xmm1, %xmm0, %xmm0
2193 ; CHECK-NEXT:    retl
2194   %res = call <8 x i16> @llvm.x86.ssse3.pmul.hr.sw.128(<8 x i16> %a0, <8 x i16> %a1) ; <<8 x i16>> [#uses=1]
2195   ret <8 x i16> %res
2196 }
2197 declare <8 x i16> @llvm.x86.ssse3.pmul.hr.sw.128(<8 x i16>, <8 x i16>) nounwind readnone
2198
2199
2200 define <16 x i8> @test_x86_ssse3_pshuf_b_128(<16 x i8> %a0, <16 x i8> %a1) {
2201 ; CHECK-LABEL: test_x86_ssse3_pshuf_b_128:
2202 ; CHECK:       ## BB#0:
2203 ; CHECK-NEXT:    vpshufb %xmm1, %xmm0, %xmm0
2204 ; CHECK-NEXT:    retl
2205   %res = call <16 x i8> @llvm.x86.ssse3.pshuf.b.128(<16 x i8> %a0, <16 x i8> %a1) ; <<16 x i8>> [#uses=1]
2206   ret <16 x i8> %res
2207 }
2208 declare <16 x i8> @llvm.x86.ssse3.pshuf.b.128(<16 x i8>, <16 x i8>) nounwind readnone
2209
2210
2211 define <16 x i8> @test_x86_ssse3_psign_b_128(<16 x i8> %a0, <16 x i8> %a1) {
2212 ; CHECK-LABEL: test_x86_ssse3_psign_b_128:
2213 ; CHECK:       ## BB#0:
2214 ; CHECK-NEXT:    vpsignb %xmm1, %xmm0, %xmm0
2215 ; CHECK-NEXT:    retl
2216   %res = call <16 x i8> @llvm.x86.ssse3.psign.b.128(<16 x i8> %a0, <16 x i8> %a1) ; <<16 x i8>> [#uses=1]
2217   ret <16 x i8> %res
2218 }
2219 declare <16 x i8> @llvm.x86.ssse3.psign.b.128(<16 x i8>, <16 x i8>) nounwind readnone
2220
2221
2222 define <4 x i32> @test_x86_ssse3_psign_d_128(<4 x i32> %a0, <4 x i32> %a1) {
2223 ; CHECK-LABEL: test_x86_ssse3_psign_d_128:
2224 ; CHECK:       ## BB#0:
2225 ; CHECK-NEXT:    vpsignd %xmm1, %xmm0, %xmm0
2226 ; CHECK-NEXT:    retl
2227   %res = call <4 x i32> @llvm.x86.ssse3.psign.d.128(<4 x i32> %a0, <4 x i32> %a1) ; <<4 x i32>> [#uses=1]
2228   ret <4 x i32> %res
2229 }
2230 declare <4 x i32> @llvm.x86.ssse3.psign.d.128(<4 x i32>, <4 x i32>) nounwind readnone
2231
2232
2233 define <8 x i16> @test_x86_ssse3_psign_w_128(<8 x i16> %a0, <8 x i16> %a1) {
2234 ; CHECK-LABEL: test_x86_ssse3_psign_w_128:
2235 ; CHECK:       ## BB#0:
2236 ; CHECK-NEXT:    vpsignw %xmm1, %xmm0, %xmm0
2237 ; CHECK-NEXT:    retl
2238   %res = call <8 x i16> @llvm.x86.ssse3.psign.w.128(<8 x i16> %a0, <8 x i16> %a1) ; <<8 x i16>> [#uses=1]
2239   ret <8 x i16> %res
2240 }
2241 declare <8 x i16> @llvm.x86.ssse3.psign.w.128(<8 x i16>, <8 x i16>) nounwind readnone
2242
2243
2244 define <4 x double> @test_x86_avx_addsub_pd_256(<4 x double> %a0, <4 x double> %a1) {
2245 ; CHECK-LABEL: test_x86_avx_addsub_pd_256:
2246 ; CHECK:       ## BB#0:
2247 ; CHECK-NEXT:    vaddsubpd %ymm1, %ymm0, %ymm0
2248 ; CHECK-NEXT:    retl
2249   %res = call <4 x double> @llvm.x86.avx.addsub.pd.256(<4 x double> %a0, <4 x double> %a1) ; <<4 x double>> [#uses=1]
2250   ret <4 x double> %res
2251 }
2252 declare <4 x double> @llvm.x86.avx.addsub.pd.256(<4 x double>, <4 x double>) nounwind readnone
2253
2254
2255 define <8 x float> @test_x86_avx_addsub_ps_256(<8 x float> %a0, <8 x float> %a1) {
2256 ; CHECK-LABEL: test_x86_avx_addsub_ps_256:
2257 ; CHECK:       ## BB#0:
2258 ; CHECK-NEXT:    vaddsubps %ymm1, %ymm0, %ymm0
2259 ; CHECK-NEXT:    retl
2260   %res = call <8 x float> @llvm.x86.avx.addsub.ps.256(<8 x float> %a0, <8 x float> %a1) ; <<8 x float>> [#uses=1]
2261   ret <8 x float> %res
2262 }
2263 declare <8 x float> @llvm.x86.avx.addsub.ps.256(<8 x float>, <8 x float>) nounwind readnone
2264
2265
2266 define <4 x double> @test_x86_avx_blendv_pd_256(<4 x double> %a0, <4 x double> %a1, <4 x double> %a2) {
2267 ; CHECK-LABEL: test_x86_avx_blendv_pd_256:
2268 ; CHECK:       ## BB#0:
2269 ; CHECK-NEXT:    vblendvpd %ymm2, %ymm1, %ymm0, %ymm0
2270 ; CHECK-NEXT:    retl
2271   %res = call <4 x double> @llvm.x86.avx.blendv.pd.256(<4 x double> %a0, <4 x double> %a1, <4 x double> %a2) ; <<4 x double>> [#uses=1]
2272   ret <4 x double> %res
2273 }
2274 declare <4 x double> @llvm.x86.avx.blendv.pd.256(<4 x double>, <4 x double>, <4 x double>) nounwind readnone
2275
2276
2277 define <8 x float> @test_x86_avx_blendv_ps_256(<8 x float> %a0, <8 x float> %a1, <8 x float> %a2) {
2278 ; CHECK-LABEL: test_x86_avx_blendv_ps_256:
2279 ; CHECK:       ## BB#0:
2280 ; CHECK-NEXT:    vblendvps %ymm2, %ymm1, %ymm0, %ymm0
2281 ; CHECK-NEXT:    retl
2282   %res = call <8 x float> @llvm.x86.avx.blendv.ps.256(<8 x float> %a0, <8 x float> %a1, <8 x float> %a2) ; <<8 x float>> [#uses=1]
2283   ret <8 x float> %res
2284 }
2285 declare <8 x float> @llvm.x86.avx.blendv.ps.256(<8 x float>, <8 x float>, <8 x float>) nounwind readnone
2286
2287
2288 define <4 x double> @test_x86_avx_cmp_pd_256(<4 x double> %a0, <4 x double> %a1) {
2289 ; CHECK-LABEL: test_x86_avx_cmp_pd_256:
2290 ; CHECK:       ## BB#0:
2291 ; CHECK-NEXT:    vcmpordpd %ymm1, %ymm0, %ymm0
2292 ; CHECK-NEXT:    retl
2293   %res = call <4 x double> @llvm.x86.avx.cmp.pd.256(<4 x double> %a0, <4 x double> %a1, i8 7) ; <<4 x double>> [#uses=1]
2294   ret <4 x double> %res
2295 }
2296 declare <4 x double> @llvm.x86.avx.cmp.pd.256(<4 x double>, <4 x double>, i8) nounwind readnone
2297
2298
2299 define <8 x float> @test_x86_avx_cmp_ps_256(<8 x float> %a0, <8 x float> %a1) {
2300 ; CHECK-LABEL: test_x86_avx_cmp_ps_256:
2301 ; CHECK:       ## BB#0:
2302 ; CHECK-NEXT:    vcmpordps %ymm1, %ymm0, %ymm0
2303 ; CHECK-NEXT:    retl
2304   %res = call <8 x float> @llvm.x86.avx.cmp.ps.256(<8 x float> %a0, <8 x float> %a1, i8 7) ; <<8 x float>> [#uses=1]
2305   ret <8 x float> %res
2306 }
2307
2308 define <8 x float> @test_x86_avx_cmp_ps_256_pseudo_op(<8 x float> %a0, <8 x float> %a1) {
2309 ; CHECK-LABEL: test_x86_avx_cmp_ps_256_pseudo_op:
2310 ; CHECK:       ## BB#0:
2311 ; CHECK-NEXT:    vcmpeqps %ymm1, %ymm0, %ymm1
2312 ; CHECK-NEXT:    vcmpltps %ymm1, %ymm0, %ymm1
2313 ; CHECK-NEXT:    vcmpleps %ymm1, %ymm0, %ymm1
2314 ; CHECK-NEXT:    vcmpunordps %ymm1, %ymm0, %ymm1
2315 ; CHECK-NEXT:    vcmpneqps %ymm1, %ymm0, %ymm1
2316 ; CHECK-NEXT:    vcmpnltps %ymm1, %ymm0, %ymm1
2317 ; CHECK-NEXT:    vcmpnleps %ymm1, %ymm0, %ymm1
2318 ; CHECK-NEXT:    vcmpordps %ymm1, %ymm0, %ymm1
2319 ; CHECK-NEXT:    vcmpeq_uqps %ymm1, %ymm0, %ymm1
2320 ; CHECK-NEXT:    vcmpngeps %ymm1, %ymm0, %ymm1
2321 ; CHECK-NEXT:    vcmpngtps %ymm1, %ymm0, %ymm1
2322 ; CHECK-NEXT:    vcmpfalseps %ymm1, %ymm0, %ymm1
2323 ; CHECK-NEXT:    vcmpneq_oqps %ymm1, %ymm0, %ymm1
2324 ; CHECK-NEXT:    vcmpgeps %ymm1, %ymm0, %ymm1
2325 ; CHECK-NEXT:    vcmpgtps %ymm1, %ymm0, %ymm1
2326 ; CHECK-NEXT:    vcmptrueps %ymm1, %ymm0, %ymm1
2327 ; CHECK-NEXT:    vcmpeq_osps %ymm1, %ymm0, %ymm1
2328 ; CHECK-NEXT:    vcmplt_oqps %ymm1, %ymm0, %ymm1
2329 ; CHECK-NEXT:    vcmple_oqps %ymm1, %ymm0, %ymm1
2330 ; CHECK-NEXT:    vcmpunord_sps %ymm1, %ymm0, %ymm1
2331 ; CHECK-NEXT:    vcmpneq_usps %ymm1, %ymm0, %ymm1
2332 ; CHECK-NEXT:    vcmpnlt_uqps %ymm1, %ymm0, %ymm1
2333 ; CHECK-NEXT:    vcmpnle_uqps %ymm1, %ymm0, %ymm1
2334 ; CHECK-NEXT:    vcmpord_sps %ymm1, %ymm0, %ymm1
2335 ; CHECK-NEXT:    vcmpeq_usps %ymm1, %ymm0, %ymm1
2336 ; CHECK-NEXT:    vcmpnge_uqps %ymm1, %ymm0, %ymm1
2337 ; CHECK-NEXT:    vcmpngt_uqps %ymm1, %ymm0, %ymm1
2338 ; CHECK-NEXT:    vcmpfalse_osps %ymm1, %ymm0, %ymm1
2339 ; CHECK-NEXT:    vcmpneq_osps %ymm1, %ymm0, %ymm1
2340 ; CHECK-NEXT:    vcmpge_oqps %ymm1, %ymm0, %ymm1
2341 ; CHECK-NEXT:    vcmpgt_oqps %ymm1, %ymm0, %ymm1
2342 ; CHECK-NEXT:    vcmptrue_usps %ymm1, %ymm0, %ymm0
2343 ; CHECK-NEXT:    retl
2344   %a2 = call <8 x float> @llvm.x86.avx.cmp.ps.256(<8 x float> %a0, <8 x float> %a1, i8 0) ; <<8 x float>> [#uses=1]
2345   %a3 = call <8 x float> @llvm.x86.avx.cmp.ps.256(<8 x float> %a0, <8 x float> %a2, i8 1) ; <<8 x float>> [#uses=1]
2346   %a4 = call <8 x float> @llvm.x86.avx.cmp.ps.256(<8 x float> %a0, <8 x float> %a3, i8 2) ; <<8 x float>> [#uses=1]
2347   %a5 = call <8 x float> @llvm.x86.avx.cmp.ps.256(<8 x float> %a0, <8 x float> %a4, i8 3) ; <<8 x float>> [#uses=1]
2348   %a6 = call <8 x float> @llvm.x86.avx.cmp.ps.256(<8 x float> %a0, <8 x float> %a5, i8 4) ; <<8 x float>> [#uses=1]
2349   %a7 = call <8 x float> @llvm.x86.avx.cmp.ps.256(<8 x float> %a0, <8 x float> %a6, i8 5) ; <<8 x float>> [#uses=1]
2350   %a8 = call <8 x float> @llvm.x86.avx.cmp.ps.256(<8 x float> %a0, <8 x float> %a7, i8 6) ; <<8 x float>> [#uses=1]
2351   %a9 = call <8 x float> @llvm.x86.avx.cmp.ps.256(<8 x float> %a0, <8 x float> %a8, i8 7) ; <<8 x float>> [#uses=1]
2352   %a10 = call <8 x float> @llvm.x86.avx.cmp.ps.256(<8 x float> %a0, <8 x float> %a9, i8 8) ; <<8 x float>> [#uses=1]
2353   %a11 = call <8 x float> @llvm.x86.avx.cmp.ps.256(<8 x float> %a0, <8 x float> %a10, i8 9) ; <<8 x float>> [#uses=1]
2354   %a12 = call <8 x float> @llvm.x86.avx.cmp.ps.256(<8 x float> %a0, <8 x float> %a11, i8 10) ; <<8 x float>> [#uses=1]
2355   %a13 = call <8 x float> @llvm.x86.avx.cmp.ps.256(<8 x float> %a0, <8 x float> %a12, i8 11) ; <<8 x float>> [#uses=1]
2356   %a14 = call <8 x float> @llvm.x86.avx.cmp.ps.256(<8 x float> %a0, <8 x float> %a13, i8 12) ; <<8 x float>> [#uses=1]
2357   %a15 = call <8 x float> @llvm.x86.avx.cmp.ps.256(<8 x float> %a0, <8 x float> %a14, i8 13) ; <<8 x float>> [#uses=1]
2358   %a16 = call <8 x float> @llvm.x86.avx.cmp.ps.256(<8 x float> %a0, <8 x float> %a15, i8 14) ; <<8 x float>> [#uses=1]
2359   %a17 = call <8 x float> @llvm.x86.avx.cmp.ps.256(<8 x float> %a0, <8 x float> %a16, i8 15) ; <<8 x float>> [#uses=1]
2360   %a18 = call <8 x float> @llvm.x86.avx.cmp.ps.256(<8 x float> %a0, <8 x float> %a17, i8 16) ; <<8 x float>> [#uses=1]
2361   %a19 = call <8 x float> @llvm.x86.avx.cmp.ps.256(<8 x float> %a0, <8 x float> %a18, i8 17) ; <<8 x float>> [#uses=1]
2362   %a20 = call <8 x float> @llvm.x86.avx.cmp.ps.256(<8 x float> %a0, <8 x float> %a19, i8 18) ; <<8 x float>> [#uses=1]
2363   %a21 = call <8 x float> @llvm.x86.avx.cmp.ps.256(<8 x float> %a0, <8 x float> %a20, i8 19) ; <<8 x float>> [#uses=1]
2364   %a22 = call <8 x float> @llvm.x86.avx.cmp.ps.256(<8 x float> %a0, <8 x float> %a21, i8 20) ; <<8 x float>> [#uses=1]
2365   %a23 = call <8 x float> @llvm.x86.avx.cmp.ps.256(<8 x float> %a0, <8 x float> %a22, i8 21) ; <<8 x float>> [#uses=1]
2366   %a24 = call <8 x float> @llvm.x86.avx.cmp.ps.256(<8 x float> %a0, <8 x float> %a23, i8 22) ; <<8 x float>> [#uses=1]
2367   %a25 = call <8 x float> @llvm.x86.avx.cmp.ps.256(<8 x float> %a0, <8 x float> %a24, i8 23) ; <<8 x float>> [#uses=1]
2368   %a26 = call <8 x float> @llvm.x86.avx.cmp.ps.256(<8 x float> %a0, <8 x float> %a25, i8 24) ; <<8 x float>> [#uses=1]
2369   %a27 = call <8 x float> @llvm.x86.avx.cmp.ps.256(<8 x float> %a0, <8 x float> %a26, i8 25) ; <<8 x float>> [#uses=1]
2370   %a28 = call <8 x float> @llvm.x86.avx.cmp.ps.256(<8 x float> %a0, <8 x float> %a27, i8 26) ; <<8 x float>> [#uses=1]
2371   %a29 = call <8 x float> @llvm.x86.avx.cmp.ps.256(<8 x float> %a0, <8 x float> %a28, i8 27) ; <<8 x float>> [#uses=1]
2372   %a30 = call <8 x float> @llvm.x86.avx.cmp.ps.256(<8 x float> %a0, <8 x float> %a29, i8 28) ; <<8 x float>> [#uses=1]
2373   %a31 = call <8 x float> @llvm.x86.avx.cmp.ps.256(<8 x float> %a0, <8 x float> %a30, i8 29) ; <<8 x float>> [#uses=1]
2374   %a32 = call <8 x float> @llvm.x86.avx.cmp.ps.256(<8 x float> %a0, <8 x float> %a31, i8 30) ; <<8 x float>> [#uses=1]
2375   %res = call <8 x float> @llvm.x86.avx.cmp.ps.256(<8 x float> %a0, <8 x float> %a32, i8 31) ; <<8 x float>> [#uses=1]
2376   ret <8 x float> %res
2377 }
2378 declare <8 x float> @llvm.x86.avx.cmp.ps.256(<8 x float>, <8 x float>, i8) nounwind readnone
2379
2380
2381 define <4 x float> @test_x86_avx_cvt_pd2_ps_256(<4 x double> %a0) {
2382 ; CHECK-LABEL: test_x86_avx_cvt_pd2_ps_256:
2383 ; CHECK:       ## BB#0:
2384 ; CHECK-NEXT:    vcvtpd2psy %ymm0, %xmm0
2385 ; CHECK-NEXT:    vzeroupper
2386 ; CHECK-NEXT:    retl
2387   %res = call <4 x float> @llvm.x86.avx.cvt.pd2.ps.256(<4 x double> %a0) ; <<4 x float>> [#uses=1]
2388   ret <4 x float> %res
2389 }
2390 declare <4 x float> @llvm.x86.avx.cvt.pd2.ps.256(<4 x double>) nounwind readnone
2391
2392
2393 define <4 x i32> @test_x86_avx_cvt_pd2dq_256(<4 x double> %a0) {
2394 ; CHECK-LABEL: test_x86_avx_cvt_pd2dq_256:
2395 ; CHECK:       ## BB#0:
2396 ; CHECK-NEXT:    vcvtpd2dqy %ymm0, %xmm0
2397 ; CHECK-NEXT:    vzeroupper
2398 ; CHECK-NEXT:    retl
2399   %res = call <4 x i32> @llvm.x86.avx.cvt.pd2dq.256(<4 x double> %a0) ; <<4 x i32>> [#uses=1]
2400   ret <4 x i32> %res
2401 }
2402 declare <4 x i32> @llvm.x86.avx.cvt.pd2dq.256(<4 x double>) nounwind readnone
2403
2404
2405 define <4 x double> @test_x86_avx_cvt_ps2_pd_256(<4 x float> %a0) {
2406 ; CHECK-LABEL: test_x86_avx_cvt_ps2_pd_256:
2407 ; CHECK:       ## BB#0:
2408 ; CHECK-NEXT:    vcvtps2pd %xmm0, %ymm0
2409 ; CHECK-NEXT:    retl
2410   %res = call <4 x double> @llvm.x86.avx.cvt.ps2.pd.256(<4 x float> %a0) ; <<4 x double>> [#uses=1]
2411   ret <4 x double> %res
2412 }
2413 declare <4 x double> @llvm.x86.avx.cvt.ps2.pd.256(<4 x float>) nounwind readnone
2414
2415
2416 define <8 x i32> @test_x86_avx_cvt_ps2dq_256(<8 x float> %a0) {
2417 ; CHECK-LABEL: test_x86_avx_cvt_ps2dq_256:
2418 ; CHECK:       ## BB#0:
2419 ; CHECK-NEXT:    vcvtps2dq %ymm0, %ymm0
2420 ; CHECK-NEXT:    retl
2421   %res = call <8 x i32> @llvm.x86.avx.cvt.ps2dq.256(<8 x float> %a0) ; <<8 x i32>> [#uses=1]
2422   ret <8 x i32> %res
2423 }
2424 declare <8 x i32> @llvm.x86.avx.cvt.ps2dq.256(<8 x float>) nounwind readnone
2425
2426
2427 define <4 x double> @test_x86_avx_cvtdq2_pd_256(<4 x i32> %a0) {
2428 ; CHECK-LABEL: test_x86_avx_cvtdq2_pd_256:
2429 ; CHECK:       ## BB#0:
2430 ; CHECK-NEXT:    vcvtdq2pd %xmm0, %ymm0
2431 ; CHECK-NEXT:    retl
2432   %res = call <4 x double> @llvm.x86.avx.cvtdq2.pd.256(<4 x i32> %a0) ; <<4 x double>> [#uses=1]
2433   ret <4 x double> %res
2434 }
2435 declare <4 x double> @llvm.x86.avx.cvtdq2.pd.256(<4 x i32>) nounwind readnone
2436
2437
2438 define <8 x float> @test_x86_avx_cvtdq2_ps_256(<8 x i32> %a0) {
2439 ; CHECK-LABEL: test_x86_avx_cvtdq2_ps_256:
2440 ; CHECK:       ## BB#0:
2441 ; CHECK-NEXT:    vcvtdq2ps %ymm0, %ymm0
2442 ; CHECK-NEXT:    retl
2443   %res = call <8 x float> @llvm.x86.avx.cvtdq2.ps.256(<8 x i32> %a0) ; <<8 x float>> [#uses=1]
2444   ret <8 x float> %res
2445 }
2446 declare <8 x float> @llvm.x86.avx.cvtdq2.ps.256(<8 x i32>) nounwind readnone
2447
2448
2449 define <4 x i32> @test_x86_avx_cvtt_pd2dq_256(<4 x double> %a0) {
2450 ; CHECK-LABEL: test_x86_avx_cvtt_pd2dq_256:
2451 ; CHECK:       ## BB#0:
2452 ; CHECK-NEXT:    vcvttpd2dqy %ymm0, %xmm0
2453 ; CHECK-NEXT:    vzeroupper
2454 ; CHECK-NEXT:    retl
2455   %res = call <4 x i32> @llvm.x86.avx.cvtt.pd2dq.256(<4 x double> %a0) ; <<4 x i32>> [#uses=1]
2456   ret <4 x i32> %res
2457 }
2458 declare <4 x i32> @llvm.x86.avx.cvtt.pd2dq.256(<4 x double>) nounwind readnone
2459
2460
2461 define <8 x i32> @test_x86_avx_cvtt_ps2dq_256(<8 x float> %a0) {
2462 ; CHECK-LABEL: test_x86_avx_cvtt_ps2dq_256:
2463 ; CHECK:       ## BB#0:
2464 ; CHECK-NEXT:    vcvttps2dq %ymm0, %ymm0
2465 ; CHECK-NEXT:    retl
2466   %res = call <8 x i32> @llvm.x86.avx.cvtt.ps2dq.256(<8 x float> %a0) ; <<8 x i32>> [#uses=1]
2467   ret <8 x i32> %res
2468 }
2469 declare <8 x i32> @llvm.x86.avx.cvtt.ps2dq.256(<8 x float>) nounwind readnone
2470
2471
2472 define <8 x float> @test_x86_avx_dp_ps_256(<8 x float> %a0, <8 x float> %a1) {
2473 ; CHECK-LABEL: test_x86_avx_dp_ps_256:
2474 ; CHECK:       ## BB#0:
2475 ; CHECK-NEXT:    vdpps $7, %ymm1, %ymm0, %ymm0
2476 ; CHECK-NEXT:    retl
2477   %res = call <8 x float> @llvm.x86.avx.dp.ps.256(<8 x float> %a0, <8 x float> %a1, i8 7) ; <<8 x float>> [#uses=1]
2478   ret <8 x float> %res
2479 }
2480 declare <8 x float> @llvm.x86.avx.dp.ps.256(<8 x float>, <8 x float>, i8) nounwind readnone
2481
2482
2483 define <4 x double> @test_x86_avx_hadd_pd_256(<4 x double> %a0, <4 x double> %a1) {
2484 ; CHECK-LABEL: test_x86_avx_hadd_pd_256:
2485 ; CHECK:       ## BB#0:
2486 ; CHECK-NEXT:    vhaddpd %ymm1, %ymm0, %ymm0
2487 ; CHECK-NEXT:    retl
2488   %res = call <4 x double> @llvm.x86.avx.hadd.pd.256(<4 x double> %a0, <4 x double> %a1) ; <<4 x double>> [#uses=1]
2489   ret <4 x double> %res
2490 }
2491 declare <4 x double> @llvm.x86.avx.hadd.pd.256(<4 x double>, <4 x double>) nounwind readnone
2492
2493
2494 define <8 x float> @test_x86_avx_hadd_ps_256(<8 x float> %a0, <8 x float> %a1) {
2495 ; CHECK-LABEL: test_x86_avx_hadd_ps_256:
2496 ; CHECK:       ## BB#0:
2497 ; CHECK-NEXT:    vhaddps %ymm1, %ymm0, %ymm0
2498 ; CHECK-NEXT:    retl
2499   %res = call <8 x float> @llvm.x86.avx.hadd.ps.256(<8 x float> %a0, <8 x float> %a1) ; <<8 x float>> [#uses=1]
2500   ret <8 x float> %res
2501 }
2502 declare <8 x float> @llvm.x86.avx.hadd.ps.256(<8 x float>, <8 x float>) nounwind readnone
2503
2504
2505 define <4 x double> @test_x86_avx_hsub_pd_256(<4 x double> %a0, <4 x double> %a1) {
2506 ; CHECK-LABEL: test_x86_avx_hsub_pd_256:
2507 ; CHECK:       ## BB#0:
2508 ; CHECK-NEXT:    vhsubpd %ymm1, %ymm0, %ymm0
2509 ; CHECK-NEXT:    retl
2510   %res = call <4 x double> @llvm.x86.avx.hsub.pd.256(<4 x double> %a0, <4 x double> %a1) ; <<4 x double>> [#uses=1]
2511   ret <4 x double> %res
2512 }
2513 declare <4 x double> @llvm.x86.avx.hsub.pd.256(<4 x double>, <4 x double>) nounwind readnone
2514
2515
2516 define <8 x float> @test_x86_avx_hsub_ps_256(<8 x float> %a0, <8 x float> %a1) {
2517 ; CHECK-LABEL: test_x86_avx_hsub_ps_256:
2518 ; CHECK:       ## BB#0:
2519 ; CHECK-NEXT:    vhsubps %ymm1, %ymm0, %ymm0
2520 ; CHECK-NEXT:    retl
2521   %res = call <8 x float> @llvm.x86.avx.hsub.ps.256(<8 x float> %a0, <8 x float> %a1) ; <<8 x float>> [#uses=1]
2522   ret <8 x float> %res
2523 }
2524 declare <8 x float> @llvm.x86.avx.hsub.ps.256(<8 x float>, <8 x float>) nounwind readnone
2525
2526
2527 define <32 x i8> @test_x86_avx_ldu_dq_256(i8* %a0) {
2528 ; CHECK-LABEL: test_x86_avx_ldu_dq_256:
2529 ; CHECK:       ## BB#0:
2530 ; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %eax
2531 ; CHECK-NEXT:    vlddqu (%eax), %ymm0
2532 ; CHECK-NEXT:    retl
2533   %res = call <32 x i8> @llvm.x86.avx.ldu.dq.256(i8* %a0) ; <<32 x i8>> [#uses=1]
2534   ret <32 x i8> %res
2535 }
2536 declare <32 x i8> @llvm.x86.avx.ldu.dq.256(i8*) nounwind readonly
2537
2538
2539 define <2 x double> @test_x86_avx_maskload_pd(i8* %a0, <2 x double> %a1) {
2540 ; CHECK-LABEL: test_x86_avx_maskload_pd:
2541 ; CHECK:       ## BB#0:
2542 ; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %eax
2543 ; CHECK-NEXT:    vmaskmovpd (%eax), %xmm0, %xmm0
2544 ; CHECK-NEXT:    retl
2545   %res = call <2 x double> @llvm.x86.avx.maskload.pd(i8* %a0, <2 x double> %a1) ; <<2 x double>> [#uses=1]
2546   ret <2 x double> %res
2547 }
2548 declare <2 x double> @llvm.x86.avx.maskload.pd(i8*, <2 x double>) nounwind readonly
2549
2550
2551 define <4 x double> @test_x86_avx_maskload_pd_256(i8* %a0, <4 x double> %a1) {
2552 ; CHECK-LABEL: test_x86_avx_maskload_pd_256:
2553 ; CHECK:       ## BB#0:
2554 ; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %eax
2555 ; CHECK-NEXT:    vmaskmovpd (%eax), %ymm0, %ymm0
2556 ; CHECK-NEXT:    retl
2557   %res = call <4 x double> @llvm.x86.avx.maskload.pd.256(i8* %a0, <4 x double> %a1) ; <<4 x double>> [#uses=1]
2558   ret <4 x double> %res
2559 }
2560 declare <4 x double> @llvm.x86.avx.maskload.pd.256(i8*, <4 x double>) nounwind readonly
2561
2562
2563 define <4 x float> @test_x86_avx_maskload_ps(i8* %a0, <4 x float> %a1) {
2564 ; CHECK-LABEL: test_x86_avx_maskload_ps:
2565 ; CHECK:       ## BB#0:
2566 ; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %eax
2567 ; CHECK-NEXT:    vmaskmovps (%eax), %xmm0, %xmm0
2568 ; CHECK-NEXT:    retl
2569   %res = call <4 x float> @llvm.x86.avx.maskload.ps(i8* %a0, <4 x float> %a1) ; <<4 x float>> [#uses=1]
2570   ret <4 x float> %res
2571 }
2572 declare <4 x float> @llvm.x86.avx.maskload.ps(i8*, <4 x float>) nounwind readonly
2573
2574
2575 define <8 x float> @test_x86_avx_maskload_ps_256(i8* %a0, <8 x float> %a1) {
2576 ; CHECK-LABEL: test_x86_avx_maskload_ps_256:
2577 ; CHECK:       ## BB#0:
2578 ; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %eax
2579 ; CHECK-NEXT:    vmaskmovps (%eax), %ymm0, %ymm0
2580 ; CHECK-NEXT:    retl
2581   %res = call <8 x float> @llvm.x86.avx.maskload.ps.256(i8* %a0, <8 x float> %a1) ; <<8 x float>> [#uses=1]
2582   ret <8 x float> %res
2583 }
2584 declare <8 x float> @llvm.x86.avx.maskload.ps.256(i8*, <8 x float>) nounwind readonly
2585
2586
2587 define void @test_x86_avx_maskstore_pd(i8* %a0, <2 x double> %a1, <2 x double> %a2) {
2588 ; CHECK-LABEL: test_x86_avx_maskstore_pd:
2589 ; CHECK:       ## BB#0:
2590 ; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %eax
2591 ; CHECK-NEXT:    vmaskmovpd %xmm1, %xmm0, (%eax)
2592 ; CHECK-NEXT:    retl
2593   call void @llvm.x86.avx.maskstore.pd(i8* %a0, <2 x double> %a1, <2 x double> %a2)
2594   ret void
2595 }
2596 declare void @llvm.x86.avx.maskstore.pd(i8*, <2 x double>, <2 x double>) nounwind
2597
2598
2599 define void @test_x86_avx_maskstore_pd_256(i8* %a0, <4 x double> %a1, <4 x double> %a2) {
2600 ; CHECK-LABEL: test_x86_avx_maskstore_pd_256:
2601 ; CHECK:       ## BB#0:
2602 ; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %eax
2603 ; CHECK-NEXT:    vmaskmovpd %ymm1, %ymm0, (%eax)
2604 ; CHECK-NEXT:    vzeroupper
2605 ; CHECK-NEXT:    retl
2606   call void @llvm.x86.avx.maskstore.pd.256(i8* %a0, <4 x double> %a1, <4 x double> %a2)
2607   ret void
2608 }
2609 declare void @llvm.x86.avx.maskstore.pd.256(i8*, <4 x double>, <4 x double>) nounwind
2610
2611
2612 define void @test_x86_avx_maskstore_ps(i8* %a0, <4 x float> %a1, <4 x float> %a2) {
2613 ; CHECK-LABEL: test_x86_avx_maskstore_ps:
2614 ; CHECK:       ## BB#0:
2615 ; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %eax
2616 ; CHECK-NEXT:    vmaskmovps %xmm1, %xmm0, (%eax)
2617 ; CHECK-NEXT:    retl
2618   call void @llvm.x86.avx.maskstore.ps(i8* %a0, <4 x float> %a1, <4 x float> %a2)
2619   ret void
2620 }
2621 declare void @llvm.x86.avx.maskstore.ps(i8*, <4 x float>, <4 x float>) nounwind
2622
2623
2624 define void @test_x86_avx_maskstore_ps_256(i8* %a0, <8 x float> %a1, <8 x float> %a2) {
2625 ; CHECK-LABEL: test_x86_avx_maskstore_ps_256:
2626 ; CHECK:       ## BB#0:
2627 ; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %eax
2628 ; CHECK-NEXT:    vmaskmovps %ymm1, %ymm0, (%eax)
2629 ; CHECK-NEXT:    vzeroupper
2630 ; CHECK-NEXT:    retl
2631   call void @llvm.x86.avx.maskstore.ps.256(i8* %a0, <8 x float> %a1, <8 x float> %a2)
2632   ret void
2633 }
2634 declare void @llvm.x86.avx.maskstore.ps.256(i8*, <8 x float>, <8 x float>) nounwind
2635
2636
2637 define <4 x double> @test_x86_avx_max_pd_256(<4 x double> %a0, <4 x double> %a1) {
2638 ; CHECK-LABEL: test_x86_avx_max_pd_256:
2639 ; CHECK:       ## BB#0:
2640 ; CHECK-NEXT:    vmaxpd %ymm1, %ymm0, %ymm0
2641 ; CHECK-NEXT:    retl
2642   %res = call <4 x double> @llvm.x86.avx.max.pd.256(<4 x double> %a0, <4 x double> %a1) ; <<4 x double>> [#uses=1]
2643   ret <4 x double> %res
2644 }
2645 declare <4 x double> @llvm.x86.avx.max.pd.256(<4 x double>, <4 x double>) nounwind readnone
2646
2647
2648 define <8 x float> @test_x86_avx_max_ps_256(<8 x float> %a0, <8 x float> %a1) {
2649 ; CHECK-LABEL: test_x86_avx_max_ps_256:
2650 ; CHECK:       ## BB#0:
2651 ; CHECK-NEXT:    vmaxps %ymm1, %ymm0, %ymm0
2652 ; CHECK-NEXT:    retl
2653   %res = call <8 x float> @llvm.x86.avx.max.ps.256(<8 x float> %a0, <8 x float> %a1) ; <<8 x float>> [#uses=1]
2654   ret <8 x float> %res
2655 }
2656 declare <8 x float> @llvm.x86.avx.max.ps.256(<8 x float>, <8 x float>) nounwind readnone
2657
2658
2659 define <4 x double> @test_x86_avx_min_pd_256(<4 x double> %a0, <4 x double> %a1) {
2660 ; CHECK-LABEL: test_x86_avx_min_pd_256:
2661 ; CHECK:       ## BB#0:
2662 ; CHECK-NEXT:    vminpd %ymm1, %ymm0, %ymm0
2663 ; CHECK-NEXT:    retl
2664   %res = call <4 x double> @llvm.x86.avx.min.pd.256(<4 x double> %a0, <4 x double> %a1) ; <<4 x double>> [#uses=1]
2665   ret <4 x double> %res
2666 }
2667 declare <4 x double> @llvm.x86.avx.min.pd.256(<4 x double>, <4 x double>) nounwind readnone
2668
2669
2670 define <8 x float> @test_x86_avx_min_ps_256(<8 x float> %a0, <8 x float> %a1) {
2671 ; CHECK-LABEL: test_x86_avx_min_ps_256:
2672 ; CHECK:       ## BB#0:
2673 ; CHECK-NEXT:    vminps %ymm1, %ymm0, %ymm0
2674 ; CHECK-NEXT:    retl
2675   %res = call <8 x float> @llvm.x86.avx.min.ps.256(<8 x float> %a0, <8 x float> %a1) ; <<8 x float>> [#uses=1]
2676   ret <8 x float> %res
2677 }
2678 declare <8 x float> @llvm.x86.avx.min.ps.256(<8 x float>, <8 x float>) nounwind readnone
2679
2680
2681 define i32 @test_x86_avx_movmsk_pd_256(<4 x double> %a0) {
2682 ; CHECK-LABEL: test_x86_avx_movmsk_pd_256:
2683 ; CHECK:       ## BB#0:
2684 ; CHECK-NEXT:    vmovmskpd %ymm0, %eax
2685 ; CHECK-NEXT:    vzeroupper
2686 ; CHECK-NEXT:    retl
2687   %res = call i32 @llvm.x86.avx.movmsk.pd.256(<4 x double> %a0) ; <i32> [#uses=1]
2688   ret i32 %res
2689 }
2690 declare i32 @llvm.x86.avx.movmsk.pd.256(<4 x double>) nounwind readnone
2691
2692
2693 define i32 @test_x86_avx_movmsk_ps_256(<8 x float> %a0) {
2694 ; CHECK-LABEL: test_x86_avx_movmsk_ps_256:
2695 ; CHECK:       ## BB#0:
2696 ; CHECK-NEXT:    vmovmskps %ymm0, %eax
2697 ; CHECK-NEXT:    vzeroupper
2698 ; CHECK-NEXT:    retl
2699   %res = call i32 @llvm.x86.avx.movmsk.ps.256(<8 x float> %a0) ; <i32> [#uses=1]
2700   ret i32 %res
2701 }
2702 declare i32 @llvm.x86.avx.movmsk.ps.256(<8 x float>) nounwind readnone
2703
2704
2705
2706
2707
2708
2709
2710 define i32 @test_x86_avx_ptestc_256(<4 x i64> %a0, <4 x i64> %a1) {
2711 ; CHECK-LABEL: test_x86_avx_ptestc_256:
2712 ; CHECK:       ## BB#0:
2713 ; CHECK-NEXT:    vptest %ymm1, %ymm0
2714 ; CHECK-NEXT:    sbbl %eax, %eax
2715 ; CHECK-NEXT:    andl $1, %eax
2716 ; CHECK-NEXT:    vzeroupper
2717 ; CHECK-NEXT:    retl
2718   %res = call i32 @llvm.x86.avx.ptestc.256(<4 x i64> %a0, <4 x i64> %a1) ; <i32> [#uses=1]
2719   ret i32 %res
2720 }
2721 declare i32 @llvm.x86.avx.ptestc.256(<4 x i64>, <4 x i64>) nounwind readnone
2722
2723
2724 define i32 @test_x86_avx_ptestnzc_256(<4 x i64> %a0, <4 x i64> %a1) {
2725 ; CHECK-LABEL: test_x86_avx_ptestnzc_256:
2726 ; CHECK:       ## BB#0:
2727 ; CHECK-NEXT:    vptest %ymm1, %ymm0
2728 ; CHECK-NEXT:    seta %al
2729 ; CHECK-NEXT:    movzbl %al, %eax
2730 ; CHECK-NEXT:    vzeroupper
2731 ; CHECK-NEXT:    retl
2732   %res = call i32 @llvm.x86.avx.ptestnzc.256(<4 x i64> %a0, <4 x i64> %a1) ; <i32> [#uses=1]
2733   ret i32 %res
2734 }
2735 declare i32 @llvm.x86.avx.ptestnzc.256(<4 x i64>, <4 x i64>) nounwind readnone
2736
2737
2738 define i32 @test_x86_avx_ptestz_256(<4 x i64> %a0, <4 x i64> %a1) {
2739 ; CHECK-LABEL: test_x86_avx_ptestz_256:
2740 ; CHECK:       ## BB#0:
2741 ; CHECK-NEXT:    vptest %ymm1, %ymm0
2742 ; CHECK-NEXT:    sete %al
2743 ; CHECK-NEXT:    movzbl %al, %eax
2744 ; CHECK-NEXT:    vzeroupper
2745 ; CHECK-NEXT:    retl
2746   %res = call i32 @llvm.x86.avx.ptestz.256(<4 x i64> %a0, <4 x i64> %a1) ; <i32> [#uses=1]
2747   ret i32 %res
2748 }
2749 declare i32 @llvm.x86.avx.ptestz.256(<4 x i64>, <4 x i64>) nounwind readnone
2750
2751
2752 define <8 x float> @test_x86_avx_rcp_ps_256(<8 x float> %a0) {
2753 ; CHECK-LABEL: test_x86_avx_rcp_ps_256:
2754 ; CHECK:       ## BB#0:
2755 ; CHECK-NEXT:    vrcpps %ymm0, %ymm0
2756 ; CHECK-NEXT:    retl
2757   %res = call <8 x float> @llvm.x86.avx.rcp.ps.256(<8 x float> %a0) ; <<8 x float>> [#uses=1]
2758   ret <8 x float> %res
2759 }
2760 declare <8 x float> @llvm.x86.avx.rcp.ps.256(<8 x float>) nounwind readnone
2761
2762
2763 define <4 x double> @test_x86_avx_round_pd_256(<4 x double> %a0) {
2764 ; CHECK-LABEL: test_x86_avx_round_pd_256:
2765 ; CHECK:       ## BB#0:
2766 ; CHECK-NEXT:    vroundpd $7, %ymm0, %ymm0
2767 ; CHECK-NEXT:    retl
2768   %res = call <4 x double> @llvm.x86.avx.round.pd.256(<4 x double> %a0, i32 7) ; <<4 x double>> [#uses=1]
2769   ret <4 x double> %res
2770 }
2771 declare <4 x double> @llvm.x86.avx.round.pd.256(<4 x double>, i32) nounwind readnone
2772
2773
2774 define <8 x float> @test_x86_avx_round_ps_256(<8 x float> %a0) {
2775 ; CHECK-LABEL: test_x86_avx_round_ps_256:
2776 ; CHECK:       ## BB#0:
2777 ; CHECK-NEXT:    vroundps $7, %ymm0, %ymm0
2778 ; CHECK-NEXT:    retl
2779   %res = call <8 x float> @llvm.x86.avx.round.ps.256(<8 x float> %a0, i32 7) ; <<8 x float>> [#uses=1]
2780   ret <8 x float> %res
2781 }
2782 declare <8 x float> @llvm.x86.avx.round.ps.256(<8 x float>, i32) nounwind readnone
2783
2784
2785 define <8 x float> @test_x86_avx_rsqrt_ps_256(<8 x float> %a0) {
2786 ; CHECK-LABEL: test_x86_avx_rsqrt_ps_256:
2787 ; CHECK:       ## BB#0:
2788 ; CHECK-NEXT:    vrsqrtps %ymm0, %ymm0
2789 ; CHECK-NEXT:    retl
2790   %res = call <8 x float> @llvm.x86.avx.rsqrt.ps.256(<8 x float> %a0) ; <<8 x float>> [#uses=1]
2791   ret <8 x float> %res
2792 }
2793 declare <8 x float> @llvm.x86.avx.rsqrt.ps.256(<8 x float>) nounwind readnone
2794
2795
2796 define <4 x double> @test_x86_avx_sqrt_pd_256(<4 x double> %a0) {
2797 ; CHECK-LABEL: test_x86_avx_sqrt_pd_256:
2798 ; CHECK:       ## BB#0:
2799 ; CHECK-NEXT:    vsqrtpd %ymm0, %ymm0
2800 ; CHECK-NEXT:    retl
2801   %res = call <4 x double> @llvm.x86.avx.sqrt.pd.256(<4 x double> %a0) ; <<4 x double>> [#uses=1]
2802   ret <4 x double> %res
2803 }
2804 declare <4 x double> @llvm.x86.avx.sqrt.pd.256(<4 x double>) nounwind readnone
2805
2806
2807 define <8 x float> @test_x86_avx_sqrt_ps_256(<8 x float> %a0) {
2808 ; CHECK-LABEL: test_x86_avx_sqrt_ps_256:
2809 ; CHECK:       ## BB#0:
2810 ; CHECK-NEXT:    vsqrtps %ymm0, %ymm0
2811 ; CHECK-NEXT:    retl
2812   %res = call <8 x float> @llvm.x86.avx.sqrt.ps.256(<8 x float> %a0) ; <<8 x float>> [#uses=1]
2813   ret <8 x float> %res
2814 }
2815 declare <8 x float> @llvm.x86.avx.sqrt.ps.256(<8 x float>) nounwind readnone
2816
2817
2818 define void @test_x86_avx_storeu_dq_256(i8* %a0, <32 x i8> %a1) {
2819   ; FIXME: unfortunately the execution domain fix pass changes this to vmovups and its hard to force with no 256-bit integer instructions
2820   ; add operation forces the execution domain.
2821 ; CHECK-LABEL: test_x86_avx_storeu_dq_256:
2822 ; CHECK:       ## BB#0:
2823 ; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %eax
2824 ; CHECK-NEXT:    vextractf128 $1, %ymm0, %xmm1
2825 ; CHECK-NEXT:    vmovdqa {{.*#+}} xmm2 = [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
2826 ; CHECK-NEXT:    vpaddb %xmm2, %xmm1, %xmm1
2827 ; CHECK-NEXT:    vpaddb %xmm2, %xmm0, %xmm0
2828 ; CHECK-NEXT:    vinsertf128 $1, %xmm1, %ymm0, %ymm0
2829 ; CHECK-NEXT:    vmovups %ymm0, (%eax)
2830 ; CHECK-NEXT:    vzeroupper
2831 ; CHECK-NEXT:    retl
2832   %a2 = add <32 x i8> %a1, <i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1>
2833   call void @llvm.x86.avx.storeu.dq.256(i8* %a0, <32 x i8> %a2)
2834   ret void
2835 }
2836 declare void @llvm.x86.avx.storeu.dq.256(i8*, <32 x i8>) nounwind
2837
2838
2839 define void @test_x86_avx_storeu_pd_256(i8* %a0, <4 x double> %a1) {
2840   ; add operation forces the execution domain.
2841 ; CHECK-LABEL: test_x86_avx_storeu_pd_256:
2842 ; CHECK:       ## BB#0:
2843 ; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %eax
2844 ; CHECK-NEXT:    vxorpd %ymm1, %ymm1, %ymm1
2845 ; CHECK-NEXT:    vaddpd %ymm1, %ymm0, %ymm0
2846 ; CHECK-NEXT:    vmovupd %ymm0, (%eax)
2847 ; CHECK-NEXT:    vzeroupper
2848 ; CHECK-NEXT:    retl
2849   %a2 = fadd <4 x double> %a1, <double 0x0, double 0x0, double 0x0, double 0x0>
2850   call void @llvm.x86.avx.storeu.pd.256(i8* %a0, <4 x double> %a2)
2851   ret void
2852 }
2853 declare void @llvm.x86.avx.storeu.pd.256(i8*, <4 x double>) nounwind
2854
2855
2856 define void @test_x86_avx_storeu_ps_256(i8* %a0, <8 x float> %a1) {
2857 ; CHECK-LABEL: test_x86_avx_storeu_ps_256:
2858 ; CHECK:       ## BB#0:
2859 ; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %eax
2860 ; CHECK-NEXT:    vmovups %ymm0, (%eax)
2861 ; CHECK-NEXT:    vzeroupper
2862 ; CHECK-NEXT:    retl
2863   call void @llvm.x86.avx.storeu.ps.256(i8* %a0, <8 x float> %a1)
2864   ret void
2865 }
2866 declare void @llvm.x86.avx.storeu.ps.256(i8*, <8 x float>) nounwind
2867
2868
2869 define <4 x double> @test_x86_avx_vbroadcastf128_pd_256(i8* %a0) {
2870 ; CHECK-LABEL: test_x86_avx_vbroadcastf128_pd_256:
2871 ; CHECK:       ## BB#0:
2872 ; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %eax
2873 ; CHECK-NEXT:    vbroadcastf128 (%eax), %ymm0
2874 ; CHECK-NEXT:    retl
2875   %res = call <4 x double> @llvm.x86.avx.vbroadcastf128.pd.256(i8* %a0) ; <<4 x double>> [#uses=1]
2876   ret <4 x double> %res
2877 }
2878 declare <4 x double> @llvm.x86.avx.vbroadcastf128.pd.256(i8*) nounwind readonly
2879
2880
2881 define <8 x float> @test_x86_avx_vbroadcastf128_ps_256(i8* %a0) {
2882 ; CHECK-LABEL: test_x86_avx_vbroadcastf128_ps_256:
2883 ; CHECK:       ## BB#0:
2884 ; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %eax
2885 ; CHECK-NEXT:    vbroadcastf128 (%eax), %ymm0
2886 ; CHECK-NEXT:    retl
2887   %res = call <8 x float> @llvm.x86.avx.vbroadcastf128.ps.256(i8* %a0) ; <<8 x float>> [#uses=1]
2888   ret <8 x float> %res
2889 }
2890 declare <8 x float> @llvm.x86.avx.vbroadcastf128.ps.256(i8*) nounwind readonly
2891
2892
2893 define <4 x double> @test_x86_avx_vperm2f128_pd_256(<4 x double> %a0, <4 x double> %a1) {
2894 ; CHECK-LABEL: test_x86_avx_vperm2f128_pd_256:
2895 ; CHECK:       ## BB#0:
2896 ; CHECK-NEXT:    vperm2f128 {{.*#+}} ymm0 = ymm1[2,3],ymm0[0,1]
2897 ; CHECK-NEXT:    retl
2898   %res = call <4 x double> @llvm.x86.avx.vperm2f128.pd.256(<4 x double> %a0, <4 x double> %a1, i8 7) ; <<4 x double>> [#uses=1]
2899   ret <4 x double> %res
2900 }
2901 declare <4 x double> @llvm.x86.avx.vperm2f128.pd.256(<4 x double>, <4 x double>, i8) nounwind readnone
2902
2903
2904 define <8 x float> @test_x86_avx_vperm2f128_ps_256(<8 x float> %a0, <8 x float> %a1) {
2905 ; CHECK-LABEL: test_x86_avx_vperm2f128_ps_256:
2906 ; CHECK:       ## BB#0:
2907 ; CHECK-NEXT:    vperm2f128 {{.*#+}} ymm0 = ymm1[2,3],ymm0[0,1]
2908 ; CHECK-NEXT:    retl
2909   %res = call <8 x float> @llvm.x86.avx.vperm2f128.ps.256(<8 x float> %a0, <8 x float> %a1, i8 7) ; <<8 x float>> [#uses=1]
2910   ret <8 x float> %res
2911 }
2912 declare <8 x float> @llvm.x86.avx.vperm2f128.ps.256(<8 x float>, <8 x float>, i8) nounwind readnone
2913
2914
2915 define <8 x i32> @test_x86_avx_vperm2f128_si_256(<8 x i32> %a0, <8 x i32> %a1) {
2916 ; CHECK-LABEL: test_x86_avx_vperm2f128_si_256:
2917 ; CHECK:       ## BB#0:
2918 ; CHECK-NEXT:    vperm2f128 {{.*#+}} ymm0 = ymm1[2,3],ymm0[0,1]
2919 ; CHECK-NEXT:    retl
2920   %res = call <8 x i32> @llvm.x86.avx.vperm2f128.si.256(<8 x i32> %a0, <8 x i32> %a1, i8 7) ; <<8 x i32>> [#uses=1]
2921   ret <8 x i32> %res
2922 }
2923 declare <8 x i32> @llvm.x86.avx.vperm2f128.si.256(<8 x i32>, <8 x i32>, i8) nounwind readnone
2924
2925
2926 define <2 x double> @test_x86_avx_vpermil_pd(<2 x double> %a0) {
2927 ; CHECK-LABEL: test_x86_avx_vpermil_pd:
2928 ; CHECK:       ## BB#0:
2929 ; CHECK-NEXT:    vpermilpd {{.*#+}} xmm0 = xmm0[1,0]
2930 ; CHECK-NEXT:    retl
2931   %res = call <2 x double> @llvm.x86.avx.vpermil.pd(<2 x double> %a0, i8 1) ; <<2 x double>> [#uses=1]
2932   ret <2 x double> %res
2933 }
2934 declare <2 x double> @llvm.x86.avx.vpermil.pd(<2 x double>, i8) nounwind readnone
2935
2936
2937 define <4 x double> @test_x86_avx_vpermil_pd_256(<4 x double> %a0) {
2938 ; CHECK-LABEL: test_x86_avx_vpermil_pd_256:
2939 ; CHECK:       ## BB#0:
2940 ; CHECK-NEXT:    vpermilpd {{.*#+}} ymm0 = ymm0[1,1,3,2]
2941 ; CHECK-NEXT:    retl
2942   %res = call <4 x double> @llvm.x86.avx.vpermil.pd.256(<4 x double> %a0, i8 7) ; <<4 x double>> [#uses=1]
2943   ret <4 x double> %res
2944 }
2945 declare <4 x double> @llvm.x86.avx.vpermil.pd.256(<4 x double>, i8) nounwind readnone
2946
2947
2948 define <4 x float> @test_x86_avx_vpermil_ps(<4 x float> %a0) {
2949 ; CHECK-LABEL: test_x86_avx_vpermil_ps:
2950 ; CHECK:       ## BB#0:
2951 ; CHECK-NEXT:    vpermilps {{.*#+}} xmm0 = xmm0[3,1,0,0]
2952 ; CHECK-NEXT:    retl
2953   %res = call <4 x float> @llvm.x86.avx.vpermil.ps(<4 x float> %a0, i8 7) ; <<4 x float>> [#uses=1]
2954   ret <4 x float> %res
2955 }
2956 declare <4 x float> @llvm.x86.avx.vpermil.ps(<4 x float>, i8) nounwind readnone
2957
2958
2959 define <8 x float> @test_x86_avx_vpermil_ps_256(<8 x float> %a0) {
2960 ; CHECK-LABEL: test_x86_avx_vpermil_ps_256:
2961 ; CHECK:       ## BB#0:
2962 ; CHECK-NEXT:    vpermilps {{.*#+}} ymm0 = ymm0[3,1,0,0,7,5,4,4]
2963 ; CHECK-NEXT:    retl
2964   %res = call <8 x float> @llvm.x86.avx.vpermil.ps.256(<8 x float> %a0, i8 7) ; <<8 x float>> [#uses=1]
2965   ret <8 x float> %res
2966 }
2967 declare <8 x float> @llvm.x86.avx.vpermil.ps.256(<8 x float>, i8) nounwind readnone
2968
2969
2970 define <2 x double> @test_x86_avx_vpermilvar_pd(<2 x double> %a0, <2 x i64> %a1) {
2971 ; CHECK-LABEL: test_x86_avx_vpermilvar_pd:
2972 ; CHECK:       ## BB#0:
2973 ; CHECK-NEXT:    vpermilpd %xmm1, %xmm0, %xmm0
2974 ; CHECK-NEXT:    retl
2975   %res = call <2 x double> @llvm.x86.avx.vpermilvar.pd(<2 x double> %a0, <2 x i64> %a1) ; <<2 x double>> [#uses=1]
2976   ret <2 x double> %res
2977 }
2978 declare <2 x double> @llvm.x86.avx.vpermilvar.pd(<2 x double>, <2 x i64>) nounwind readnone
2979
2980
2981 define <4 x double> @test_x86_avx_vpermilvar_pd_256(<4 x double> %a0, <4 x i64> %a1) {
2982 ; CHECK-LABEL: test_x86_avx_vpermilvar_pd_256:
2983 ; CHECK:       ## BB#0:
2984 ; CHECK-NEXT:    vpermilpd %ymm1, %ymm0, %ymm0
2985 ; CHECK-NEXT:    retl
2986   %res = call <4 x double> @llvm.x86.avx.vpermilvar.pd.256(<4 x double> %a0, <4 x i64> %a1) ; <<4 x double>> [#uses=1]
2987   ret <4 x double> %res
2988 }
2989 declare <4 x double> @llvm.x86.avx.vpermilvar.pd.256(<4 x double>, <4 x i64>) nounwind readnone
2990
2991
2992 define <4 x float> @test_x86_avx_vpermilvar_ps(<4 x float> %a0, <4 x i32> %a1) {
2993 ; CHECK-LABEL: test_x86_avx_vpermilvar_ps:
2994 ; CHECK:       ## BB#0:
2995 ; CHECK-NEXT:    vpermilps %xmm1, %xmm0, %xmm0
2996 ; CHECK-NEXT:    retl
2997   %res = call <4 x float> @llvm.x86.avx.vpermilvar.ps(<4 x float> %a0, <4 x i32> %a1) ; <<4 x float>> [#uses=1]
2998   ret <4 x float> %res
2999 }
3000 define <4 x float> @test_x86_avx_vpermilvar_ps_load(<4 x float> %a0, <4 x i32>* %a1) {
3001 ; CHECK-LABEL: test_x86_avx_vpermilvar_ps_load:
3002 ; CHECK:       ## BB#0:
3003 ; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %eax
3004 ; CHECK-NEXT:    vpermilps (%eax), %xmm0, %xmm0
3005 ; CHECK-NEXT:    retl
3006   %a2 = load <4 x i32>, <4 x i32>* %a1
3007   %res = call <4 x float> @llvm.x86.avx.vpermilvar.ps(<4 x float> %a0, <4 x i32> %a2) ; <<4 x float>> [#uses=1]
3008   ret <4 x float> %res
3009 }
3010 declare <4 x float> @llvm.x86.avx.vpermilvar.ps(<4 x float>, <4 x i32>) nounwind readnone
3011
3012
3013 define <8 x float> @test_x86_avx_vpermilvar_ps_256(<8 x float> %a0, <8 x i32> %a1) {
3014 ; CHECK-LABEL: test_x86_avx_vpermilvar_ps_256:
3015 ; CHECK:       ## BB#0:
3016 ; CHECK-NEXT:    vpermilps %ymm1, %ymm0, %ymm0
3017 ; CHECK-NEXT:    retl
3018   %res = call <8 x float> @llvm.x86.avx.vpermilvar.ps.256(<8 x float> %a0, <8 x i32> %a1) ; <<8 x float>> [#uses=1]
3019   ret <8 x float> %res
3020 }
3021 declare <8 x float> @llvm.x86.avx.vpermilvar.ps.256(<8 x float>, <8 x i32>) nounwind readnone
3022
3023
3024 define i32 @test_x86_avx_vtestc_pd(<2 x double> %a0, <2 x double> %a1) {
3025 ; CHECK-LABEL: test_x86_avx_vtestc_pd:
3026 ; CHECK:       ## BB#0:
3027 ; CHECK-NEXT:    vtestpd %xmm1, %xmm0
3028 ; CHECK-NEXT:    sbbl %eax, %eax
3029 ; CHECK-NEXT:    andl $1, %eax
3030 ; CHECK-NEXT:    retl
3031   %res = call i32 @llvm.x86.avx.vtestc.pd(<2 x double> %a0, <2 x double> %a1) ; <i32> [#uses=1]
3032   ret i32 %res
3033 }
3034 declare i32 @llvm.x86.avx.vtestc.pd(<2 x double>, <2 x double>) nounwind readnone
3035
3036
3037 define i32 @test_x86_avx_vtestc_pd_256(<4 x double> %a0, <4 x double> %a1) {
3038 ; CHECK-LABEL: test_x86_avx_vtestc_pd_256:
3039 ; CHECK:       ## BB#0:
3040 ; CHECK-NEXT:    vtestpd %ymm1, %ymm0
3041 ; CHECK-NEXT:    sbbl %eax, %eax
3042 ; CHECK-NEXT:    andl $1, %eax
3043 ; CHECK-NEXT:    vzeroupper
3044 ; CHECK-NEXT:    retl
3045   %res = call i32 @llvm.x86.avx.vtestc.pd.256(<4 x double> %a0, <4 x double> %a1) ; <i32> [#uses=1]
3046   ret i32 %res
3047 }
3048 declare i32 @llvm.x86.avx.vtestc.pd.256(<4 x double>, <4 x double>) nounwind readnone
3049
3050
3051 define i32 @test_x86_avx_vtestc_ps(<4 x float> %a0, <4 x float> %a1) {
3052 ; CHECK-LABEL: test_x86_avx_vtestc_ps:
3053 ; CHECK:       ## BB#0:
3054 ; CHECK-NEXT:    vtestps %xmm1, %xmm0
3055 ; CHECK-NEXT:    sbbl %eax, %eax
3056 ; CHECK-NEXT:    andl $1, %eax
3057 ; CHECK-NEXT:    retl
3058   %res = call i32 @llvm.x86.avx.vtestc.ps(<4 x float> %a0, <4 x float> %a1) ; <i32> [#uses=1]
3059   ret i32 %res
3060 }
3061 declare i32 @llvm.x86.avx.vtestc.ps(<4 x float>, <4 x float>) nounwind readnone
3062
3063
3064 define i32 @test_x86_avx_vtestc_ps_256(<8 x float> %a0, <8 x float> %a1) {
3065 ; CHECK-LABEL: test_x86_avx_vtestc_ps_256:
3066 ; CHECK:       ## BB#0:
3067 ; CHECK-NEXT:    vtestps %ymm1, %ymm0
3068 ; CHECK-NEXT:    sbbl %eax, %eax
3069 ; CHECK-NEXT:    andl $1, %eax
3070 ; CHECK-NEXT:    vzeroupper
3071 ; CHECK-NEXT:    retl
3072   %res = call i32 @llvm.x86.avx.vtestc.ps.256(<8 x float> %a0, <8 x float> %a1) ; <i32> [#uses=1]
3073   ret i32 %res
3074 }
3075 declare i32 @llvm.x86.avx.vtestc.ps.256(<8 x float>, <8 x float>) nounwind readnone
3076
3077
3078 define i32 @test_x86_avx_vtestnzc_pd(<2 x double> %a0, <2 x double> %a1) {
3079 ; CHECK-LABEL: test_x86_avx_vtestnzc_pd:
3080 ; CHECK:       ## BB#0:
3081 ; CHECK-NEXT:    vtestpd %xmm1, %xmm0
3082 ; CHECK-NEXT:    seta %al
3083 ; CHECK-NEXT:    movzbl %al, %eax
3084 ; CHECK-NEXT:    retl
3085   %res = call i32 @llvm.x86.avx.vtestnzc.pd(<2 x double> %a0, <2 x double> %a1) ; <i32> [#uses=1]
3086   ret i32 %res
3087 }
3088 declare i32 @llvm.x86.avx.vtestnzc.pd(<2 x double>, <2 x double>) nounwind readnone
3089
3090
3091 define i32 @test_x86_avx_vtestnzc_pd_256(<4 x double> %a0, <4 x double> %a1) {
3092 ; CHECK-LABEL: test_x86_avx_vtestnzc_pd_256:
3093 ; CHECK:       ## BB#0:
3094 ; CHECK-NEXT:    vtestpd %ymm1, %ymm0
3095 ; CHECK-NEXT:    seta %al
3096 ; CHECK-NEXT:    movzbl %al, %eax
3097 ; CHECK-NEXT:    vzeroupper
3098 ; CHECK-NEXT:    retl
3099   %res = call i32 @llvm.x86.avx.vtestnzc.pd.256(<4 x double> %a0, <4 x double> %a1) ; <i32> [#uses=1]
3100   ret i32 %res
3101 }
3102 declare i32 @llvm.x86.avx.vtestnzc.pd.256(<4 x double>, <4 x double>) nounwind readnone
3103
3104
3105 define i32 @test_x86_avx_vtestnzc_ps(<4 x float> %a0, <4 x float> %a1) {
3106 ; CHECK-LABEL: test_x86_avx_vtestnzc_ps:
3107 ; CHECK:       ## BB#0:
3108 ; CHECK-NEXT:    vtestps %xmm1, %xmm0
3109 ; CHECK-NEXT:    seta %al
3110 ; CHECK-NEXT:    movzbl %al, %eax
3111 ; CHECK-NEXT:    retl
3112   %res = call i32 @llvm.x86.avx.vtestnzc.ps(<4 x float> %a0, <4 x float> %a1) ; <i32> [#uses=1]
3113   ret i32 %res
3114 }
3115 declare i32 @llvm.x86.avx.vtestnzc.ps(<4 x float>, <4 x float>) nounwind readnone
3116
3117
3118 define i32 @test_x86_avx_vtestnzc_ps_256(<8 x float> %a0, <8 x float> %a1) {
3119 ; CHECK-LABEL: test_x86_avx_vtestnzc_ps_256:
3120 ; CHECK:       ## BB#0:
3121 ; CHECK-NEXT:    vtestps %ymm1, %ymm0
3122 ; CHECK-NEXT:    seta %al
3123 ; CHECK-NEXT:    movzbl %al, %eax
3124 ; CHECK-NEXT:    vzeroupper
3125 ; CHECK-NEXT:    retl
3126   %res = call i32 @llvm.x86.avx.vtestnzc.ps.256(<8 x float> %a0, <8 x float> %a1) ; <i32> [#uses=1]
3127   ret i32 %res
3128 }
3129 declare i32 @llvm.x86.avx.vtestnzc.ps.256(<8 x float>, <8 x float>) nounwind readnone
3130
3131
3132 define i32 @test_x86_avx_vtestz_pd(<2 x double> %a0, <2 x double> %a1) {
3133 ; CHECK-LABEL: test_x86_avx_vtestz_pd:
3134 ; CHECK:       ## BB#0:
3135 ; CHECK-NEXT:    vtestpd %xmm1, %xmm0
3136 ; CHECK-NEXT:    sete %al
3137 ; CHECK-NEXT:    movzbl %al, %eax
3138 ; CHECK-NEXT:    retl
3139   %res = call i32 @llvm.x86.avx.vtestz.pd(<2 x double> %a0, <2 x double> %a1) ; <i32> [#uses=1]
3140   ret i32 %res
3141 }
3142 declare i32 @llvm.x86.avx.vtestz.pd(<2 x double>, <2 x double>) nounwind readnone
3143
3144
3145 define i32 @test_x86_avx_vtestz_pd_256(<4 x double> %a0, <4 x double> %a1) {
3146 ; CHECK-LABEL: test_x86_avx_vtestz_pd_256:
3147 ; CHECK:       ## BB#0:
3148 ; CHECK-NEXT:    vtestpd %ymm1, %ymm0
3149 ; CHECK-NEXT:    sete %al
3150 ; CHECK-NEXT:    movzbl %al, %eax
3151 ; CHECK-NEXT:    vzeroupper
3152 ; CHECK-NEXT:    retl
3153   %res = call i32 @llvm.x86.avx.vtestz.pd.256(<4 x double> %a0, <4 x double> %a1) ; <i32> [#uses=1]
3154   ret i32 %res
3155 }
3156 declare i32 @llvm.x86.avx.vtestz.pd.256(<4 x double>, <4 x double>) nounwind readnone
3157
3158
3159 define i32 @test_x86_avx_vtestz_ps(<4 x float> %a0, <4 x float> %a1) {
3160 ; CHECK-LABEL: test_x86_avx_vtestz_ps:
3161 ; CHECK:       ## BB#0:
3162 ; CHECK-NEXT:    vtestps %xmm1, %xmm0
3163 ; CHECK-NEXT:    sete %al
3164 ; CHECK-NEXT:    movzbl %al, %eax
3165 ; CHECK-NEXT:    retl
3166   %res = call i32 @llvm.x86.avx.vtestz.ps(<4 x float> %a0, <4 x float> %a1) ; <i32> [#uses=1]
3167   ret i32 %res
3168 }
3169 declare i32 @llvm.x86.avx.vtestz.ps(<4 x float>, <4 x float>) nounwind readnone
3170
3171
3172 define i32 @test_x86_avx_vtestz_ps_256(<8 x float> %a0, <8 x float> %a1) {
3173 ; CHECK-LABEL: test_x86_avx_vtestz_ps_256:
3174 ; CHECK:       ## BB#0:
3175 ; CHECK-NEXT:    vtestps %ymm1, %ymm0
3176 ; CHECK-NEXT:    sete %al
3177 ; CHECK-NEXT:    movzbl %al, %eax
3178 ; CHECK-NEXT:    vzeroupper
3179 ; CHECK-NEXT:    retl
3180   %res = call i32 @llvm.x86.avx.vtestz.ps.256(<8 x float> %a0, <8 x float> %a1) ; <i32> [#uses=1]
3181   ret i32 %res
3182 }
3183 declare i32 @llvm.x86.avx.vtestz.ps.256(<8 x float>, <8 x float>) nounwind readnone
3184
3185
3186 define void @test_x86_avx_vzeroall() {
3187 ; CHECK-LABEL: test_x86_avx_vzeroall:
3188 ; CHECK:       ## BB#0:
3189 ; CHECK-NEXT:    vzeroall
3190 ; CHECK-NEXT:    vzeroupper
3191 ; CHECK-NEXT:    retl
3192   call void @llvm.x86.avx.vzeroall()
3193   ret void
3194 }
3195 declare void @llvm.x86.avx.vzeroall() nounwind
3196
3197
3198 define void @test_x86_avx_vzeroupper() {
3199 ; CHECK-LABEL: test_x86_avx_vzeroupper:
3200 ; CHECK:       ## BB#0:
3201 ; CHECK-NEXT:    vzeroupper
3202 ; CHECK-NEXT:    vzeroupper
3203 ; CHECK-NEXT:    retl
3204   call void @llvm.x86.avx.vzeroupper()
3205   ret void
3206 }
3207 declare void @llvm.x86.avx.vzeroupper() nounwind
3208
3209 ; Make sure instructions with no AVX equivalents, but are associated with SSEX feature flags still work
3210
3211 define void @monitor(i8* %P, i32 %E, i32 %H) nounwind {
3212 ; CHECK-LABEL: monitor:
3213 ; CHECK:       ## BB#0:
3214 ; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %edx
3215 ; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %ecx
3216 ; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %eax
3217 ; CHECK-NEXT:    leal (%eax), %eax
3218 ; CHECK-NEXT:    monitor
3219 ; CHECK-NEXT:    retl
3220   tail call void @llvm.x86.sse3.monitor(i8* %P, i32 %E, i32 %H)
3221   ret void
3222 }
3223 declare void @llvm.x86.sse3.monitor(i8*, i32, i32) nounwind
3224
3225 define void @mwait(i32 %E, i32 %H) nounwind {
3226 ; CHECK-LABEL: mwait:
3227 ; CHECK:       ## BB#0:
3228 ; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %ecx
3229 ; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %eax
3230 ; CHECK-NEXT:    mwait
3231 ; CHECK-NEXT:    retl
3232   tail call void @llvm.x86.sse3.mwait(i32 %E, i32 %H)
3233   ret void
3234 }
3235 declare void @llvm.x86.sse3.mwait(i32, i32) nounwind
3236
3237 define void @sfence() nounwind {
3238 ; CHECK-LABEL: sfence:
3239 ; CHECK:       ## BB#0:
3240 ; CHECK-NEXT:    sfence
3241 ; CHECK-NEXT:    retl
3242   tail call void @llvm.x86.sse.sfence()
3243   ret void
3244 }
3245 declare void @llvm.x86.sse.sfence() nounwind
3246
3247 define void @lfence() nounwind {
3248 ; CHECK-LABEL: lfence:
3249 ; CHECK:       ## BB#0:
3250 ; CHECK-NEXT:    lfence
3251 ; CHECK-NEXT:    retl
3252   tail call void @llvm.x86.sse2.lfence()
3253   ret void
3254 }
3255 declare void @llvm.x86.sse2.lfence() nounwind
3256
3257 define void @mfence() nounwind {
3258 ; CHECK-LABEL: mfence:
3259 ; CHECK:       ## BB#0:
3260 ; CHECK-NEXT:    mfence
3261 ; CHECK-NEXT:    retl
3262   tail call void @llvm.x86.sse2.mfence()
3263   ret void
3264 }
3265 declare void @llvm.x86.sse2.mfence() nounwind
3266
3267 define void @clflush(i8* %p) nounwind {
3268 ; CHECK-LABEL: clflush:
3269 ; CHECK:       ## BB#0:
3270 ; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %eax
3271 ; CHECK-NEXT:    clflush (%eax)
3272 ; CHECK-NEXT:    retl
3273   tail call void @llvm.x86.sse2.clflush(i8* %p)
3274   ret void
3275 }
3276 declare void @llvm.x86.sse2.clflush(i8*) nounwind
3277
3278 define i32 @crc32_32_8(i32 %a, i8 %b) nounwind {
3279 ; CHECK-LABEL: crc32_32_8:
3280 ; CHECK:       ## BB#0:
3281 ; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %eax
3282 ; CHECK-NEXT:    crc32b {{[0-9]+}}(%esp), %eax
3283 ; CHECK-NEXT:    retl
3284   %tmp = call i32 @llvm.x86.sse42.crc32.32.8(i32 %a, i8 %b)
3285   ret i32 %tmp
3286 }
3287 declare i32 @llvm.x86.sse42.crc32.32.8(i32, i8) nounwind
3288
3289 define i32 @crc32_32_16(i32 %a, i16 %b) nounwind {
3290 ; CHECK-LABEL: crc32_32_16:
3291 ; CHECK:       ## BB#0:
3292 ; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %eax
3293 ; CHECK-NEXT:    crc32w {{[0-9]+}}(%esp), %eax
3294 ; CHECK-NEXT:    retl
3295   %tmp = call i32 @llvm.x86.sse42.crc32.32.16(i32 %a, i16 %b)
3296   ret i32 %tmp
3297 }
3298 declare i32 @llvm.x86.sse42.crc32.32.16(i32, i16) nounwind
3299
3300 define i32 @crc32_32_32(i32 %a, i32 %b) nounwind {
3301 ; CHECK-LABEL: crc32_32_32:
3302 ; CHECK:       ## BB#0:
3303 ; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %eax
3304 ; CHECK-NEXT:    crc32l {{[0-9]+}}(%esp), %eax
3305 ; CHECK-NEXT:    retl
3306   %tmp = call i32 @llvm.x86.sse42.crc32.32.32(i32 %a, i32 %b)
3307   ret i32 %tmp
3308 }
3309 declare i32 @llvm.x86.sse42.crc32.32.32(i32, i32) nounwind
3310
3311 define void @movnt_dq(i8* %p, <2 x i64> %a1) nounwind {
3312 ; CHECK-LABEL: movnt_dq:
3313 ; CHECK:       ## BB#0:
3314 ; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %eax
3315 ; CHECK-NEXT:    vpaddq LCPI276_0, %xmm0, %xmm0
3316 ; CHECK-NEXT:    vmovntdq %ymm0, (%eax)
3317 ; CHECK-NEXT:    vzeroupper
3318 ; CHECK-NEXT:    retl
3319   %a2 = add <2 x i64> %a1, <i64 1, i64 1>
3320   %a3 = shufflevector <2 x i64> %a2, <2 x i64> undef, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
3321   tail call void @llvm.x86.avx.movnt.dq.256(i8* %p, <4 x i64> %a3) nounwind
3322   ret void
3323 }
3324 declare void @llvm.x86.avx.movnt.dq.256(i8*, <4 x i64>) nounwind
3325
3326 define void @movnt_ps(i8* %p, <8 x float> %a) nounwind {
3327 ; CHECK-LABEL: movnt_ps:
3328 ; CHECK:       ## BB#0:
3329 ; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %eax
3330 ; CHECK-NEXT:    vmovntps %ymm0, (%eax)
3331 ; CHECK-NEXT:    vzeroupper
3332 ; CHECK-NEXT:    retl
3333   tail call void @llvm.x86.avx.movnt.ps.256(i8* %p, <8 x float> %a) nounwind
3334   ret void
3335 }
3336 declare void @llvm.x86.avx.movnt.ps.256(i8*, <8 x float>) nounwind
3337
3338 define void @movnt_pd(i8* %p, <4 x double> %a1) nounwind {
3339   ; add operation forces the execution domain.
3340 ; CHECK-LABEL: movnt_pd:
3341 ; CHECK:       ## BB#0:
3342 ; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %eax
3343 ; CHECK-NEXT:    vxorpd %ymm1, %ymm1, %ymm1
3344 ; CHECK-NEXT:    vaddpd %ymm1, %ymm0, %ymm0
3345 ; CHECK-NEXT:    vmovntpd %ymm0, (%eax)
3346 ; CHECK-NEXT:    vzeroupper
3347 ; CHECK-NEXT:    retl
3348   %a2 = fadd <4 x double> %a1, <double 0x0, double 0x0, double 0x0, double 0x0>
3349   tail call void @llvm.x86.avx.movnt.pd.256(i8* %p, <4 x double> %a2) nounwind
3350   ret void
3351 }
3352 declare void @llvm.x86.avx.movnt.pd.256(i8*, <4 x double>) nounwind
3353
3354
3355 ; Check for pclmulqdq
3356 define <2 x i64> @test_x86_pclmulqdq(<2 x i64> %a0, <2 x i64> %a1) {
3357 ; CHECK-LABEL: test_x86_pclmulqdq:
3358 ; CHECK:       ## BB#0:
3359 ; CHECK-NEXT:    vpclmulqdq $0, %xmm1, %xmm0, %xmm0
3360 ; CHECK-NEXT:    retl
3361   %res = call <2 x i64> @llvm.x86.pclmulqdq(<2 x i64> %a0, <2 x i64> %a1, i8 0) ; <<2 x i64>> [#uses=1]
3362   ret <2 x i64> %res
3363 }
3364 declare <2 x i64> @llvm.x86.pclmulqdq(<2 x i64>, <2 x i64>, i8) nounwind readnone