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
8 define <8 x double> @transform_VPERMILPSZrr(<8 x double> %a) nounwind {
9 ; CHECK-LABEL: transform_VPERMILPSZrr:
11 ; CHECK-NEXT: vshufpd {{.*#+}} zmm0 = zmm0[0,1,2,3,4,5,7,6]
13 %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>
14 ret <8 x double> %shufp
17 define <4 x double> @transform_VPERMILPSYrr(<4 x double> %a) nounwind {
18 ; CHECK-LABEL: transform_VPERMILPSYrr:
20 ; CHECK-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[1,0,2,3]
22 %shufp = shufflevector <4 x double> %a, <4 x double> poison, <4 x i32> <i32 1, i32 0, i32 2, i32 3>
23 ret <4 x double> %shufp
26 define <2 x double> @transform_VPERMILPSrr(<2 x double> %a) nounwind {
27 ; CHECK-LABEL: transform_VPERMILPSrr:
29 ; CHECK-NEXT: vshufpd {{.*#+}} xmm0 = xmm0[1,0]
31 %shufp = shufflevector <2 x double> %a, <2 x double> poison, <2 x i32> <i32 1, i32 0>
32 ret <2 x double> %shufp
35 define <8 x double> @transform_VPERMILPSZrrkz(<8 x double> %a, i8 %mask_int) nounwind {
36 ; CHECK-LABEL: transform_VPERMILPSZrrkz:
38 ; CHECK-NEXT: kmovd %edi, %k1
39 ; CHECK-NEXT: vshufpd {{.*#+}} zmm0 {%k1} {z} = zmm0[0,1,2,3,5,4,6,7]
41 %mask = bitcast i8 %mask_int to <8 x i1>
42 %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>
43 %res = select <8 x i1> %mask, <8 x double> %shufp, <8 x double> zeroinitializer
47 define <4 x double> @transform_VPERMILPSYrrkz(<4 x double> %a, i4 %mask_int) nounwind {
48 ; CHECK-LABEL: transform_VPERMILPSYrrkz:
50 ; CHECK-NEXT: kmovd %edi, %k1
51 ; CHECK-NEXT: vshufpd {{.*#+}} ymm0 {%k1} {z} = ymm0[0,1,3,2]
53 %mask = bitcast i4 %mask_int to <4 x i1>
54 %shufp = shufflevector <4 x double> %a, <4 x double> poison, <4 x i32> <i32 0, i32 1, i32 3, i32 2>
55 %res = select <4 x i1> %mask, <4 x double> %shufp, <4 x double> zeroinitializer
59 define <2 x double> @transform_VPERMILPSrrkz(<2 x double> %a, i2 %mask_int) nounwind {
60 ; CHECK-LABEL: transform_VPERMILPSrrkz:
62 ; CHECK-NEXT: kmovd %edi, %k1
63 ; CHECK-NEXT: vshufpd {{.*#+}} xmm0 {%k1} {z} = xmm0[1,0]
65 %mask = bitcast i2 %mask_int to <2 x i1>
66 %shufp = shufflevector <2 x double> %a, <2 x double> poison, <2 x i32> <i32 1, i32 0>
67 %res = select <2 x i1> %mask, <2 x double> %shufp, <2 x double> zeroinitializer
71 define <8 x double> @transform_VPERMILPSZrrk(<8 x double> %a, <8 x double> %b, i8 %mask_int) nounwind {
72 ; CHECK-LABEL: transform_VPERMILPSZrrk:
74 ; CHECK-NEXT: kmovd %edi, %k1
75 ; CHECK-NEXT: vshufpd {{.*#+}} zmm1 {%k1} = zmm0[0,1,3,2,4,5,6,7]
76 ; CHECK-NEXT: vmovapd %zmm1, %zmm0
78 %mask = bitcast i8 %mask_int to <8 x i1>
79 %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>
80 %res = select <8 x i1> %mask, <8 x double> %shufp, <8 x double> %b
84 define <4 x double> @transform_VPERMILPSYrrk(<4 x double> %a, <4 x double> %b, i4 %mask_int) nounwind {
85 ; CHECK-LABEL: transform_VPERMILPSYrrk:
87 ; CHECK-NEXT: kmovd %edi, %k1
88 ; CHECK-NEXT: vshufpd {{.*#+}} ymm1 {%k1} = ymm0[1,0,3,2]
89 ; CHECK-NEXT: vmovapd %ymm1, %ymm0
91 %mask = bitcast i4 %mask_int to <4 x i1>
92 %shufp = shufflevector <4 x double> %a, <4 x double> poison, <4 x i32> <i32 1, i32 0, i32 3, i32 2>
93 %res = select <4 x i1> %mask, <4 x double> %shufp, <4 x double> %b
97 define <2 x double> @transform_VPERMILPSrrk(<2 x double> %a, <2 x double> %b, i2 %mask_int) nounwind {
98 ; CHECK-LABEL: transform_VPERMILPSrrk:
100 ; CHECK-NEXT: kmovd %edi, %k1
101 ; CHECK-NEXT: vshufpd {{.*#+}} xmm1 {%k1} = xmm0[1,0]
102 ; CHECK-NEXT: vmovapd %xmm1, %xmm0
104 %mask = bitcast i2 %mask_int to <2 x i1>
105 %shufp = shufflevector <2 x double> %a, <2 x double> poison, <2 x i32> <i32 1, i32 0>
106 %res = select <2 x i1> %mask, <2 x double> %shufp, <2 x double> %b
107 ret <2 x double> %res
110 define <8 x double> @transform_VPERMILPSZrm(ptr %ap) nounwind {
111 ; CHECK-LABEL: transform_VPERMILPSZrm:
113 ; CHECK-NEXT: vpermilpd {{.*#+}} zmm0 = mem[1,0,2,3,4,5,6,7]
115 %a = load <8 x double>, ptr %ap
116 %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>
117 ret <8 x double> %shufp
120 define <4 x double> @transform_VPERMILPSYrm(ptr %ap) nounwind {
121 ; CHECK-LABEL: transform_VPERMILPSYrm:
123 ; CHECK-NEXT: vpermilpd {{.*#+}} ymm0 = mem[0,1,3,2]
125 %a = load <4 x double>, ptr %ap
126 %shufp = shufflevector <4 x double> %a, <4 x double> poison, <4 x i32> <i32 0, i32 1, i32 3, i32 2>
127 ret <4 x double> %shufp
130 define <2 x double> @transform_VPERMILPSrm(ptr %ap) nounwind {
131 ; CHECK-LABEL: transform_VPERMILPSrm:
133 ; CHECK-NEXT: vpermilpd {{.*#+}} xmm0 = mem[1,0]
135 %a = load <2 x double>, ptr %ap
136 %shufp = shufflevector <2 x double> %a, <2 x double> poison, <2 x i32> <i32 1, i32 0>
137 ret <2 x double> %shufp
140 define <8 x double> @transform_VPERMILPSZrmkz(ptr %ap, i8 %mask_int) nounwind {
141 ; CHECK-LABEL: transform_VPERMILPSZrmkz:
143 ; CHECK-NEXT: kmovd %esi, %k1
144 ; CHECK-NEXT: vpermilpd {{.*#+}} zmm0 {%k1} {z} = mem[1,0,2,3,4,5,7,6]
146 %mask = bitcast i8 %mask_int to <8 x i1>
147 %a = load <8 x double>, ptr %ap
148 %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>
149 %res = select <8 x i1> %mask, <8 x double> %shufp, <8 x double> zeroinitializer
150 ret <8 x double> %res
153 define <4 x double> @transform_VPERMILPSYrmkz(ptr %ap, i4 %mask_int) nounwind {
154 ; CHECK-LABEL: transform_VPERMILPSYrmkz:
156 ; CHECK-NEXT: kmovd %esi, %k1
157 ; CHECK-NEXT: vpermilpd {{.*#+}} ymm0 {%k1} {z} = mem[1,0,3,2]
159 %mask = bitcast i4 %mask_int to <4 x i1>
160 %a = load <4 x double>, ptr %ap
161 %shufp = shufflevector <4 x double> %a, <4 x double> poison, <4 x i32> <i32 1, i32 0, i32 3, i32 2>
162 %res = select <4 x i1> %mask, <4 x double> %shufp, <4 x double> zeroinitializer
163 ret <4 x double> %res
166 define <2 x double> @transform_VPERMILPSrmkz(ptr %ap, i2 %mask_int) nounwind {
167 ; CHECK-LABEL: transform_VPERMILPSrmkz:
169 ; CHECK-NEXT: kmovd %esi, %k1
170 ; CHECK-NEXT: vpermilpd {{.*#+}} xmm0 {%k1} {z} = mem[1,0]
172 %mask = bitcast i2 %mask_int to <2 x i1>
173 %a = load <2 x double>, ptr %ap
174 %shufp = shufflevector <2 x double> %a, <2 x double> poison, <2 x i32> <i32 1, i32 0>
175 %res = select <2 x i1> %mask, <2 x double> %shufp, <2 x double> zeroinitializer
176 ret <2 x double> %res
179 define <8 x double> @transform_VPERMILPSZrmk(ptr %ap, <8 x double> %b, i8 %mask_int) nounwind {
180 ; CHECK-LABEL: transform_VPERMILPSZrmk:
182 ; CHECK-NEXT: kmovd %esi, %k1
183 ; CHECK-NEXT: vpermilpd {{.*#+}} zmm0 {%k1} = mem[0,1,3,2,4,5,7,6]
185 %mask = bitcast i8 %mask_int to <8 x i1>
186 %a = load <8 x double>, ptr %ap
187 %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>
188 %res = select <8 x i1> %mask, <8 x double> %shufp, <8 x double> %b
189 ret <8 x double> %res
192 define <4 x double> @transform_VPERMILPSYrmk(ptr %ap, <4 x double> %b, i4 %mask_int) nounwind {
193 ; CHECK-LABEL: transform_VPERMILPSYrmk:
195 ; CHECK-NEXT: kmovd %esi, %k1
196 ; CHECK-NEXT: vpermilpd {{.*#+}} ymm0 {%k1} = mem[0,1,3,2]
198 %mask = bitcast i4 %mask_int to <4 x i1>
199 %a = load <4 x double>, ptr %ap
200 %shufp = shufflevector <4 x double> %a, <4 x double> poison, <4 x i32> <i32 0, i32 1, i32 3, i32 2>
201 %res = select <4 x i1> %mask, <4 x double> %shufp, <4 x double> %b
202 ret <4 x double> %res
205 define <2 x double> @transform_VPERMILPSrmk(ptr %ap, <2 x double> %b, i2 %mask_int) nounwind {
206 ; CHECK-LABEL: transform_VPERMILPSrmk:
208 ; CHECK-NEXT: kmovd %esi, %k1
209 ; CHECK-NEXT: vpermilpd {{.*#+}} xmm0 {%k1} = mem[1,0]
211 %mask = bitcast i2 %mask_int to <2 x i1>
212 %a = load <2 x double>, ptr %ap
213 %shufp = shufflevector <2 x double> %a, <2 x double> poison, <2 x i32> <i32 1, i32 0>
214 %res = select <2 x i1> %mask, <2 x double> %shufp, <2 x double> %b
215 ret <2 x double> %res
217 ;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
218 ; CHECK-AVX512: {{.*}}
220 ; CHECK-ICX-BYPASS-DELAY: {{.*}}
221 ; CHECK-ICX-NO-BYPASS-DELAY: {{.*}}
223 ; CHECK-ZNVER4: {{.*}}