1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+avx2 | FileCheck %s --check-prefix=AVX2
5 define <2 x double> @foo2(<2 x double> %v, <2 x double> *%p) nounwind {
8 ; AVX2-NEXT: vpermilpd {{.*#+}} xmm0 = xmm0[1,1]
9 ; AVX2-NEXT: vmovapd %xmm0, (%rdi)
11 %res = shufflevector <2 x double> %v, <2 x double> undef, <2 x i32> <i32 1, i32 1>
12 %res1 = shufflevector<2 x double> %res, <2 x double> undef, <2 x i32> <i32 1, i32 undef>
13 store <2 x double> %res, <2 x double>* %p
14 ret <2 x double> %res1
17 define <4 x double> @foo4(<4 x double> %v, <4 x double> *%p) nounwind {
20 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[2,2,2,2]
21 ; AVX2-NEXT: vmovaps %ymm0, (%rdi)
23 %res = shufflevector <4 x double> %v, <4 x double> undef, <4 x i32> <i32 2, i32 2, i32 2, i32 2>
24 %res1 = shufflevector<4 x double> %res, <4 x double> undef, <4 x i32> <i32 2, i32 0, i32 undef, i32 undef>
25 store <4 x double> %res, <4 x double>* %p
26 ret <4 x double> %res1
29 define <8 x float> @foo8(<8 x float> %v, <8 x float> *%p) nounwind {
32 ; AVX2-NEXT: vmovshdup {{.*#+}} ymm0 = ymm0[1,1,3,3,5,5,7,7]
33 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[2,2,2,2]
34 ; AVX2-NEXT: vmovaps %ymm0, (%rdi)
36 %res = shufflevector <8 x float> %v, <8 x float> undef, <8 x i32> <i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5>
37 %res1 = shufflevector<8 x float> %res, <8 x float> undef, <8 x i32> <i32 2, i32 0, i32 undef, i32 undef, i32 5, i32 1, i32 3, i32 7>
38 store <8 x float> %res, <8 x float>* %p
42 define <4 x i32> @undef_splatmask(<4 x i32> %v) nounwind {
43 ; AVX2-LABEL: undef_splatmask:
45 ; AVX2-NEXT: vpermilps {{.*#+}} xmm0 = xmm0[2,2,3,3]
47 %res = shufflevector <4 x i32> %v, <4 x i32> undef, <4 x i32> <i32 2, i32 undef, i32 2, i32 undef>
48 %res1 = shufflevector <4 x i32> %res, <4 x i32> undef, <4 x i32> <i32 0, i32 2, i32 undef, i32 undef>
52 define <4 x i32> @undef_splatmask2(<4 x i32> %v) nounwind {
53 ; AVX2-LABEL: undef_splatmask2:
55 ; AVX2-NEXT: vpermilps {{.*#+}} xmm0 = xmm0[2,2,3,3]
57 %res = shufflevector <4 x i32> %v, <4 x i32> undef, <4 x i32> <i32 2, i32 1, i32 2, i32 undef>
58 %res1 = shufflevector <4 x i32> %res, <4 x i32> undef, <4 x i32> <i32 0, i32 2, i32 undef, i32 undef>
62 define <4 x i32> @undef_splatmask3(<4 x i32> %v) nounwind {
63 ; AVX2-LABEL: undef_splatmask3:
65 ; AVX2-NEXT: vpermilps {{.*#+}} xmm0 = xmm0[2,2,3,3]
67 %res = shufflevector <4 x i32> %v, <4 x i32> undef, <4 x i32> <i32 2, i32 undef, i32 2, i32 undef>
68 %res1 = shufflevector <4 x i32> %res, <4 x i32> undef, <4 x i32> <i32 0, i32 2, i32 undef, i32 3>
72 define <4 x i32> @undef_splatmask4(<4 x i32> %v, <4 x i32>* %p) nounwind {
73 ; AVX2-LABEL: undef_splatmask4:
75 ; AVX2-NEXT: vpermilps {{.*#+}} xmm1 = xmm0[2,2,3,3]
76 ; AVX2-NEXT: vpermilps {{.*#+}} xmm0 = xmm0[2,3,2,3]
77 ; AVX2-NEXT: vmovaps %xmm0, (%rdi)
78 ; AVX2-NEXT: vmovaps %xmm1, %xmm0
80 %res = shufflevector <4 x i32> %v, <4 x i32> undef, <4 x i32> <i32 2, i32 undef, i32 2, i32 undef>
81 %res1 = shufflevector <4 x i32> %res, <4 x i32> undef, <4 x i32> <i32 0, i32 2, i32 undef, i32 undef>
82 store <4 x i32> %res, <4 x i32>* %p
86 define <4 x i32> @undef_splatmask5(<4 x i32> %v, <4 x i32>* %p) nounwind {
87 ; AVX2-LABEL: undef_splatmask5:
89 ; AVX2-NEXT: vpbroadcastd %xmm0, %xmm1
90 ; AVX2-NEXT: vpbroadcastq %xmm0, %xmm0
91 ; AVX2-NEXT: vmovdqa %xmm0, (%rdi)
92 ; AVX2-NEXT: vmovdqa %xmm1, %xmm0
94 %res = shufflevector <4 x i32> %v, <4 x i32> undef, <4 x i32> <i32 0, i32 undef, i32 0, i32 undef>
95 %res1 = shufflevector <4 x i32> %res, <4 x i32> undef, <4 x i32> <i32 0, i32 2, i32 undef, i32 3>
96 store <4 x i32> %res, <4 x i32>* %p