1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i686-apple-darwin -mattr=avx2 | FileCheck %s --check-prefix=CHECK --check-prefix=AVX2 --check-prefix=X86 --check-prefix=X86-AVX2
3 ; RUN: llc < %s -mtriple=i686-apple-darwin -mattr=+avx512f,+avx512bw,+avx512vl | FileCheck %s --check-prefix=CHECK --check-prefix=AVX512 --check-prefix=X86 --check-prefix=X86-AVX512
4 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=avx2 | FileCheck %s --check-prefix=CHECK --check-prefix=AVX2 --check-prefix=X64 --check-prefix=X64-AVX2
5 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=+avx512f,+avx512bw,+avx512vl | FileCheck %s --check-prefix=CHECK --check-prefix=AVX512 --check-prefix=X64 --check-prefix=X64-AVX512
7 define <16 x i16> @test_x86_avx2_pblendw(<16 x i16> %a0, <16 x i16> %a1) {
8 ; CHECK-LABEL: test_x86_avx2_pblendw:
10 ; CHECK-NEXT: vpblendw {{.*#+}} ymm0 = ymm1[0,1,2],ymm0[3,4,5,6,7],ymm1[8,9,10],ymm0[11,12,13,14,15]
11 ; CHECK-NEXT: ret{{[l|q]}}
12 %res = call <16 x i16> @llvm.x86.avx2.pblendw(<16 x i16> %a0, <16 x i16> %a1, i32 7) ; <<16 x i16>> [#uses=1]
15 declare <16 x i16> @llvm.x86.avx2.pblendw(<16 x i16>, <16 x i16>, i32) nounwind readnone
18 define <4 x i32> @test_x86_avx2_pblendd_128(<4 x i32> %a0, <4 x i32> %a1) {
19 ; CHECK-LABEL: test_x86_avx2_pblendd_128:
21 ; CHECK-NEXT: vblendps {{.*#+}} xmm0 = xmm1[0,1,2],xmm0[3]
22 ; CHECK-NEXT: ret{{[l|q]}}
23 %res = call <4 x i32> @llvm.x86.avx2.pblendd.128(<4 x i32> %a0, <4 x i32> %a1, i32 7) ; <<4 x i32>> [#uses=1]
26 declare <4 x i32> @llvm.x86.avx2.pblendd.128(<4 x i32>, <4 x i32>, i32) nounwind readnone
29 define <8 x i32> @test_x86_avx2_pblendd_256(<8 x i32> %a0, <8 x i32> %a1) {
30 ; CHECK-LABEL: test_x86_avx2_pblendd_256:
32 ; CHECK-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1,2],ymm0[3,4,5,6,7]
33 ; CHECK-NEXT: ret{{[l|q]}}
34 %res = call <8 x i32> @llvm.x86.avx2.pblendd.256(<8 x i32> %a0, <8 x i32> %a1, i32 7) ; <<8 x i32>> [#uses=1]
37 declare <8 x i32> @llvm.x86.avx2.pblendd.256(<8 x i32>, <8 x i32>, i32) nounwind readnone
40 define <4 x i64> @test_x86_avx2_movntdqa(i8* %a0) {
41 ; X86-LABEL: test_x86_avx2_movntdqa:
43 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
44 ; X86-NEXT: vmovntdqa (%eax), %ymm0
47 ; X64-LABEL: test_x86_avx2_movntdqa:
49 ; X64-NEXT: vmovntdqa (%rdi), %ymm0
51 %res = call <4 x i64> @llvm.x86.avx2.movntdqa(i8* %a0) ; <<4 x i64>> [#uses=1]
54 declare <4 x i64> @llvm.x86.avx2.movntdqa(i8*) nounwind readonly
57 define <16 x i16> @test_x86_avx2_mpsadbw(<32 x i8> %a0, <32 x i8> %a1) {
58 ; CHECK-LABEL: test_x86_avx2_mpsadbw:
60 ; CHECK-NEXT: vmpsadbw $7, %ymm1, %ymm0, %ymm0
61 ; CHECK-NEXT: ret{{[l|q]}}
62 %res = call <16 x i16> @llvm.x86.avx2.mpsadbw(<32 x i8> %a0, <32 x i8> %a1, i32 7) ; <<16 x i16>> [#uses=1]
65 declare <16 x i16> @llvm.x86.avx2.mpsadbw(<32 x i8>, <32 x i8>, i32) nounwind readnone
68 define <4 x i64> @test_x86_avx2_psll_dq_bs(<4 x i64> %a0) {
69 ; CHECK-LABEL: test_x86_avx2_psll_dq_bs:
71 ; CHECK-NEXT: vpslldq {{.*#+}} ymm0 = zero,zero,zero,zero,zero,zero,zero,ymm0[0,1,2,3,4,5,6,7,8],zero,zero,zero,zero,zero,zero,zero,ymm0[16,17,18,19,20,21,22,23,24]
72 ; CHECK-NEXT: ret{{[l|q]}}
73 %res = call <4 x i64> @llvm.x86.avx2.psll.dq.bs(<4 x i64> %a0, i32 7) ; <<4 x i64>> [#uses=1]
76 declare <4 x i64> @llvm.x86.avx2.psll.dq.bs(<4 x i64>, i32) nounwind readnone
79 define <4 x i64> @test_x86_avx2_psrl_dq_bs(<4 x i64> %a0) {
80 ; CHECK-LABEL: test_x86_avx2_psrl_dq_bs:
82 ; CHECK-NEXT: vpsrldq {{.*#+}} ymm0 = ymm0[7,8,9,10,11,12,13,14,15],zero,zero,zero,zero,zero,zero,zero,ymm0[23,24,25,26,27,28,29,30,31],zero,zero,zero,zero,zero,zero,zero
83 ; CHECK-NEXT: ret{{[l|q]}}
84 %res = call <4 x i64> @llvm.x86.avx2.psrl.dq.bs(<4 x i64> %a0, i32 7) ; <<4 x i64>> [#uses=1]
87 declare <4 x i64> @llvm.x86.avx2.psrl.dq.bs(<4 x i64>, i32) nounwind readnone
90 define <4 x i64> @test_x86_avx2_psll_dq(<4 x i64> %a0) {
91 ; CHECK-LABEL: test_x86_avx2_psll_dq:
93 ; CHECK-NEXT: vpslldq {{.*#+}} ymm0 = zero,ymm0[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14],zero,ymm0[16,17,18,19,20,21,22,23,24,25,26,27,28,29,30]
94 ; CHECK-NEXT: ret{{[l|q]}}
95 %res = call <4 x i64> @llvm.x86.avx2.psll.dq(<4 x i64> %a0, i32 8) ; <<4 x i64>> [#uses=1]
98 declare <4 x i64> @llvm.x86.avx2.psll.dq(<4 x i64>, i32) nounwind readnone
101 define <4 x i64> @test_x86_avx2_psrl_dq(<4 x i64> %a0) {
102 ; CHECK-LABEL: test_x86_avx2_psrl_dq:
104 ; CHECK-NEXT: vpsrldq {{.*#+}} ymm0 = ymm0[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15],zero,ymm0[17,18,19,20,21,22,23,24,25,26,27,28,29,30,31],zero
105 ; CHECK-NEXT: ret{{[l|q]}}
106 %res = call <4 x i64> @llvm.x86.avx2.psrl.dq(<4 x i64> %a0, i32 8) ; <<4 x i64>> [#uses=1]
109 declare <4 x i64> @llvm.x86.avx2.psrl.dq(<4 x i64>, i32) nounwind readnone
112 define <2 x i64> @test_x86_avx2_vextracti128(<4 x i64> %a0) {
113 ; CHECK-LABEL: test_x86_avx2_vextracti128:
115 ; CHECK-NEXT: vextractf128 $1, %ymm0, %xmm0
116 ; CHECK-NEXT: vzeroupper
117 ; CHECK-NEXT: ret{{[l|q]}}
118 %res = call <2 x i64> @llvm.x86.avx2.vextracti128(<4 x i64> %a0, i8 7)
121 declare <2 x i64> @llvm.x86.avx2.vextracti128(<4 x i64>, i8) nounwind readnone
124 define <4 x i64> @test_x86_avx2_vinserti128(<4 x i64> %a0, <2 x i64> %a1) {
125 ; CHECK-LABEL: test_x86_avx2_vinserti128:
127 ; CHECK-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
128 ; CHECK-NEXT: ret{{[l|q]}}
129 %res = call <4 x i64> @llvm.x86.avx2.vinserti128(<4 x i64> %a0, <2 x i64> %a1, i8 7)
132 declare <4 x i64> @llvm.x86.avx2.vinserti128(<4 x i64>, <2 x i64>, i8) nounwind readnone
135 define <4 x double> @test_x86_avx2_vbroadcast_sd_pd_256(<2 x double> %a0) {
136 ; CHECK-LABEL: test_x86_avx2_vbroadcast_sd_pd_256:
138 ; CHECK-NEXT: vbroadcastsd %xmm0, %ymm0
139 ; CHECK-NEXT: ret{{[l|q]}}
140 %res = call <4 x double> @llvm.x86.avx2.vbroadcast.sd.pd.256(<2 x double> %a0)
141 ret <4 x double> %res
143 declare <4 x double> @llvm.x86.avx2.vbroadcast.sd.pd.256(<2 x double>) nounwind readonly
146 define <4 x float> @test_x86_avx2_vbroadcast_ss_ps(<4 x float> %a0) {
147 ; CHECK-LABEL: test_x86_avx2_vbroadcast_ss_ps:
149 ; CHECK-NEXT: vbroadcastss %xmm0, %xmm0
150 ; CHECK-NEXT: ret{{[l|q]}}
151 %res = call <4 x float> @llvm.x86.avx2.vbroadcast.ss.ps(<4 x float> %a0)
154 declare <4 x float> @llvm.x86.avx2.vbroadcast.ss.ps(<4 x float>) nounwind readonly
157 define <8 x float> @test_x86_avx2_vbroadcast_ss_ps_256(<4 x float> %a0) {
158 ; CHECK-LABEL: test_x86_avx2_vbroadcast_ss_ps_256:
160 ; CHECK-NEXT: vbroadcastss %xmm0, %ymm0
161 ; CHECK-NEXT: ret{{[l|q]}}
162 %res = call <8 x float> @llvm.x86.avx2.vbroadcast.ss.ps.256(<4 x float> %a0)
165 declare <8 x float> @llvm.x86.avx2.vbroadcast.ss.ps.256(<4 x float>) nounwind readonly
168 define <16 x i8> @test_x86_avx2_pbroadcastb_128(<16 x i8> %a0) {
169 ; CHECK-LABEL: test_x86_avx2_pbroadcastb_128:
171 ; CHECK-NEXT: vpbroadcastb %xmm0, %xmm0
172 ; CHECK-NEXT: ret{{[l|q]}}
173 %res = call <16 x i8> @llvm.x86.avx2.pbroadcastb.128(<16 x i8> %a0)
176 declare <16 x i8> @llvm.x86.avx2.pbroadcastb.128(<16 x i8>) nounwind readonly
179 define <32 x i8> @test_x86_avx2_pbroadcastb_256(<16 x i8> %a0) {
180 ; CHECK-LABEL: test_x86_avx2_pbroadcastb_256:
182 ; CHECK-NEXT: vpbroadcastb %xmm0, %ymm0
183 ; CHECK-NEXT: ret{{[l|q]}}
184 %res = call <32 x i8> @llvm.x86.avx2.pbroadcastb.256(<16 x i8> %a0)
187 declare <32 x i8> @llvm.x86.avx2.pbroadcastb.256(<16 x i8>) nounwind readonly
190 define <8 x i16> @test_x86_avx2_pbroadcastw_128(<8 x i16> %a0) {
191 ; CHECK-LABEL: test_x86_avx2_pbroadcastw_128:
193 ; CHECK-NEXT: vpbroadcastw %xmm0, %xmm0
194 ; CHECK-NEXT: ret{{[l|q]}}
195 %res = call <8 x i16> @llvm.x86.avx2.pbroadcastw.128(<8 x i16> %a0)
198 declare <8 x i16> @llvm.x86.avx2.pbroadcastw.128(<8 x i16>) nounwind readonly
201 define <16 x i16> @test_x86_avx2_pbroadcastw_256(<8 x i16> %a0) {
202 ; CHECK-LABEL: test_x86_avx2_pbroadcastw_256:
204 ; CHECK-NEXT: vpbroadcastw %xmm0, %ymm0
205 ; CHECK-NEXT: ret{{[l|q]}}
206 %res = call <16 x i16> @llvm.x86.avx2.pbroadcastw.256(<8 x i16> %a0)
209 declare <16 x i16> @llvm.x86.avx2.pbroadcastw.256(<8 x i16>) nounwind readonly
212 define <4 x i32> @test_x86_avx2_pbroadcastd_128(<4 x i32> %a0) {
213 ; CHECK-LABEL: test_x86_avx2_pbroadcastd_128:
215 ; CHECK-NEXT: vbroadcastss %xmm0, %xmm0
216 ; CHECK-NEXT: ret{{[l|q]}}
217 %res = call <4 x i32> @llvm.x86.avx2.pbroadcastd.128(<4 x i32> %a0)
220 declare <4 x i32> @llvm.x86.avx2.pbroadcastd.128(<4 x i32>) nounwind readonly
223 define <8 x i32> @test_x86_avx2_pbroadcastd_256(<4 x i32> %a0) {
224 ; CHECK-LABEL: test_x86_avx2_pbroadcastd_256:
226 ; CHECK-NEXT: vbroadcastss %xmm0, %ymm0
227 ; CHECK-NEXT: ret{{[l|q]}}
228 %res = call <8 x i32> @llvm.x86.avx2.pbroadcastd.256(<4 x i32> %a0)
231 declare <8 x i32> @llvm.x86.avx2.pbroadcastd.256(<4 x i32>) nounwind readonly
234 define <2 x i64> @test_x86_avx2_pbroadcastq_128(<2 x i64> %a0) {
235 ; CHECK-LABEL: test_x86_avx2_pbroadcastq_128:
237 ; CHECK-NEXT: vmovddup {{.*#+}} xmm0 = xmm0[0,0]
238 ; CHECK-NEXT: ret{{[l|q]}}
239 %res = call <2 x i64> @llvm.x86.avx2.pbroadcastq.128(<2 x i64> %a0)
242 declare <2 x i64> @llvm.x86.avx2.pbroadcastq.128(<2 x i64>) nounwind readonly
245 define <4 x i64> @test_x86_avx2_pbroadcastq_256(<2 x i64> %a0) {
246 ; CHECK-LABEL: test_x86_avx2_pbroadcastq_256:
248 ; CHECK-NEXT: vbroadcastsd %xmm0, %ymm0
249 ; CHECK-NEXT: ret{{[l|q]}}
250 %res = call <4 x i64> @llvm.x86.avx2.pbroadcastq.256(<2 x i64> %a0)
253 declare <4 x i64> @llvm.x86.avx2.pbroadcastq.256(<2 x i64>) nounwind readonly
256 define <8 x i32> @test_x86_avx2_pmovsxbd(<16 x i8> %a0) {
257 ; CHECK-LABEL: test_x86_avx2_pmovsxbd:
259 ; CHECK-NEXT: vpmovsxbd %xmm0, %ymm0
260 ; CHECK-NEXT: ret{{[l|q]}}
261 %res = call <8 x i32> @llvm.x86.avx2.pmovsxbd(<16 x i8> %a0) ; <<8 x i32>> [#uses=1]
264 declare <8 x i32> @llvm.x86.avx2.pmovsxbd(<16 x i8>) nounwind readnone
267 define <4 x i64> @test_x86_avx2_pmovsxbq(<16 x i8> %a0) {
268 ; CHECK-LABEL: test_x86_avx2_pmovsxbq:
270 ; CHECK-NEXT: vpmovsxbq %xmm0, %ymm0
271 ; CHECK-NEXT: ret{{[l|q]}}
272 %res = call <4 x i64> @llvm.x86.avx2.pmovsxbq(<16 x i8> %a0) ; <<4 x i64>> [#uses=1]
275 declare <4 x i64> @llvm.x86.avx2.pmovsxbq(<16 x i8>) nounwind readnone
278 define <16 x i16> @test_x86_avx2_pmovsxbw(<16 x i8> %a0) {
279 ; CHECK-LABEL: test_x86_avx2_pmovsxbw:
281 ; CHECK-NEXT: vpmovsxbw %xmm0, %ymm0
282 ; CHECK-NEXT: ret{{[l|q]}}
283 %res = call <16 x i16> @llvm.x86.avx2.pmovsxbw(<16 x i8> %a0) ; <<8 x i16>> [#uses=1]
286 declare <16 x i16> @llvm.x86.avx2.pmovsxbw(<16 x i8>) nounwind readnone
289 define <4 x i64> @test_x86_avx2_pmovsxdq(<4 x i32> %a0) {
290 ; CHECK-LABEL: test_x86_avx2_pmovsxdq:
292 ; CHECK-NEXT: vpmovsxdq %xmm0, %ymm0
293 ; CHECK-NEXT: ret{{[l|q]}}
294 %res = call <4 x i64> @llvm.x86.avx2.pmovsxdq(<4 x i32> %a0) ; <<4 x i64>> [#uses=1]
297 declare <4 x i64> @llvm.x86.avx2.pmovsxdq(<4 x i32>) nounwind readnone
300 define <8 x i32> @test_x86_avx2_pmovsxwd(<8 x i16> %a0) {
301 ; CHECK-LABEL: test_x86_avx2_pmovsxwd:
303 ; CHECK-NEXT: vpmovsxwd %xmm0, %ymm0
304 ; CHECK-NEXT: ret{{[l|q]}}
305 %res = call <8 x i32> @llvm.x86.avx2.pmovsxwd(<8 x i16> %a0) ; <<8 x i32>> [#uses=1]
308 declare <8 x i32> @llvm.x86.avx2.pmovsxwd(<8 x i16>) nounwind readnone
311 define <4 x i64> @test_x86_avx2_pmovsxwq(<8 x i16> %a0) {
312 ; CHECK-LABEL: test_x86_avx2_pmovsxwq:
314 ; CHECK-NEXT: vpmovsxwq %xmm0, %ymm0
315 ; CHECK-NEXT: ret{{[l|q]}}
316 %res = call <4 x i64> @llvm.x86.avx2.pmovsxwq(<8 x i16> %a0) ; <<4 x i64>> [#uses=1]
319 declare <4 x i64> @llvm.x86.avx2.pmovsxwq(<8 x i16>) nounwind readnone
322 define <8 x i32> @test_x86_avx2_pmovzxbd(<16 x i8> %a0) {
323 ; CHECK-LABEL: test_x86_avx2_pmovzxbd:
325 ; CHECK-NEXT: vpmovzxbd {{.*#+}} ymm0 = xmm0[0],zero,zero,zero,xmm0[1],zero,zero,zero,xmm0[2],zero,zero,zero,xmm0[3],zero,zero,zero,xmm0[4],zero,zero,zero,xmm0[5],zero,zero,zero,xmm0[6],zero,zero,zero,xmm0[7],zero,zero,zero
326 ; CHECK-NEXT: ret{{[l|q]}}
327 %res = call <8 x i32> @llvm.x86.avx2.pmovzxbd(<16 x i8> %a0) ; <<8 x i32>> [#uses=1]
330 declare <8 x i32> @llvm.x86.avx2.pmovzxbd(<16 x i8>) nounwind readnone
333 define <4 x i64> @test_x86_avx2_pmovzxbq(<16 x i8> %a0) {
334 ; CHECK-LABEL: test_x86_avx2_pmovzxbq:
336 ; CHECK-NEXT: vpmovzxbq {{.*#+}} ymm0 = xmm0[0],zero,zero,zero,zero,zero,zero,zero,xmm0[1],zero,zero,zero,zero,zero,zero,zero,xmm0[2],zero,zero,zero,zero,zero,zero,zero,xmm0[3],zero,zero,zero,zero,zero,zero,zero
337 ; CHECK-NEXT: ret{{[l|q]}}
338 %res = call <4 x i64> @llvm.x86.avx2.pmovzxbq(<16 x i8> %a0) ; <<4 x i64>> [#uses=1]
341 declare <4 x i64> @llvm.x86.avx2.pmovzxbq(<16 x i8>) nounwind readnone
344 define <16 x i16> @test_x86_avx2_pmovzxbw(<16 x i8> %a0) {
345 ; CHECK-LABEL: test_x86_avx2_pmovzxbw:
347 ; CHECK-NEXT: vpmovzxbw {{.*#+}} ymm0 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero,xmm0[4],zero,xmm0[5],zero,xmm0[6],zero,xmm0[7],zero,xmm0[8],zero,xmm0[9],zero,xmm0[10],zero,xmm0[11],zero,xmm0[12],zero,xmm0[13],zero,xmm0[14],zero,xmm0[15],zero
348 ; CHECK-NEXT: ret{{[l|q]}}
349 %res = call <16 x i16> @llvm.x86.avx2.pmovzxbw(<16 x i8> %a0) ; <<16 x i16>> [#uses=1]
352 declare <16 x i16> @llvm.x86.avx2.pmovzxbw(<16 x i8>) nounwind readnone
355 define <4 x i64> @test_x86_avx2_pmovzxdq(<4 x i32> %a0) {
356 ; CHECK-LABEL: test_x86_avx2_pmovzxdq:
358 ; CHECK-NEXT: vpmovzxdq {{.*#+}} ymm0 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero
359 ; CHECK-NEXT: ret{{[l|q]}}
360 %res = call <4 x i64> @llvm.x86.avx2.pmovzxdq(<4 x i32> %a0) ; <<4 x i64>> [#uses=1]
363 declare <4 x i64> @llvm.x86.avx2.pmovzxdq(<4 x i32>) nounwind readnone
366 define <8 x i32> @test_x86_avx2_pmovzxwd(<8 x i16> %a0) {
367 ; CHECK-LABEL: test_x86_avx2_pmovzxwd:
369 ; CHECK-NEXT: vpmovzxwd {{.*#+}} ymm0 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero,xmm0[4],zero,xmm0[5],zero,xmm0[6],zero,xmm0[7],zero
370 ; CHECK-NEXT: ret{{[l|q]}}
371 %res = call <8 x i32> @llvm.x86.avx2.pmovzxwd(<8 x i16> %a0) ; <<8 x i32>> [#uses=1]
374 declare <8 x i32> @llvm.x86.avx2.pmovzxwd(<8 x i16>) nounwind readnone
377 define <4 x i64> @test_x86_avx2_pmovzxwq(<8 x i16> %a0) {
378 ; CHECK-LABEL: test_x86_avx2_pmovzxwq:
380 ; CHECK-NEXT: vpmovzxwq {{.*#+}} ymm0 = xmm0[0],zero,zero,zero,xmm0[1],zero,zero,zero,xmm0[2],zero,zero,zero,xmm0[3],zero,zero,zero
381 ; CHECK-NEXT: ret{{[l|q]}}
382 %res = call <4 x i64> @llvm.x86.avx2.pmovzxwq(<8 x i16> %a0) ; <<4 x i64>> [#uses=1]
385 declare <4 x i64> @llvm.x86.avx2.pmovzxwq(<8 x i16>) nounwind readnone
387 ; This is checked here because the execution dependency fix pass makes it hard to test in AVX mode since we don't have 256-bit integer instructions
388 define void @test_x86_avx_storeu_dq_256(i8* %a0, <32 x i8> %a1) {
389 ; add operation forces the execution domain.
390 ; X86-LABEL: test_x86_avx_storeu_dq_256:
392 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
393 ; X86-NEXT: vpcmpeqd %ymm1, %ymm1, %ymm1
394 ; X86-NEXT: vpsubb %ymm1, %ymm0, %ymm0
395 ; X86-NEXT: vmovdqu %ymm0, (%eax)
396 ; X86-NEXT: vzeroupper
399 ; X64-LABEL: test_x86_avx_storeu_dq_256:
401 ; X64-NEXT: vpcmpeqd %ymm1, %ymm1, %ymm1
402 ; X64-NEXT: vpsubb %ymm1, %ymm0, %ymm0
403 ; X64-NEXT: vmovdqu %ymm0, (%rdi)
404 ; X64-NEXT: vzeroupper
406 %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>
407 call void @llvm.x86.avx.storeu.dq.256(i8* %a0, <32 x i8> %a2)
410 declare void @llvm.x86.avx.storeu.dq.256(i8*, <32 x i8>) nounwind
412 define <32 x i8> @mm256_max_epi8(<32 x i8> %a0, <32 x i8> %a1) {
413 ; CHECK-LABEL: mm256_max_epi8:
415 ; CHECK-NEXT: vpmaxsb %ymm1, %ymm0, %ymm0
416 ; CHECK-NEXT: ret{{[l|q]}}
417 %res = call <32 x i8> @llvm.x86.avx2.pmaxs.b(<32 x i8> %a0, <32 x i8> %a1)
420 declare <32 x i8> @llvm.x86.avx2.pmaxs.b(<32 x i8>, <32 x i8>) nounwind readnone
422 define <16 x i16> @mm256_max_epi16(<16 x i16> %a0, <16 x i16> %a1) {
423 ; CHECK-LABEL: mm256_max_epi16:
425 ; CHECK-NEXT: vpmaxsw %ymm1, %ymm0, %ymm0
426 ; CHECK-NEXT: ret{{[l|q]}}
427 %res = call <16 x i16> @llvm.x86.avx2.pmaxs.w(<16 x i16> %a0, <16 x i16> %a1)
430 declare <16 x i16> @llvm.x86.avx2.pmaxs.w(<16 x i16>, <16 x i16>) nounwind readnone
432 define <8 x i32> @mm256_max_epi32(<8 x i32> %a0, <8 x i32> %a1) {
433 ; CHECK-LABEL: mm256_max_epi32:
435 ; CHECK-NEXT: vpmaxsd %ymm1, %ymm0, %ymm0
436 ; CHECK-NEXT: ret{{[l|q]}}
437 %res = call <8 x i32> @llvm.x86.avx2.pmaxs.d(<8 x i32> %a0, <8 x i32> %a1)
440 declare <8 x i32> @llvm.x86.avx2.pmaxs.d(<8 x i32>, <8 x i32>) nounwind readnone
442 define <32 x i8> @mm256_max_epu8(<32 x i8> %a0, <32 x i8> %a1) {
443 ; CHECK-LABEL: mm256_max_epu8:
445 ; CHECK-NEXT: vpmaxub %ymm1, %ymm0, %ymm0
446 ; CHECK-NEXT: ret{{[l|q]}}
447 %res = call <32 x i8> @llvm.x86.avx2.pmaxu.b(<32 x i8> %a0, <32 x i8> %a1)
450 declare <32 x i8> @llvm.x86.avx2.pmaxu.b(<32 x i8>, <32 x i8>) nounwind readnone
452 define <16 x i16> @mm256_max_epu16(<16 x i16> %a0, <16 x i16> %a1) {
453 ; CHECK-LABEL: mm256_max_epu16:
455 ; CHECK-NEXT: vpmaxuw %ymm1, %ymm0, %ymm0
456 ; CHECK-NEXT: ret{{[l|q]}}
457 %res = call <16 x i16> @llvm.x86.avx2.pmaxu.w(<16 x i16> %a0, <16 x i16> %a1)
460 declare <16 x i16> @llvm.x86.avx2.pmaxu.w(<16 x i16>, <16 x i16>) nounwind readnone
462 define <8 x i32> @mm256_max_epu32(<8 x i32> %a0, <8 x i32> %a1) {
463 ; CHECK-LABEL: mm256_max_epu32:
465 ; CHECK-NEXT: vpmaxud %ymm1, %ymm0, %ymm0
466 ; CHECK-NEXT: ret{{[l|q]}}
467 %res = call <8 x i32> @llvm.x86.avx2.pmaxu.d(<8 x i32> %a0, <8 x i32> %a1)
470 declare <8 x i32> @llvm.x86.avx2.pmaxu.d(<8 x i32>, <8 x i32>) nounwind readnone
472 define <32 x i8> @mm256_min_epi8(<32 x i8> %a0, <32 x i8> %a1) {
473 ; CHECK-LABEL: mm256_min_epi8:
475 ; CHECK-NEXT: vpminsb %ymm1, %ymm0, %ymm0
476 ; CHECK-NEXT: ret{{[l|q]}}
477 %res = call <32 x i8> @llvm.x86.avx2.pmins.b(<32 x i8> %a0, <32 x i8> %a1)
480 declare <32 x i8> @llvm.x86.avx2.pmins.b(<32 x i8>, <32 x i8>) nounwind readnone
482 define <16 x i16> @mm256_min_epi16(<16 x i16> %a0, <16 x i16> %a1) {
483 ; CHECK-LABEL: mm256_min_epi16:
485 ; CHECK-NEXT: vpminsw %ymm1, %ymm0, %ymm0
486 ; CHECK-NEXT: ret{{[l|q]}}
487 %res = call <16 x i16> @llvm.x86.avx2.pmins.w(<16 x i16> %a0, <16 x i16> %a1)
490 declare <16 x i16> @llvm.x86.avx2.pmins.w(<16 x i16>, <16 x i16>) nounwind readnone
492 define <8 x i32> @mm256_min_epi32(<8 x i32> %a0, <8 x i32> %a1) {
493 ; CHECK-LABEL: mm256_min_epi32:
495 ; CHECK-NEXT: vpminsd %ymm1, %ymm0, %ymm0
496 ; CHECK-NEXT: ret{{[l|q]}}
497 %res = call <8 x i32> @llvm.x86.avx2.pmins.d(<8 x i32> %a0, <8 x i32> %a1)
500 declare <8 x i32> @llvm.x86.avx2.pmins.d(<8 x i32>, <8 x i32>) nounwind readnone
502 define <32 x i8> @mm256_min_epu8(<32 x i8> %a0, <32 x i8> %a1) {
503 ; CHECK-LABEL: mm256_min_epu8:
505 ; CHECK-NEXT: vpminub %ymm1, %ymm0, %ymm0
506 ; CHECK-NEXT: ret{{[l|q]}}
507 %res = call <32 x i8> @llvm.x86.avx2.pminu.b(<32 x i8> %a0, <32 x i8> %a1)
510 declare <32 x i8> @llvm.x86.avx2.pminu.b(<32 x i8>, <32 x i8>) nounwind readnone
512 define <16 x i16> @mm256_min_epu16(<16 x i16> %a0, <16 x i16> %a1) {
513 ; CHECK-LABEL: mm256_min_epu16:
515 ; CHECK-NEXT: vpminuw %ymm1, %ymm0, %ymm0
516 ; CHECK-NEXT: ret{{[l|q]}}
517 %res = call <16 x i16> @llvm.x86.avx2.pminu.w(<16 x i16> %a0, <16 x i16> %a1)
520 declare <16 x i16> @llvm.x86.avx2.pminu.w(<16 x i16>, <16 x i16>) nounwind readnone
522 define <8 x i32> @mm256_min_epu32(<8 x i32> %a0, <8 x i32> %a1) {
523 ; CHECK-LABEL: mm256_min_epu32:
525 ; CHECK-NEXT: vpminud %ymm1, %ymm0, %ymm0
526 ; CHECK-NEXT: ret{{[l|q]}}
527 %res = call <8 x i32> @llvm.x86.avx2.pminu.d(<8 x i32> %a0, <8 x i32> %a1)
530 declare <8 x i32> @llvm.x86.avx2.pminu.d(<8 x i32>, <8 x i32>) nounwind readnone
532 define <32 x i8> @test_x86_avx2_pabs_b(<32 x i8> %a0) {
533 ; CHECK-LABEL: test_x86_avx2_pabs_b:
535 ; CHECK-NEXT: vpabsb %ymm0, %ymm0
536 ; CHECK-NEXT: ret{{[l|q]}}
537 %res = call <32 x i8> @llvm.x86.avx2.pabs.b(<32 x i8> %a0) ; <<32 x i8>> [#uses=1]
540 declare <32 x i8> @llvm.x86.avx2.pabs.b(<32 x i8>) nounwind readnone
542 define <8 x i32> @test_x86_avx2_pabs_d(<8 x i32> %a0) {
543 ; CHECK-LABEL: test_x86_avx2_pabs_d:
545 ; CHECK-NEXT: vpabsd %ymm0, %ymm0
546 ; CHECK-NEXT: ret{{[l|q]}}
547 %res = call <8 x i32> @llvm.x86.avx2.pabs.d(<8 x i32> %a0) ; <<8 x i32>> [#uses=1]
550 declare <8 x i32> @llvm.x86.avx2.pabs.d(<8 x i32>) nounwind readnone
553 define <16 x i16> @test_x86_avx2_pabs_w(<16 x i16> %a0) {
554 ; CHECK-LABEL: test_x86_avx2_pabs_w:
556 ; CHECK-NEXT: vpabsw %ymm0, %ymm0
557 ; CHECK-NEXT: ret{{[l|q]}}
558 %res = call <16 x i16> @llvm.x86.avx2.pabs.w(<16 x i16> %a0) ; <<16 x i16>> [#uses=1]
561 declare <16 x i16> @llvm.x86.avx2.pabs.w(<16 x i16>) nounwind readnone
564 define <4 x i64> @test_x86_avx2_vperm2i128(<4 x i64> %a0, <4 x i64> %a1) {
565 ; CHECK-LABEL: test_x86_avx2_vperm2i128:
567 ; CHECK-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[2,3,0,1]
568 ; CHECK-NEXT: ret{{[l|q]}}
569 %res = call <4 x i64> @llvm.x86.avx2.vperm2i128(<4 x i64> %a0, <4 x i64> %a1, i8 1) ; <<4 x i64>> [#uses=1]
572 declare <4 x i64> @llvm.x86.avx2.vperm2i128(<4 x i64>, <4 x i64>, i8) nounwind readonly
575 define <4 x i64> @test_x86_avx2_pmulu_dq(<8 x i32> %a0, <8 x i32> %a1) {
576 ; CHECK-LABEL: test_x86_avx2_pmulu_dq:
578 ; CHECK-NEXT: vpmuludq %ymm1, %ymm0, %ymm0
579 ; CHECK-NEXT: ret{{[l|q]}}
580 %res = call <4 x i64> @llvm.x86.avx2.pmulu.dq(<8 x i32> %a0, <8 x i32> %a1) ; <<4 x i64>> [#uses=1]
583 declare <4 x i64> @llvm.x86.avx2.pmulu.dq(<8 x i32>, <8 x i32>) nounwind readnone
586 define <4 x i64> @test_x86_avx2_pmul_dq(<8 x i32> %a0, <8 x i32> %a1) {
587 ; CHECK-LABEL: test_x86_avx2_pmul_dq:
589 ; CHECK-NEXT: vpmuldq %ymm1, %ymm0, %ymm0
590 ; CHECK-NEXT: ret{{[l|q]}}
591 %res = call <4 x i64> @llvm.x86.avx2.pmul.dq(<8 x i32> %a0, <8 x i32> %a1) ; <<4 x i64>> [#uses=1]
594 declare <4 x i64> @llvm.x86.avx2.pmul.dq(<8 x i32>, <8 x i32>) nounwind readnone
597 define <32 x i8> @test_x86_avx2_padds_b(<32 x i8> %a0, <32 x i8> %a1) {
598 ; CHECK-LABEL: test_x86_avx2_padds_b:
600 ; CHECK-NEXT: vpaddsb %ymm1, %ymm0, %ymm0
601 ; CHECK-NEXT: ret{{[l|q]}}
602 %res = call <32 x i8> @llvm.sadd.sat.v32i8(<32 x i8> %a0, <32 x i8> %a1) ; <<32 x i8>> [#uses=1]
605 declare <32 x i8> @llvm.sadd.sat.v32i8(<32 x i8>, <32 x i8>) nounwind readnone
608 define <16 x i16> @test_x86_avx2_padds_w(<16 x i16> %a0, <16 x i16> %a1) {
609 ; CHECK-LABEL: test_x86_avx2_padds_w:
611 ; CHECK-NEXT: vpaddsw %ymm1, %ymm0, %ymm0
612 ; CHECK-NEXT: ret{{[l|q]}}
613 %res = call <16 x i16> @llvm.sadd.sat.v16i16(<16 x i16> %a0, <16 x i16> %a1) ; <<16 x i16>> [#uses=1]
616 declare <16 x i16> @llvm.sadd.sat.v16i16(<16 x i16>, <16 x i16>) nounwind readnone
619 define <32 x i8> @test_x86_avx2_paddus_b(<32 x i8> %a0, <32 x i8> %a1) {
620 ; CHECK-LABEL: test_x86_avx2_paddus_b:
622 ; CHECK-NEXT: vpaddusb %ymm1, %ymm0, %ymm0
623 ; CHECK-NEXT: ret{{[l|q]}}
624 %res = call <32 x i8> @llvm.x86.avx2.paddus.b(<32 x i8> %a0, <32 x i8> %a1) ; <<32 x i8>> [#uses=1]
627 declare <32 x i8> @llvm.x86.avx2.paddus.b(<32 x i8>, <32 x i8>) nounwind readnone
630 define <16 x i16> @test_x86_avx2_paddus_w(<16 x i16> %a0, <16 x i16> %a1) {
631 ; CHECK-LABEL: test_x86_avx2_paddus_w:
633 ; CHECK-NEXT: vpaddusw %ymm1, %ymm0, %ymm0
634 ; CHECK-NEXT: ret{{[l|q]}}
635 %res = call <16 x i16> @llvm.x86.avx2.paddus.w(<16 x i16> %a0, <16 x i16> %a1) ; <<16 x i16>> [#uses=1]
638 declare <16 x i16> @llvm.x86.avx2.paddus.w(<16 x i16>, <16 x i16>) nounwind readnone
641 define <32 x i8> @test_x86_avx2_psubs_b(<32 x i8> %a0, <32 x i8> %a1) {
642 ; CHECK-LABEL: test_x86_avx2_psubs_b:
644 ; CHECK-NEXT: vpsubsb %ymm1, %ymm0, %ymm0
645 ; CHECK-NEXT: ret{{[l|q]}}
646 %res = call <32 x i8> @llvm.ssub.sat.v32i8(<32 x i8> %a0, <32 x i8> %a1) ; <<32 x i8>> [#uses=1]
649 declare <32 x i8> @llvm.ssub.sat.v32i8(<32 x i8>, <32 x i8>) nounwind readnone
652 define <16 x i16> @test_x86_avx2_psubs_w(<16 x i16> %a0, <16 x i16> %a1) {
653 ; CHECK-LABEL: test_x86_avx2_psubs_w:
655 ; CHECK-NEXT: vpsubsw %ymm1, %ymm0, %ymm0
656 ; CHECK-NEXT: ret{{[l|q]}}
657 %res = call <16 x i16> @llvm.ssub.sat.v16i16(<16 x i16> %a0, <16 x i16> %a1) ; <<16 x i16>> [#uses=1]
660 declare <16 x i16> @llvm.ssub.sat.v16i16(<16 x i16>, <16 x i16>) nounwind readnone
663 define <32 x i8> @test_x86_avx2_psubus_b(<32 x i8> %a0, <32 x i8> %a1) {
664 ; CHECK-LABEL: test_x86_avx2_psubus_b:
666 ; CHECK-NEXT: vpsubusb %ymm1, %ymm0, %ymm0
667 ; CHECK-NEXT: ret{{[l|q]}}
668 %res = call <32 x i8> @llvm.x86.avx2.psubus.b(<32 x i8> %a0, <32 x i8> %a1) ; <<32 x i8>> [#uses=1]
671 declare <32 x i8> @llvm.x86.avx2.psubus.b(<32 x i8>, <32 x i8>) nounwind readnone
674 define <16 x i16> @test_x86_avx2_psubus_w(<16 x i16> %a0, <16 x i16> %a1) {
675 ; CHECK-LABEL: test_x86_avx2_psubus_w:
677 ; CHECK-NEXT: vpsubusw %ymm1, %ymm0, %ymm0
678 ; CHECK-NEXT: ret{{[l|q]}}
679 %res = call <16 x i16> @llvm.x86.avx2.psubus.w(<16 x i16> %a0, <16 x i16> %a1) ; <<16 x i16>> [#uses=1]
682 declare <16 x i16> @llvm.x86.avx2.psubus.w(<16 x i16>, <16 x i16>) nounwind readnone