[PowerPC] Recommit r314244 with refactoring and off by default
[llvm-core.git] / test / CodeGen / X86 / shuffle-of-splat-multiuses.ll
blobd16ebd5405fefaf8e291a67de34ccd93164fd5f5
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
3 ; PR32449
5 define <2 x double> @foo2(<2 x double> %v, <2 x double> *%p) nounwind {
6 ; AVX2-LABEL: foo2:
7 ; AVX2:       # BB#0:
8 ; AVX2-NEXT:    vpermilpd {{.*#+}} xmm0 = xmm0[1,1]
9 ; AVX2-NEXT:    vmovapd %xmm0, (%rdi)
10 ; AVX2-NEXT:    retq
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 {
18 ; AVX2-LABEL: foo4:
19 ; AVX2:       # BB#0:
20 ; AVX2-NEXT:    vpermpd {{.*#+}} ymm0 = ymm0[2,2,2,2]
21 ; AVX2-NEXT:    vmovaps %ymm0, (%rdi)
22 ; AVX2-NEXT:    retq
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 {
30 ; AVX2-LABEL: foo8:
31 ; AVX2:       # BB#0:
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)
35 ; AVX2-NEXT:    retq
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
39   ret <8 x float> %res1
42 define <4 x i32> @undef_splatmask(<4 x i32> %v) nounwind {
43 ; AVX2-LABEL: undef_splatmask:
44 ; AVX2:       # BB#0:
45 ; AVX2-NEXT:    vpermilps {{.*#+}} xmm0 = xmm0[2,2,3,3]
46 ; AVX2-NEXT:    retq
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>
49   ret <4 x i32> %res1
52 define <4 x i32> @undef_splatmask2(<4 x i32> %v) nounwind {
53 ; AVX2-LABEL: undef_splatmask2:
54 ; AVX2:       # BB#0:
55 ; AVX2-NEXT:    vpermilps {{.*#+}} xmm0 = xmm0[2,2,3,3]
56 ; AVX2-NEXT:    retq
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>
59   ret <4 x i32> %res1
62 define <4 x i32> @undef_splatmask3(<4 x i32> %v) nounwind {
63 ; AVX2-LABEL: undef_splatmask3:
64 ; AVX2:       # BB#0:
65 ; AVX2-NEXT:    vpermilps {{.*#+}} xmm0 = xmm0[2,2,3,3]
66 ; AVX2-NEXT:    retq
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>
69   ret <4 x i32> %res1
72 define <4 x i32> @undef_splatmask4(<4 x i32> %v, <4 x i32>* %p) nounwind {
73 ; AVX2-LABEL: undef_splatmask4:
74 ; AVX2:       # BB#0:
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
79 ; AVX2-NEXT:    retq
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
83   ret <4 x i32> %res1
86 define <4 x i32> @undef_splatmask5(<4 x i32> %v, <4 x i32>* %p) nounwind {
87 ; AVX2-LABEL: undef_splatmask5:
88 ; AVX2:       # BB#0:
89 ; AVX2-NEXT:    vpbroadcastd %xmm0, %xmm1
90 ; AVX2-NEXT:    vpbroadcastq %xmm0, %xmm0
91 ; AVX2-NEXT:    vmovdqa %xmm0, (%rdi)
92 ; AVX2-NEXT:    vmovdqa %xmm1, %xmm0
93 ; AVX2-NEXT:    retq
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
97   ret <4 x i32> %res1