1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=icelake-server | FileCheck %s --check-prefixes=CHECK,CHECK-ICX,CHECK-ICX-NO-BYPASS-DELAY
3 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=icelake-server -mattr=-no-bypass-delay-shuffle | FileCheck %s --check-prefixes=CHECK,CHECK-ICX,CHECK-ICX-BYPASS-DELAY
4 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=x86-64-v4 | FileCheck %s --check-prefixes=CHECK,CHECK-V4
5 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512f,+avx512vl,+avx512bw,+avx512dq | FileCheck %s --check-prefixes=CHECK,CHECK-AVX512
6 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=znver4 | FileCheck %s --check-prefixes=CHECK,CHECK-ZNVER4
7 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=znver5 | FileCheck %s --check-prefixes=CHECK,CHECK-ZNVER4
9 define <8 x double> @transform_VPERMILPSZrr(<8 x double> %a) nounwind {
10 ; CHECK-LABEL: transform_VPERMILPSZrr:
12 ; CHECK-NEXT: vshufpd {{.*#+}} zmm0 = zmm0[0,1,2,3,4,5,7,6]
14 %shufp = shufflevector <8 x double> %a, <8 x double> poison, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 7, i32 6>
15 ret <8 x double> %shufp
18 define <4 x double> @transform_VPERMILPSYrr(<4 x double> %a) nounwind {
19 ; CHECK-LABEL: transform_VPERMILPSYrr:
21 ; CHECK-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[1,0,2,3]
23 %shufp = shufflevector <4 x double> %a, <4 x double> poison, <4 x i32> <i32 1, i32 0, i32 2, i32 3>
24 ret <4 x double> %shufp
27 define <2 x double> @transform_VPERMILPSrr(<2 x double> %a) nounwind {
28 ; CHECK-LABEL: transform_VPERMILPSrr:
30 ; CHECK-NEXT: vshufpd {{.*#+}} xmm0 = xmm0[1,0]
32 %shufp = shufflevector <2 x double> %a, <2 x double> poison, <2 x i32> <i32 1, i32 0>
33 ret <2 x double> %shufp
36 define <8 x double> @transform_VPERMILPSZrrkz(<8 x double> %a, i8 %mask_int) nounwind {
37 ; CHECK-LABEL: transform_VPERMILPSZrrkz:
39 ; CHECK-NEXT: kmovd %edi, %k1
40 ; CHECK-NEXT: vshufpd {{.*#+}} zmm0 {%k1} {z} = zmm0[0,1,2,3,5,4,6,7]
42 %mask = bitcast i8 %mask_int to <8 x i1>
43 %shufp = shufflevector <8 x double> %a, <8 x double> poison, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 5, i32 4, i32 6, i32 7>
44 %res = select <8 x i1> %mask, <8 x double> %shufp, <8 x double> zeroinitializer
48 define <4 x double> @transform_VPERMILPSYrrkz(<4 x double> %a, i4 %mask_int) nounwind {
49 ; CHECK-LABEL: transform_VPERMILPSYrrkz:
51 ; CHECK-NEXT: kmovd %edi, %k1
52 ; CHECK-NEXT: vshufpd {{.*#+}} ymm0 {%k1} {z} = ymm0[0,1,3,2]
54 %mask = bitcast i4 %mask_int to <4 x i1>
55 %shufp = shufflevector <4 x double> %a, <4 x double> poison, <4 x i32> <i32 0, i32 1, i32 3, i32 2>
56 %res = select <4 x i1> %mask, <4 x double> %shufp, <4 x double> zeroinitializer
60 define <2 x double> @transform_VPERMILPSrrkz(<2 x double> %a, i2 %mask_int) nounwind {
61 ; CHECK-LABEL: transform_VPERMILPSrrkz:
63 ; CHECK-NEXT: kmovd %edi, %k1
64 ; CHECK-NEXT: vshufpd {{.*#+}} xmm0 {%k1} {z} = xmm0[1,0]
66 %mask = bitcast i2 %mask_int to <2 x i1>
67 %shufp = shufflevector <2 x double> %a, <2 x double> poison, <2 x i32> <i32 1, i32 0>
68 %res = select <2 x i1> %mask, <2 x double> %shufp, <2 x double> zeroinitializer
72 define <8 x double> @transform_VPERMILPSZrrk(<8 x double> %a, <8 x double> %b, i8 %mask_int) nounwind {
73 ; CHECK-LABEL: transform_VPERMILPSZrrk:
75 ; CHECK-NEXT: kmovd %edi, %k1
76 ; CHECK-NEXT: vshufpd {{.*#+}} zmm1 {%k1} = zmm0[0,1,3,2,4,5,6,7]
77 ; CHECK-NEXT: vmovapd %zmm1, %zmm0
79 %mask = bitcast i8 %mask_int to <8 x i1>
80 %shufp = shufflevector <8 x double> %a, <8 x double> poison, <8 x i32> <i32 0, i32 1, i32 3, i32 2, i32 4, i32 5, i32 6, i32 7>
81 %res = select <8 x i1> %mask, <8 x double> %shufp, <8 x double> %b
85 define <4 x double> @transform_VPERMILPSYrrk(<4 x double> %a, <4 x double> %b, i4 %mask_int) nounwind {
86 ; CHECK-LABEL: transform_VPERMILPSYrrk:
88 ; CHECK-NEXT: kmovd %edi, %k1
89 ; CHECK-NEXT: vshufpd {{.*#+}} ymm1 {%k1} = ymm0[1,0,3,2]
90 ; CHECK-NEXT: vmovapd %ymm1, %ymm0
92 %mask = bitcast i4 %mask_int to <4 x i1>
93 %shufp = shufflevector <4 x double> %a, <4 x double> poison, <4 x i32> <i32 1, i32 0, i32 3, i32 2>
94 %res = select <4 x i1> %mask, <4 x double> %shufp, <4 x double> %b
98 define <2 x double> @transform_VPERMILPSrrk(<2 x double> %a, <2 x double> %b, i2 %mask_int) nounwind {
99 ; CHECK-LABEL: transform_VPERMILPSrrk:
101 ; CHECK-NEXT: kmovd %edi, %k1
102 ; CHECK-NEXT: vshufpd {{.*#+}} xmm1 {%k1} = xmm0[1,0]
103 ; CHECK-NEXT: vmovapd %xmm1, %xmm0
105 %mask = bitcast i2 %mask_int to <2 x i1>
106 %shufp = shufflevector <2 x double> %a, <2 x double> poison, <2 x i32> <i32 1, i32 0>
107 %res = select <2 x i1> %mask, <2 x double> %shufp, <2 x double> %b
108 ret <2 x double> %res
111 define <8 x double> @transform_VPERMILPSZrm(ptr %ap) nounwind {
112 ; CHECK-LABEL: transform_VPERMILPSZrm:
114 ; CHECK-NEXT: vpermilpd {{.*#+}} zmm0 = mem[1,0,2,3,4,5,6,7]
116 %a = load <8 x double>, ptr %ap
117 %shufp = shufflevector <8 x double> %a, <8 x double> poison, <8 x i32> <i32 1, i32 0, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
118 ret <8 x double> %shufp
121 define <4 x double> @transform_VPERMILPSYrm(ptr %ap) nounwind {
122 ; CHECK-LABEL: transform_VPERMILPSYrm:
124 ; CHECK-NEXT: vpermilpd {{.*#+}} ymm0 = mem[0,1,3,2]
126 %a = load <4 x double>, ptr %ap
127 %shufp = shufflevector <4 x double> %a, <4 x double> poison, <4 x i32> <i32 0, i32 1, i32 3, i32 2>
128 ret <4 x double> %shufp
131 define <2 x double> @transform_VPERMILPSrm(ptr %ap) nounwind {
132 ; CHECK-LABEL: transform_VPERMILPSrm:
134 ; CHECK-NEXT: vpermilpd {{.*#+}} xmm0 = mem[1,0]
136 %a = load <2 x double>, ptr %ap
137 %shufp = shufflevector <2 x double> %a, <2 x double> poison, <2 x i32> <i32 1, i32 0>
138 ret <2 x double> %shufp
141 define <8 x double> @transform_VPERMILPSZrmkz(ptr %ap, i8 %mask_int) nounwind {
142 ; CHECK-LABEL: transform_VPERMILPSZrmkz:
144 ; CHECK-NEXT: kmovd %esi, %k1
145 ; CHECK-NEXT: vpermilpd {{.*#+}} zmm0 {%k1} {z} = mem[1,0,2,3,4,5,7,6]
147 %mask = bitcast i8 %mask_int to <8 x i1>
148 %a = load <8 x double>, ptr %ap
149 %shufp = shufflevector <8 x double> %a, <8 x double> poison, <8 x i32> <i32 1, i32 0, i32 2, i32 3, i32 4, i32 5, i32 7, i32 6>
150 %res = select <8 x i1> %mask, <8 x double> %shufp, <8 x double> zeroinitializer
151 ret <8 x double> %res
154 define <4 x double> @transform_VPERMILPSYrmkz(ptr %ap, i4 %mask_int) nounwind {
155 ; CHECK-LABEL: transform_VPERMILPSYrmkz:
157 ; CHECK-NEXT: kmovd %esi, %k1
158 ; CHECK-NEXT: vpermilpd {{.*#+}} ymm0 {%k1} {z} = mem[1,0,3,2]
160 %mask = bitcast i4 %mask_int to <4 x i1>
161 %a = load <4 x double>, ptr %ap
162 %shufp = shufflevector <4 x double> %a, <4 x double> poison, <4 x i32> <i32 1, i32 0, i32 3, i32 2>
163 %res = select <4 x i1> %mask, <4 x double> %shufp, <4 x double> zeroinitializer
164 ret <4 x double> %res
167 define <2 x double> @transform_VPERMILPSrmkz(ptr %ap, i2 %mask_int) nounwind {
168 ; CHECK-LABEL: transform_VPERMILPSrmkz:
170 ; CHECK-NEXT: kmovd %esi, %k1
171 ; CHECK-NEXT: vpermilpd {{.*#+}} xmm0 {%k1} {z} = mem[1,0]
173 %mask = bitcast i2 %mask_int to <2 x i1>
174 %a = load <2 x double>, ptr %ap
175 %shufp = shufflevector <2 x double> %a, <2 x double> poison, <2 x i32> <i32 1, i32 0>
176 %res = select <2 x i1> %mask, <2 x double> %shufp, <2 x double> zeroinitializer
177 ret <2 x double> %res
180 define <8 x double> @transform_VPERMILPSZrmk(ptr %ap, <8 x double> %b, i8 %mask_int) nounwind {
181 ; CHECK-LABEL: transform_VPERMILPSZrmk:
183 ; CHECK-NEXT: kmovd %esi, %k1
184 ; CHECK-NEXT: vpermilpd {{.*#+}} zmm0 {%k1} = mem[0,1,3,2,4,5,7,6]
186 %mask = bitcast i8 %mask_int to <8 x i1>
187 %a = load <8 x double>, ptr %ap
188 %shufp = shufflevector <8 x double> %a, <8 x double> poison, <8 x i32> <i32 0, i32 1, i32 3, i32 2, i32 4, i32 5, i32 7, i32 6>
189 %res = select <8 x i1> %mask, <8 x double> %shufp, <8 x double> %b
190 ret <8 x double> %res
193 define <4 x double> @transform_VPERMILPSYrmk(ptr %ap, <4 x double> %b, i4 %mask_int) nounwind {
194 ; CHECK-LABEL: transform_VPERMILPSYrmk:
196 ; CHECK-NEXT: kmovd %esi, %k1
197 ; CHECK-NEXT: vpermilpd {{.*#+}} ymm0 {%k1} = mem[0,1,3,2]
199 %mask = bitcast i4 %mask_int to <4 x i1>
200 %a = load <4 x double>, ptr %ap
201 %shufp = shufflevector <4 x double> %a, <4 x double> poison, <4 x i32> <i32 0, i32 1, i32 3, i32 2>
202 %res = select <4 x i1> %mask, <4 x double> %shufp, <4 x double> %b
203 ret <4 x double> %res
206 define <2 x double> @transform_VPERMILPSrmk(ptr %ap, <2 x double> %b, i2 %mask_int) nounwind {
207 ; CHECK-LABEL: transform_VPERMILPSrmk:
209 ; CHECK-NEXT: kmovd %esi, %k1
210 ; CHECK-NEXT: vpermilpd {{.*#+}} xmm0 {%k1} = mem[1,0]
212 %mask = bitcast i2 %mask_int to <2 x i1>
213 %a = load <2 x double>, ptr %ap
214 %shufp = shufflevector <2 x double> %a, <2 x double> poison, <2 x i32> <i32 1, i32 0>
215 %res = select <2 x i1> %mask, <2 x double> %shufp, <2 x double> %b
216 ret <2 x double> %res
218 ;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
219 ; CHECK-AVX512: {{.*}}
221 ; CHECK-ICX-BYPASS-DELAY: {{.*}}
222 ; CHECK-ICX-NO-BYPASS-DELAY: {{.*}}
224 ; CHECK-ZNVER4: {{.*}}