1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -disable-peephole -mtriple=i386-apple-darwin -mattr=+sse4.1 -show-mc-encoding | FileCheck %s --check-prefixes=CHECK,X86,SSE,X86-SSE
3 ; RUN: llc < %s -disable-peephole -mtriple=i386-apple-darwin -mattr=+avx -show-mc-encoding | FileCheck %s --check-prefixes=CHECK,X86,AVX,X86-AVX,AVX1,X86-AVX1
4 ; RUN: llc < %s -disable-peephole -mtriple=i386-apple-darwin -mattr=+avx512f,+avx512bw,+avx512dq,+avx512vl -show-mc-encoding | FileCheck %s --check-prefixes=CHECK,X86,AVX,X86-AVX,AVX512,X86-AVX512
5 ; RUN: llc < %s -disable-peephole -mtriple=x86_64-apple-darwin -mattr=+sse4.1 -show-mc-encoding | FileCheck %s --check-prefixes=CHECK,X64,SSE,X64-SSE
6 ; RUN: llc < %s -disable-peephole -mtriple=x86_64-apple-darwin -mattr=+avx -show-mc-encoding | FileCheck %s --check-prefixes=CHECK,X64,AVX,X64-AVX,AVX1,X64-AVX1
7 ; RUN: llc < %s -disable-peephole -mtriple=x86_64-apple-darwin -mattr=+avx512f,+avx512bw,+avx512dq,+avx512vl -show-mc-encoding | FileCheck %s --check-prefixes=CHECK,X64,AVX,X64-AVX,AVX512,X64-AVX512
9 @g16 = external global i16
11 define <4 x i32> @pinsrd_1(i32 %s, <4 x i32> %tmp) nounwind {
12 ; X86-SSE-LABEL: pinsrd_1:
14 ; X86-SSE-NEXT: pinsrd $1, {{[0-9]+}}(%esp), %xmm0 ## encoding: [0x66,0x0f,0x3a,0x22,0x44,0x24,0x04,0x01]
15 ; X86-SSE-NEXT: retl ## encoding: [0xc3]
17 ; X86-AVX1-LABEL: pinsrd_1:
19 ; X86-AVX1-NEXT: vpinsrd $1, {{[0-9]+}}(%esp), %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x22,0x44,0x24,0x04,0x01]
20 ; X86-AVX1-NEXT: retl ## encoding: [0xc3]
22 ; X86-AVX512-LABEL: pinsrd_1:
23 ; X86-AVX512: ## %bb.0:
24 ; X86-AVX512-NEXT: vpinsrd $1, {{[0-9]+}}(%esp), %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x22,0x44,0x24,0x04,0x01]
25 ; X86-AVX512-NEXT: retl ## encoding: [0xc3]
27 ; X64-SSE-LABEL: pinsrd_1:
29 ; X64-SSE-NEXT: pinsrd $1, %edi, %xmm0 ## encoding: [0x66,0x0f,0x3a,0x22,0xc7,0x01]
30 ; X64-SSE-NEXT: retq ## encoding: [0xc3]
32 ; X64-AVX1-LABEL: pinsrd_1:
34 ; X64-AVX1-NEXT: vpinsrd $1, %edi, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x22,0xc7,0x01]
35 ; X64-AVX1-NEXT: retq ## encoding: [0xc3]
37 ; X64-AVX512-LABEL: pinsrd_1:
38 ; X64-AVX512: ## %bb.0:
39 ; X64-AVX512-NEXT: vpinsrd $1, %edi, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x22,0xc7,0x01]
40 ; X64-AVX512-NEXT: retq ## encoding: [0xc3]
41 %tmp1 = insertelement <4 x i32> %tmp, i32 %s, i32 1
45 define <16 x i8> @pinsrb_1(i8 %s, <16 x i8> %tmp) nounwind {
46 ; X86-SSE-LABEL: pinsrb_1:
48 ; X86-SSE-NEXT: pinsrb $1, {{[0-9]+}}(%esp), %xmm0 ## encoding: [0x66,0x0f,0x3a,0x20,0x44,0x24,0x04,0x01]
49 ; X86-SSE-NEXT: retl ## encoding: [0xc3]
51 ; X86-AVX1-LABEL: pinsrb_1:
53 ; X86-AVX1-NEXT: vpinsrb $1, {{[0-9]+}}(%esp), %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x20,0x44,0x24,0x04,0x01]
54 ; X86-AVX1-NEXT: retl ## encoding: [0xc3]
56 ; X86-AVX512-LABEL: pinsrb_1:
57 ; X86-AVX512: ## %bb.0:
58 ; X86-AVX512-NEXT: vpinsrb $1, {{[0-9]+}}(%esp), %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x20,0x44,0x24,0x04,0x01]
59 ; X86-AVX512-NEXT: retl ## encoding: [0xc3]
61 ; X64-SSE-LABEL: pinsrb_1:
63 ; X64-SSE-NEXT: pinsrb $1, %edi, %xmm0 ## encoding: [0x66,0x0f,0x3a,0x20,0xc7,0x01]
64 ; X64-SSE-NEXT: retq ## encoding: [0xc3]
66 ; X64-AVX1-LABEL: pinsrb_1:
68 ; X64-AVX1-NEXT: vpinsrb $1, %edi, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x20,0xc7,0x01]
69 ; X64-AVX1-NEXT: retq ## encoding: [0xc3]
71 ; X64-AVX512-LABEL: pinsrb_1:
72 ; X64-AVX512: ## %bb.0:
73 ; X64-AVX512-NEXT: vpinsrb $1, %edi, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x20,0xc7,0x01]
74 ; X64-AVX512-NEXT: retq ## encoding: [0xc3]
75 %tmp1 = insertelement <16 x i8> %tmp, i8 %s, i32 1
79 define <2 x i64> @pmovzxbq_1() nounwind {
80 ; X86-SSE-LABEL: pmovzxbq_1:
81 ; X86-SSE: ## %bb.0: ## %entry
82 ; X86-SSE-NEXT: movl L_g16$non_lazy_ptr, %eax ## encoding: [0xa1,A,A,A,A]
83 ; X86-SSE-NEXT: ## fixup A - offset: 1, value: L_g16$non_lazy_ptr, kind: FK_Data_4
84 ; X86-SSE-NEXT: pmovzxbq (%eax), %xmm0 ## encoding: [0x66,0x0f,0x38,0x32,0x00]
85 ; X86-SSE-NEXT: ## xmm0 = mem[0],zero,zero,zero,zero,zero,zero,zero,mem[1],zero,zero,zero,zero,zero,zero,zero
86 ; X86-SSE-NEXT: retl ## encoding: [0xc3]
88 ; X86-AVX1-LABEL: pmovzxbq_1:
89 ; X86-AVX1: ## %bb.0: ## %entry
90 ; X86-AVX1-NEXT: movl L_g16$non_lazy_ptr, %eax ## encoding: [0xa1,A,A,A,A]
91 ; X86-AVX1-NEXT: ## fixup A - offset: 1, value: L_g16$non_lazy_ptr, kind: FK_Data_4
92 ; X86-AVX1-NEXT: vpmovzxbq (%eax), %xmm0 ## encoding: [0xc4,0xe2,0x79,0x32,0x00]
93 ; X86-AVX1-NEXT: ## xmm0 = mem[0],zero,zero,zero,zero,zero,zero,zero,mem[1],zero,zero,zero,zero,zero,zero,zero
94 ; X86-AVX1-NEXT: retl ## encoding: [0xc3]
96 ; X86-AVX512-LABEL: pmovzxbq_1:
97 ; X86-AVX512: ## %bb.0: ## %entry
98 ; X86-AVX512-NEXT: movl L_g16$non_lazy_ptr, %eax ## encoding: [0xa1,A,A,A,A]
99 ; X86-AVX512-NEXT: ## fixup A - offset: 1, value: L_g16$non_lazy_ptr, kind: FK_Data_4
100 ; X86-AVX512-NEXT: vpbroadcastw (%eax), %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe2,0x79,0x79,0x00]
101 ; X86-AVX512-NEXT: vpmovzxbq %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe2,0x79,0x32,0xc0]
102 ; X86-AVX512-NEXT: ## xmm0 = xmm0[0],zero,zero,zero,zero,zero,zero,zero,xmm0[1],zero,zero,zero,zero,zero,zero,zero
103 ; X86-AVX512-NEXT: retl ## encoding: [0xc3]
105 ; X64-SSE-LABEL: pmovzxbq_1:
106 ; X64-SSE: ## %bb.0: ## %entry
107 ; X64-SSE-NEXT: movq _g16@{{.*}}(%rip), %rax ## encoding: [0x48,0x8b,0x05,A,A,A,A]
108 ; X64-SSE-NEXT: ## fixup A - offset: 3, value: _g16@GOTPCREL-4, kind: reloc_riprel_4byte_movq_load
109 ; X64-SSE-NEXT: pmovzxbq (%rax), %xmm0 ## encoding: [0x66,0x0f,0x38,0x32,0x00]
110 ; X64-SSE-NEXT: ## xmm0 = mem[0],zero,zero,zero,zero,zero,zero,zero,mem[1],zero,zero,zero,zero,zero,zero,zero
111 ; X64-SSE-NEXT: retq ## encoding: [0xc3]
113 ; X64-AVX1-LABEL: pmovzxbq_1:
114 ; X64-AVX1: ## %bb.0: ## %entry
115 ; X64-AVX1-NEXT: movq _g16@{{.*}}(%rip), %rax ## encoding: [0x48,0x8b,0x05,A,A,A,A]
116 ; X64-AVX1-NEXT: ## fixup A - offset: 3, value: _g16@GOTPCREL-4, kind: reloc_riprel_4byte_movq_load
117 ; X64-AVX1-NEXT: vpmovzxbq (%rax), %xmm0 ## encoding: [0xc4,0xe2,0x79,0x32,0x00]
118 ; X64-AVX1-NEXT: ## xmm0 = mem[0],zero,zero,zero,zero,zero,zero,zero,mem[1],zero,zero,zero,zero,zero,zero,zero
119 ; X64-AVX1-NEXT: retq ## encoding: [0xc3]
121 ; X64-AVX512-LABEL: pmovzxbq_1:
122 ; X64-AVX512: ## %bb.0: ## %entry
123 ; X64-AVX512-NEXT: movq _g16@{{.*}}(%rip), %rax ## encoding: [0x48,0x8b,0x05,A,A,A,A]
124 ; X64-AVX512-NEXT: ## fixup A - offset: 3, value: _g16@GOTPCREL-4, kind: reloc_riprel_4byte_movq_load
125 ; X64-AVX512-NEXT: vpbroadcastw (%rax), %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe2,0x79,0x79,0x00]
126 ; X64-AVX512-NEXT: vpmovzxbq %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe2,0x79,0x32,0xc0]
127 ; X64-AVX512-NEXT: ## xmm0 = xmm0[0],zero,zero,zero,zero,zero,zero,zero,xmm0[1],zero,zero,zero,zero,zero,zero,zero
128 ; X64-AVX512-NEXT: retq ## encoding: [0xc3]
130 %0 = load i16, i16* @g16, align 2 ; <i16> [#uses=1]
131 %1 = insertelement <8 x i16> undef, i16 %0, i32 0 ; <<8 x i16>> [#uses=1]
132 %2 = bitcast <8 x i16> %1 to <16 x i8> ; <<16 x i8>> [#uses=1]
133 %3 = tail call <2 x i64> @llvm.x86.sse41.pmovzxbq(<16 x i8> %2) nounwind readnone ; <<2 x i64>> [#uses=1]
137 declare <2 x i64> @llvm.x86.sse41.pmovzxbq(<16 x i8>) nounwind readnone
139 define i32 @extractps_1(<4 x float> %v) nounwind {
140 ; SSE-LABEL: extractps_1:
142 ; SSE-NEXT: extractps $3, %xmm0, %eax ## encoding: [0x66,0x0f,0x3a,0x17,0xc0,0x03]
143 ; SSE-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
145 ; AVX1-LABEL: extractps_1:
147 ; AVX1-NEXT: vextractps $3, %xmm0, %eax ## encoding: [0xc4,0xe3,0x79,0x17,0xc0,0x03]
148 ; AVX1-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
150 ; AVX512-LABEL: extractps_1:
152 ; AVX512-NEXT: vextractps $3, %xmm0, %eax ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x17,0xc0,0x03]
153 ; AVX512-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
154 %s = extractelement <4 x float> %v, i32 3
155 %i = bitcast float %s to i32
158 define i32 @extractps_2(<4 x float> %v) nounwind {
159 ; SSE-LABEL: extractps_2:
161 ; SSE-NEXT: extractps $3, %xmm0, %eax ## encoding: [0x66,0x0f,0x3a,0x17,0xc0,0x03]
162 ; SSE-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
164 ; AVX1-LABEL: extractps_2:
166 ; AVX1-NEXT: vextractps $3, %xmm0, %eax ## encoding: [0xc4,0xe3,0x79,0x17,0xc0,0x03]
167 ; AVX1-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
169 ; AVX512-LABEL: extractps_2:
171 ; AVX512-NEXT: vextractps $3, %xmm0, %eax ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x17,0xc0,0x03]
172 ; AVX512-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
173 %t = bitcast <4 x float> %v to <4 x i32>
174 %s = extractelement <4 x i32> %t, i32 3
179 ; The non-store form of extractps puts its result into a GPR.
180 ; This makes it suitable for an extract from a <4 x float> that
181 ; is bitcasted to i32, but unsuitable for much of anything else.
183 define float @ext_1(<4 x float> %v) nounwind {
184 ; X86-SSE-LABEL: ext_1:
186 ; X86-SSE-NEXT: pushl %eax ## encoding: [0x50]
187 ; X86-SSE-NEXT: shufps $231, %xmm0, %xmm0 ## encoding: [0x0f,0xc6,0xc0,0xe7]
188 ; X86-SSE-NEXT: ## xmm0 = xmm0[3,1,2,3]
189 ; X86-SSE-NEXT: addss LCPI5_0, %xmm0 ## encoding: [0xf3,0x0f,0x58,0x05,A,A,A,A]
190 ; X86-SSE-NEXT: ## fixup A - offset: 4, value: LCPI5_0, kind: FK_Data_4
191 ; X86-SSE-NEXT: movss %xmm0, (%esp) ## encoding: [0xf3,0x0f,0x11,0x04,0x24]
192 ; X86-SSE-NEXT: flds (%esp) ## encoding: [0xd9,0x04,0x24]
193 ; X86-SSE-NEXT: popl %eax ## encoding: [0x58]
194 ; X86-SSE-NEXT: retl ## encoding: [0xc3]
196 ; X86-AVX1-LABEL: ext_1:
197 ; X86-AVX1: ## %bb.0:
198 ; X86-AVX1-NEXT: pushl %eax ## encoding: [0x50]
199 ; X86-AVX1-NEXT: vpermilps $231, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x04,0xc0,0xe7]
200 ; X86-AVX1-NEXT: ## xmm0 = xmm0[3,1,2,3]
201 ; X86-AVX1-NEXT: vaddss LCPI5_0, %xmm0, %xmm0 ## encoding: [0xc5,0xfa,0x58,0x05,A,A,A,A]
202 ; X86-AVX1-NEXT: ## fixup A - offset: 4, value: LCPI5_0, kind: FK_Data_4
203 ; X86-AVX1-NEXT: vmovss %xmm0, (%esp) ## encoding: [0xc5,0xfa,0x11,0x04,0x24]
204 ; X86-AVX1-NEXT: flds (%esp) ## encoding: [0xd9,0x04,0x24]
205 ; X86-AVX1-NEXT: popl %eax ## encoding: [0x58]
206 ; X86-AVX1-NEXT: retl ## encoding: [0xc3]
208 ; X86-AVX512-LABEL: ext_1:
209 ; X86-AVX512: ## %bb.0:
210 ; X86-AVX512-NEXT: pushl %eax ## encoding: [0x50]
211 ; X86-AVX512-NEXT: vpermilps $231, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x04,0xc0,0xe7]
212 ; X86-AVX512-NEXT: ## xmm0 = xmm0[3,1,2,3]
213 ; X86-AVX512-NEXT: vaddss LCPI5_0, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc5,0xfa,0x58,0x05,A,A,A,A]
214 ; X86-AVX512-NEXT: ## fixup A - offset: 4, value: LCPI5_0, kind: FK_Data_4
215 ; X86-AVX512-NEXT: vmovss %xmm0, (%esp) ## EVEX TO VEX Compression encoding: [0xc5,0xfa,0x11,0x04,0x24]
216 ; X86-AVX512-NEXT: flds (%esp) ## encoding: [0xd9,0x04,0x24]
217 ; X86-AVX512-NEXT: popl %eax ## encoding: [0x58]
218 ; X86-AVX512-NEXT: retl ## encoding: [0xc3]
220 ; X64-SSE-LABEL: ext_1:
222 ; X64-SSE-NEXT: shufps $231, %xmm0, %xmm0 ## encoding: [0x0f,0xc6,0xc0,0xe7]
223 ; X64-SSE-NEXT: ## xmm0 = xmm0[3,1,2,3]
224 ; X64-SSE-NEXT: addss {{.*}}(%rip), %xmm0 ## encoding: [0xf3,0x0f,0x58,0x05,A,A,A,A]
225 ; X64-SSE-NEXT: ## fixup A - offset: 4, value: LCPI5_0-4, kind: reloc_riprel_4byte
226 ; X64-SSE-NEXT: retq ## encoding: [0xc3]
228 ; X64-AVX1-LABEL: ext_1:
229 ; X64-AVX1: ## %bb.0:
230 ; X64-AVX1-NEXT: vpermilps $231, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x04,0xc0,0xe7]
231 ; X64-AVX1-NEXT: ## xmm0 = xmm0[3,1,2,3]
232 ; X64-AVX1-NEXT: vaddss {{.*}}(%rip), %xmm0, %xmm0 ## encoding: [0xc5,0xfa,0x58,0x05,A,A,A,A]
233 ; X64-AVX1-NEXT: ## fixup A - offset: 4, value: LCPI5_0-4, kind: reloc_riprel_4byte
234 ; X64-AVX1-NEXT: retq ## encoding: [0xc3]
236 ; X64-AVX512-LABEL: ext_1:
237 ; X64-AVX512: ## %bb.0:
238 ; X64-AVX512-NEXT: vpermilps $231, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x04,0xc0,0xe7]
239 ; X64-AVX512-NEXT: ## xmm0 = xmm0[3,1,2,3]
240 ; X64-AVX512-NEXT: vaddss {{.*}}(%rip), %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc5,0xfa,0x58,0x05,A,A,A,A]
241 ; X64-AVX512-NEXT: ## fixup A - offset: 4, value: LCPI5_0-4, kind: reloc_riprel_4byte
242 ; X64-AVX512-NEXT: retq ## encoding: [0xc3]
243 %s = extractelement <4 x float> %v, i32 3
244 %t = fadd float %s, 1.0
248 define float @ext_2(<4 x float> %v) nounwind {
249 ; X86-SSE-LABEL: ext_2:
251 ; X86-SSE-NEXT: pushl %eax ## encoding: [0x50]
252 ; X86-SSE-NEXT: shufps $231, %xmm0, %xmm0 ## encoding: [0x0f,0xc6,0xc0,0xe7]
253 ; X86-SSE-NEXT: ## xmm0 = xmm0[3,1,2,3]
254 ; X86-SSE-NEXT: movss %xmm0, (%esp) ## encoding: [0xf3,0x0f,0x11,0x04,0x24]
255 ; X86-SSE-NEXT: flds (%esp) ## encoding: [0xd9,0x04,0x24]
256 ; X86-SSE-NEXT: popl %eax ## encoding: [0x58]
257 ; X86-SSE-NEXT: retl ## encoding: [0xc3]
259 ; X86-AVX1-LABEL: ext_2:
260 ; X86-AVX1: ## %bb.0:
261 ; X86-AVX1-NEXT: pushl %eax ## encoding: [0x50]
262 ; X86-AVX1-NEXT: vpermilps $231, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x04,0xc0,0xe7]
263 ; X86-AVX1-NEXT: ## xmm0 = xmm0[3,1,2,3]
264 ; X86-AVX1-NEXT: vmovss %xmm0, (%esp) ## encoding: [0xc5,0xfa,0x11,0x04,0x24]
265 ; X86-AVX1-NEXT: flds (%esp) ## encoding: [0xd9,0x04,0x24]
266 ; X86-AVX1-NEXT: popl %eax ## encoding: [0x58]
267 ; X86-AVX1-NEXT: retl ## encoding: [0xc3]
269 ; X86-AVX512-LABEL: ext_2:
270 ; X86-AVX512: ## %bb.0:
271 ; X86-AVX512-NEXT: pushl %eax ## encoding: [0x50]
272 ; X86-AVX512-NEXT: vpermilps $231, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x04,0xc0,0xe7]
273 ; X86-AVX512-NEXT: ## xmm0 = xmm0[3,1,2,3]
274 ; X86-AVX512-NEXT: vmovss %xmm0, (%esp) ## EVEX TO VEX Compression encoding: [0xc5,0xfa,0x11,0x04,0x24]
275 ; X86-AVX512-NEXT: flds (%esp) ## encoding: [0xd9,0x04,0x24]
276 ; X86-AVX512-NEXT: popl %eax ## encoding: [0x58]
277 ; X86-AVX512-NEXT: retl ## encoding: [0xc3]
279 ; X64-SSE-LABEL: ext_2:
281 ; X64-SSE-NEXT: shufps $231, %xmm0, %xmm0 ## encoding: [0x0f,0xc6,0xc0,0xe7]
282 ; X64-SSE-NEXT: ## xmm0 = xmm0[3,1,2,3]
283 ; X64-SSE-NEXT: retq ## encoding: [0xc3]
285 ; X64-AVX1-LABEL: ext_2:
286 ; X64-AVX1: ## %bb.0:
287 ; X64-AVX1-NEXT: vpermilps $231, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x04,0xc0,0xe7]
288 ; X64-AVX1-NEXT: ## xmm0 = xmm0[3,1,2,3]
289 ; X64-AVX1-NEXT: retq ## encoding: [0xc3]
291 ; X64-AVX512-LABEL: ext_2:
292 ; X64-AVX512: ## %bb.0:
293 ; X64-AVX512-NEXT: vpermilps $231, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x04,0xc0,0xe7]
294 ; X64-AVX512-NEXT: ## xmm0 = xmm0[3,1,2,3]
295 ; X64-AVX512-NEXT: retq ## encoding: [0xc3]
296 %s = extractelement <4 x float> %v, i32 3
300 define i32 @ext_3(<4 x i32> %v) nounwind {
303 ; SSE-NEXT: extractps $3, %xmm0, %eax ## encoding: [0x66,0x0f,0x3a,0x17,0xc0,0x03]
304 ; SSE-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
308 ; AVX1-NEXT: vextractps $3, %xmm0, %eax ## encoding: [0xc4,0xe3,0x79,0x17,0xc0,0x03]
309 ; AVX1-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
311 ; AVX512-LABEL: ext_3:
313 ; AVX512-NEXT: vextractps $3, %xmm0, %eax ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x17,0xc0,0x03]
314 ; AVX512-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
315 %i = extractelement <4 x i32> %v, i32 3
319 define <4 x float> @insertps_1(<4 x float> %t1, <4 x float> %t2) nounwind {
320 ; SSE-LABEL: insertps_1:
322 ; SSE-NEXT: insertps $21, %xmm1, %xmm0 ## encoding: [0x66,0x0f,0x3a,0x21,0xc1,0x15]
323 ; SSE-NEXT: ## xmm0 = zero,xmm1[0],zero,xmm0[3]
324 ; SSE-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
326 ; AVX1-LABEL: insertps_1:
328 ; AVX1-NEXT: vinsertps $21, %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x21,0xc1,0x15]
329 ; AVX1-NEXT: ## xmm0 = zero,xmm1[0],zero,xmm0[3]
330 ; AVX1-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
332 ; AVX512-LABEL: insertps_1:
334 ; AVX512-NEXT: vinsertps $21, %xmm1, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x21,0xc1,0x15]
335 ; AVX512-NEXT: ## xmm0 = zero,xmm1[0],zero,xmm0[3]
336 ; AVX512-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
337 %tmp1 = call <4 x float> @llvm.x86.sse41.insertps(<4 x float> %t1, <4 x float> %t2, i32 21) nounwind readnone
338 ret <4 x float> %tmp1
341 declare <4 x float> @llvm.x86.sse41.insertps(<4 x float>, <4 x float>, i32) nounwind readnone
343 ; When optimizing for speed, prefer blendps over insertps even if it means we have to
344 ; generate a separate movss to load the scalar operand.
345 define <4 x float> @blendps_not_insertps_1(<4 x float> %t1, float %t2) nounwind {
346 ; X86-SSE-LABEL: blendps_not_insertps_1:
348 ; X86-SSE-NEXT: movss {{[0-9]+}}(%esp), %xmm1 ## encoding: [0xf3,0x0f,0x10,0x4c,0x24,0x04]
349 ; X86-SSE-NEXT: ## xmm1 = mem[0],zero,zero,zero
350 ; X86-SSE-NEXT: blendps $1, %xmm1, %xmm0 ## encoding: [0x66,0x0f,0x3a,0x0c,0xc1,0x01]
351 ; X86-SSE-NEXT: ## xmm0 = xmm1[0],xmm0[1,2,3]
352 ; X86-SSE-NEXT: retl ## encoding: [0xc3]
354 ; X86-AVX1-LABEL: blendps_not_insertps_1:
355 ; X86-AVX1: ## %bb.0:
356 ; X86-AVX1-NEXT: vmovss {{[0-9]+}}(%esp), %xmm1 ## encoding: [0xc5,0xfa,0x10,0x4c,0x24,0x04]
357 ; X86-AVX1-NEXT: ## xmm1 = mem[0],zero,zero,zero
358 ; X86-AVX1-NEXT: vblendps $1, %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x0c,0xc1,0x01]
359 ; X86-AVX1-NEXT: ## xmm0 = xmm1[0],xmm0[1,2,3]
360 ; X86-AVX1-NEXT: retl ## encoding: [0xc3]
362 ; X86-AVX512-LABEL: blendps_not_insertps_1:
363 ; X86-AVX512: ## %bb.0:
364 ; X86-AVX512-NEXT: vmovss {{[0-9]+}}(%esp), %xmm1 ## EVEX TO VEX Compression encoding: [0xc5,0xfa,0x10,0x4c,0x24,0x04]
365 ; X86-AVX512-NEXT: ## xmm1 = mem[0],zero,zero,zero
366 ; X86-AVX512-NEXT: vblendps $1, %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x0c,0xc1,0x01]
367 ; X86-AVX512-NEXT: ## xmm0 = xmm1[0],xmm0[1,2,3]
368 ; X86-AVX512-NEXT: retl ## encoding: [0xc3]
370 ; X64-SSE-LABEL: blendps_not_insertps_1:
372 ; X64-SSE-NEXT: blendps $1, %xmm1, %xmm0 ## encoding: [0x66,0x0f,0x3a,0x0c,0xc1,0x01]
373 ; X64-SSE-NEXT: ## xmm0 = xmm1[0],xmm0[1,2,3]
374 ; X64-SSE-NEXT: retq ## encoding: [0xc3]
376 ; X64-AVX-LABEL: blendps_not_insertps_1:
378 ; X64-AVX-NEXT: vblendps $1, %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x0c,0xc1,0x01]
379 ; X64-AVX-NEXT: ## xmm0 = xmm1[0],xmm0[1,2,3]
380 ; X64-AVX-NEXT: retq ## encoding: [0xc3]
381 %tmp1 = insertelement <4 x float> %t1, float %t2, i32 0
382 ret <4 x float> %tmp1
385 ; When optimizing for size, generate an insertps if there's a load fold opportunity.
386 ; The difference between i386 and x86-64 ABIs for the float operand means we should
387 ; generate an insertps for X86 but not for X64!
388 define <4 x float> @insertps_or_blendps(<4 x float> %t1, float %t2) minsize nounwind {
389 ; X86-SSE-LABEL: insertps_or_blendps:
391 ; X86-SSE-NEXT: movss {{[0-9]+}}(%esp), %xmm1 ## encoding: [0xf3,0x0f,0x10,0x4c,0x24,0x04]
392 ; X86-SSE-NEXT: ## xmm1 = mem[0],zero,zero,zero
393 ; X86-SSE-NEXT: movss %xmm1, %xmm0 ## encoding: [0xf3,0x0f,0x10,0xc1]
394 ; X86-SSE-NEXT: ## xmm0 = xmm1[0],xmm0[1,2,3]
395 ; X86-SSE-NEXT: retl ## encoding: [0xc3]
397 ; X86-AVX1-LABEL: insertps_or_blendps:
398 ; X86-AVX1: ## %bb.0:
399 ; X86-AVX1-NEXT: vmovss {{[0-9]+}}(%esp), %xmm1 ## encoding: [0xc5,0xfa,0x10,0x4c,0x24,0x04]
400 ; X86-AVX1-NEXT: ## xmm1 = mem[0],zero,zero,zero
401 ; X86-AVX1-NEXT: vmovss %xmm1, %xmm0, %xmm0 ## encoding: [0xc5,0xfa,0x10,0xc1]
402 ; X86-AVX1-NEXT: ## xmm0 = xmm1[0],xmm0[1,2,3]
403 ; X86-AVX1-NEXT: retl ## encoding: [0xc3]
405 ; X86-AVX512-LABEL: insertps_or_blendps:
406 ; X86-AVX512: ## %bb.0:
407 ; X86-AVX512-NEXT: vmovss {{[0-9]+}}(%esp), %xmm1 ## EVEX TO VEX Compression encoding: [0xc5,0xfa,0x10,0x4c,0x24,0x04]
408 ; X86-AVX512-NEXT: ## xmm1 = mem[0],zero,zero,zero
409 ; X86-AVX512-NEXT: vmovss %xmm1, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc5,0xfa,0x10,0xc1]
410 ; X86-AVX512-NEXT: ## xmm0 = xmm1[0],xmm0[1,2,3]
411 ; X86-AVX512-NEXT: retl ## encoding: [0xc3]
413 ; X64-SSE-LABEL: insertps_or_blendps:
415 ; X64-SSE-NEXT: movss %xmm1, %xmm0 ## encoding: [0xf3,0x0f,0x10,0xc1]
416 ; X64-SSE-NEXT: ## xmm0 = xmm1[0],xmm0[1,2,3]
417 ; X64-SSE-NEXT: retq ## encoding: [0xc3]
419 ; X64-AVX1-LABEL: insertps_or_blendps:
420 ; X64-AVX1: ## %bb.0:
421 ; X64-AVX1-NEXT: vmovss %xmm1, %xmm0, %xmm0 ## encoding: [0xc5,0xfa,0x10,0xc1]
422 ; X64-AVX1-NEXT: ## xmm0 = xmm1[0],xmm0[1,2,3]
423 ; X64-AVX1-NEXT: retq ## encoding: [0xc3]
425 ; X64-AVX512-LABEL: insertps_or_blendps:
426 ; X64-AVX512: ## %bb.0:
427 ; X64-AVX512-NEXT: vmovss %xmm1, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc5,0xfa,0x10,0xc1]
428 ; X64-AVX512-NEXT: ## xmm0 = xmm1[0],xmm0[1,2,3]
429 ; X64-AVX512-NEXT: retq ## encoding: [0xc3]
430 %tmp1 = insertelement <4 x float> %t1, float %t2, i32 0
431 ret <4 x float> %tmp1
434 ; An insert into the low 32-bits of a vector from the low 32-bits of another vector
435 ; is always just a blendps because blendps is never more expensive than insertps.
436 define <4 x float> @blendps_not_insertps_2(<4 x float> %t1, <4 x float> %t2) nounwind {
437 ; SSE-LABEL: blendps_not_insertps_2:
439 ; SSE-NEXT: blendps $1, %xmm1, %xmm0 ## encoding: [0x66,0x0f,0x3a,0x0c,0xc1,0x01]
440 ; SSE-NEXT: ## xmm0 = xmm1[0],xmm0[1,2,3]
441 ; SSE-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
443 ; AVX-LABEL: blendps_not_insertps_2:
445 ; AVX-NEXT: vblendps $1, %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x0c,0xc1,0x01]
446 ; AVX-NEXT: ## xmm0 = xmm1[0],xmm0[1,2,3]
447 ; AVX-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
448 %tmp2 = extractelement <4 x float> %t2, i32 0
449 %tmp1 = insertelement <4 x float> %t1, float %tmp2, i32 0
450 ret <4 x float> %tmp1
453 define i32 @ptestz_1(<2 x i64> %t1, <2 x i64> %t2) nounwind {
454 ; SSE-LABEL: ptestz_1:
456 ; SSE-NEXT: xorl %eax, %eax ## encoding: [0x31,0xc0]
457 ; SSE-NEXT: ptest %xmm1, %xmm0 ## encoding: [0x66,0x0f,0x38,0x17,0xc1]
458 ; SSE-NEXT: sete %al ## encoding: [0x0f,0x94,0xc0]
459 ; SSE-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
461 ; AVX-LABEL: ptestz_1:
463 ; AVX-NEXT: xorl %eax, %eax ## encoding: [0x31,0xc0]
464 ; AVX-NEXT: vptest %xmm1, %xmm0 ## encoding: [0xc4,0xe2,0x79,0x17,0xc1]
465 ; AVX-NEXT: sete %al ## encoding: [0x0f,0x94,0xc0]
466 ; AVX-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
467 %tmp1 = call i32 @llvm.x86.sse41.ptestz(<2 x i64> %t1, <2 x i64> %t2) nounwind readnone
471 define i32 @ptestz_2(<2 x i64> %t1, <2 x i64> %t2) nounwind {
472 ; SSE-LABEL: ptestz_2:
474 ; SSE-NEXT: xorl %eax, %eax ## encoding: [0x31,0xc0]
475 ; SSE-NEXT: ptest %xmm1, %xmm0 ## encoding: [0x66,0x0f,0x38,0x17,0xc1]
476 ; SSE-NEXT: setb %al ## encoding: [0x0f,0x92,0xc0]
477 ; SSE-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
479 ; AVX-LABEL: ptestz_2:
481 ; AVX-NEXT: xorl %eax, %eax ## encoding: [0x31,0xc0]
482 ; AVX-NEXT: vptest %xmm1, %xmm0 ## encoding: [0xc4,0xe2,0x79,0x17,0xc1]
483 ; AVX-NEXT: setb %al ## encoding: [0x0f,0x92,0xc0]
484 ; AVX-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
485 %tmp1 = call i32 @llvm.x86.sse41.ptestc(<2 x i64> %t1, <2 x i64> %t2) nounwind readnone
489 define i32 @ptestz_3(<2 x i64> %t1, <2 x i64> %t2) nounwind {
490 ; SSE-LABEL: ptestz_3:
492 ; SSE-NEXT: xorl %eax, %eax ## encoding: [0x31,0xc0]
493 ; SSE-NEXT: ptest %xmm1, %xmm0 ## encoding: [0x66,0x0f,0x38,0x17,0xc1]
494 ; SSE-NEXT: seta %al ## encoding: [0x0f,0x97,0xc0]
495 ; SSE-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
497 ; AVX-LABEL: ptestz_3:
499 ; AVX-NEXT: xorl %eax, %eax ## encoding: [0x31,0xc0]
500 ; AVX-NEXT: vptest %xmm1, %xmm0 ## encoding: [0xc4,0xe2,0x79,0x17,0xc1]
501 ; AVX-NEXT: seta %al ## encoding: [0x0f,0x97,0xc0]
502 ; AVX-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
503 %tmp1 = call i32 @llvm.x86.sse41.ptestnzc(<2 x i64> %t1, <2 x i64> %t2) nounwind readnone
507 declare i32 @llvm.x86.sse41.ptestz(<2 x i64>, <2 x i64>) nounwind readnone
508 declare i32 @llvm.x86.sse41.ptestc(<2 x i64>, <2 x i64>) nounwind readnone
509 declare i32 @llvm.x86.sse41.ptestnzc(<2 x i64>, <2 x i64>) nounwind readnone
511 ; This used to compile to insertps $0 + insertps $16. insertps $0 is always
513 define <2 x float> @buildvector(<2 x float> %A, <2 x float> %B) nounwind {
514 ; SSE-LABEL: buildvector:
515 ; SSE: ## %bb.0: ## %entry
516 ; SSE-NEXT: movshdup %xmm0, %xmm2 ## encoding: [0xf3,0x0f,0x16,0xd0]
517 ; SSE-NEXT: ## xmm2 = xmm0[1,1,3,3]
518 ; SSE-NEXT: movshdup %xmm1, %xmm3 ## encoding: [0xf3,0x0f,0x16,0xd9]
519 ; SSE-NEXT: ## xmm3 = xmm1[1,1,3,3]
520 ; SSE-NEXT: addss %xmm2, %xmm3 ## encoding: [0xf3,0x0f,0x58,0xda]
521 ; SSE-NEXT: addss %xmm1, %xmm0 ## encoding: [0xf3,0x0f,0x58,0xc1]
522 ; SSE-NEXT: insertps $16, %xmm3, %xmm0 ## encoding: [0x66,0x0f,0x3a,0x21,0xc3,0x10]
523 ; SSE-NEXT: ## xmm0 = xmm0[0],xmm3[0],xmm0[2,3]
524 ; SSE-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
526 ; AVX1-LABEL: buildvector:
527 ; AVX1: ## %bb.0: ## %entry
528 ; AVX1-NEXT: vmovshdup %xmm0, %xmm2 ## encoding: [0xc5,0xfa,0x16,0xd0]
529 ; AVX1-NEXT: ## xmm2 = xmm0[1,1,3,3]
530 ; AVX1-NEXT: vmovshdup %xmm1, %xmm3 ## encoding: [0xc5,0xfa,0x16,0xd9]
531 ; AVX1-NEXT: ## xmm3 = xmm1[1,1,3,3]
532 ; AVX1-NEXT: vaddss %xmm3, %xmm2, %xmm2 ## encoding: [0xc5,0xea,0x58,0xd3]
533 ; AVX1-NEXT: vaddss %xmm1, %xmm0, %xmm0 ## encoding: [0xc5,0xfa,0x58,0xc1]
534 ; AVX1-NEXT: vinsertps $16, %xmm2, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x21,0xc2,0x10]
535 ; AVX1-NEXT: ## xmm0 = xmm0[0],xmm2[0],xmm0[2,3]
536 ; AVX1-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
538 ; AVX512-LABEL: buildvector:
539 ; AVX512: ## %bb.0: ## %entry
540 ; AVX512-NEXT: vmovshdup %xmm0, %xmm2 ## EVEX TO VEX Compression encoding: [0xc5,0xfa,0x16,0xd0]
541 ; AVX512-NEXT: ## xmm2 = xmm0[1,1,3,3]
542 ; AVX512-NEXT: vmovshdup %xmm1, %xmm3 ## EVEX TO VEX Compression encoding: [0xc5,0xfa,0x16,0xd9]
543 ; AVX512-NEXT: ## xmm3 = xmm1[1,1,3,3]
544 ; AVX512-NEXT: vaddss %xmm3, %xmm2, %xmm2 ## EVEX TO VEX Compression encoding: [0xc5,0xea,0x58,0xd3]
545 ; AVX512-NEXT: vaddss %xmm1, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc5,0xfa,0x58,0xc1]
546 ; AVX512-NEXT: vinsertps $16, %xmm2, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x21,0xc2,0x10]
547 ; AVX512-NEXT: ## xmm0 = xmm0[0],xmm2[0],xmm0[2,3]
548 ; AVX512-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
550 %tmp7 = extractelement <2 x float> %A, i32 0
551 %tmp5 = extractelement <2 x float> %A, i32 1
552 %tmp3 = extractelement <2 x float> %B, i32 0
553 %tmp1 = extractelement <2 x float> %B, i32 1
554 %add.r = fadd float %tmp7, %tmp3
555 %add.i = fadd float %tmp5, %tmp1
556 %tmp11 = insertelement <2 x float> undef, float %add.r, i32 0
557 %tmp9 = insertelement <2 x float> %tmp11, float %add.i, i32 1
558 ret <2 x float> %tmp9
561 define <4 x float> @insertps_from_shufflevector_1(<4 x float> %a, <4 x float>* nocapture readonly %pb) {
562 ; X86-SSE-LABEL: insertps_from_shufflevector_1:
563 ; X86-SSE: ## %bb.0: ## %entry
564 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %eax ## encoding: [0x8b,0x44,0x24,0x04]
565 ; X86-SSE-NEXT: movaps (%eax), %xmm1 ## encoding: [0x0f,0x28,0x08]
566 ; X86-SSE-NEXT: insertps $48, %xmm1, %xmm0 ## encoding: [0x66,0x0f,0x3a,0x21,0xc1,0x30]
567 ; X86-SSE-NEXT: ## xmm0 = xmm0[0,1,2],xmm1[0]
568 ; X86-SSE-NEXT: retl ## encoding: [0xc3]
570 ; X86-AVX1-LABEL: insertps_from_shufflevector_1:
571 ; X86-AVX1: ## %bb.0: ## %entry
572 ; X86-AVX1-NEXT: movl {{[0-9]+}}(%esp), %eax ## encoding: [0x8b,0x44,0x24,0x04]
573 ; X86-AVX1-NEXT: vmovaps (%eax), %xmm1 ## encoding: [0xc5,0xf8,0x28,0x08]
574 ; X86-AVX1-NEXT: vinsertps $48, %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x21,0xc1,0x30]
575 ; X86-AVX1-NEXT: ## xmm0 = xmm0[0,1,2],xmm1[0]
576 ; X86-AVX1-NEXT: retl ## encoding: [0xc3]
578 ; X86-AVX512-LABEL: insertps_from_shufflevector_1:
579 ; X86-AVX512: ## %bb.0: ## %entry
580 ; X86-AVX512-NEXT: movl {{[0-9]+}}(%esp), %eax ## encoding: [0x8b,0x44,0x24,0x04]
581 ; X86-AVX512-NEXT: vmovaps (%eax), %xmm1 ## EVEX TO VEX Compression encoding: [0xc5,0xf8,0x28,0x08]
582 ; X86-AVX512-NEXT: vinsertps $48, %xmm1, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x21,0xc1,0x30]
583 ; X86-AVX512-NEXT: ## xmm0 = xmm0[0,1,2],xmm1[0]
584 ; X86-AVX512-NEXT: retl ## encoding: [0xc3]
586 ; X64-SSE-LABEL: insertps_from_shufflevector_1:
587 ; X64-SSE: ## %bb.0: ## %entry
588 ; X64-SSE-NEXT: movaps (%rdi), %xmm1 ## encoding: [0x0f,0x28,0x0f]
589 ; X64-SSE-NEXT: insertps $48, %xmm1, %xmm0 ## encoding: [0x66,0x0f,0x3a,0x21,0xc1,0x30]
590 ; X64-SSE-NEXT: ## xmm0 = xmm0[0,1,2],xmm1[0]
591 ; X64-SSE-NEXT: retq ## encoding: [0xc3]
593 ; X64-AVX1-LABEL: insertps_from_shufflevector_1:
594 ; X64-AVX1: ## %bb.0: ## %entry
595 ; X64-AVX1-NEXT: vmovaps (%rdi), %xmm1 ## encoding: [0xc5,0xf8,0x28,0x0f]
596 ; X64-AVX1-NEXT: vinsertps $48, %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x21,0xc1,0x30]
597 ; X64-AVX1-NEXT: ## xmm0 = xmm0[0,1,2],xmm1[0]
598 ; X64-AVX1-NEXT: retq ## encoding: [0xc3]
600 ; X64-AVX512-LABEL: insertps_from_shufflevector_1:
601 ; X64-AVX512: ## %bb.0: ## %entry
602 ; X64-AVX512-NEXT: vmovaps (%rdi), %xmm1 ## EVEX TO VEX Compression encoding: [0xc5,0xf8,0x28,0x0f]
603 ; X64-AVX512-NEXT: vinsertps $48, %xmm1, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x21,0xc1,0x30]
604 ; X64-AVX512-NEXT: ## xmm0 = xmm0[0,1,2],xmm1[0]
605 ; X64-AVX512-NEXT: retq ## encoding: [0xc3]
607 %0 = load <4 x float>, <4 x float>* %pb, align 16
608 %vecinit6 = shufflevector <4 x float> %a, <4 x float> %0, <4 x i32> <i32 0, i32 1, i32 2, i32 4>
609 ret <4 x float> %vecinit6
612 define <4 x float> @insertps_from_shufflevector_2(<4 x float> %a, <4 x float> %b) {
613 ; SSE-LABEL: insertps_from_shufflevector_2:
614 ; SSE: ## %bb.0: ## %entry
615 ; SSE-NEXT: insertps $96, %xmm1, %xmm0 ## encoding: [0x66,0x0f,0x3a,0x21,0xc1,0x60]
616 ; SSE-NEXT: ## xmm0 = xmm0[0,1],xmm1[1],xmm0[3]
617 ; SSE-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
619 ; AVX1-LABEL: insertps_from_shufflevector_2:
620 ; AVX1: ## %bb.0: ## %entry
621 ; AVX1-NEXT: vinsertps $96, %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x21,0xc1,0x60]
622 ; AVX1-NEXT: ## xmm0 = xmm0[0,1],xmm1[1],xmm0[3]
623 ; AVX1-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
625 ; AVX512-LABEL: insertps_from_shufflevector_2:
626 ; AVX512: ## %bb.0: ## %entry
627 ; AVX512-NEXT: vinsertps $96, %xmm1, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x21,0xc1,0x60]
628 ; AVX512-NEXT: ## xmm0 = xmm0[0,1],xmm1[1],xmm0[3]
629 ; AVX512-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
631 %vecinit6 = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 0, i32 1, i32 5, i32 3>
632 ret <4 x float> %vecinit6
635 ; For loading an i32 from memory into an xmm register we use pinsrd
636 ; instead of insertps
637 define <4 x i32> @pinsrd_from_shufflevector_i32(<4 x i32> %a, <4 x i32>* nocapture readonly %pb) {
638 ; X86-SSE-LABEL: pinsrd_from_shufflevector_i32:
639 ; X86-SSE: ## %bb.0: ## %entry
640 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %eax ## encoding: [0x8b,0x44,0x24,0x04]
641 ; X86-SSE-NEXT: pshufd $36, (%eax), %xmm1 ## encoding: [0x66,0x0f,0x70,0x08,0x24]
642 ; X86-SSE-NEXT: ## xmm1 = mem[0,1,2,0]
643 ; X86-SSE-NEXT: pblendw $192, %xmm1, %xmm0 ## encoding: [0x66,0x0f,0x3a,0x0e,0xc1,0xc0]
644 ; X86-SSE-NEXT: ## xmm0 = xmm0[0,1,2,3,4,5],xmm1[6,7]
645 ; X86-SSE-NEXT: retl ## encoding: [0xc3]
647 ; X86-AVX1-LABEL: pinsrd_from_shufflevector_i32:
648 ; X86-AVX1: ## %bb.0: ## %entry
649 ; X86-AVX1-NEXT: movl {{[0-9]+}}(%esp), %eax ## encoding: [0x8b,0x44,0x24,0x04]
650 ; X86-AVX1-NEXT: vpermilps $36, (%eax), %xmm1 ## encoding: [0xc4,0xe3,0x79,0x04,0x08,0x24]
651 ; X86-AVX1-NEXT: ## xmm1 = mem[0,1,2,0]
652 ; X86-AVX1-NEXT: vblendps $8, %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x0c,0xc1,0x08]
653 ; X86-AVX1-NEXT: ## xmm0 = xmm0[0,1,2],xmm1[3]
654 ; X86-AVX1-NEXT: retl ## encoding: [0xc3]
656 ; X86-AVX512-LABEL: pinsrd_from_shufflevector_i32:
657 ; X86-AVX512: ## %bb.0: ## %entry
658 ; X86-AVX512-NEXT: movl {{[0-9]+}}(%esp), %eax ## encoding: [0x8b,0x44,0x24,0x04]
659 ; X86-AVX512-NEXT: vpermilps $36, (%eax), %xmm1 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x04,0x08,0x24]
660 ; X86-AVX512-NEXT: ## xmm1 = mem[0,1,2,0]
661 ; X86-AVX512-NEXT: vblendps $8, %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x0c,0xc1,0x08]
662 ; X86-AVX512-NEXT: ## xmm0 = xmm0[0,1,2],xmm1[3]
663 ; X86-AVX512-NEXT: retl ## encoding: [0xc3]
665 ; X64-SSE-LABEL: pinsrd_from_shufflevector_i32:
666 ; X64-SSE: ## %bb.0: ## %entry
667 ; X64-SSE-NEXT: pshufd $36, (%rdi), %xmm1 ## encoding: [0x66,0x0f,0x70,0x0f,0x24]
668 ; X64-SSE-NEXT: ## xmm1 = mem[0,1,2,0]
669 ; X64-SSE-NEXT: pblendw $192, %xmm1, %xmm0 ## encoding: [0x66,0x0f,0x3a,0x0e,0xc1,0xc0]
670 ; X64-SSE-NEXT: ## xmm0 = xmm0[0,1,2,3,4,5],xmm1[6,7]
671 ; X64-SSE-NEXT: retq ## encoding: [0xc3]
673 ; X64-AVX1-LABEL: pinsrd_from_shufflevector_i32:
674 ; X64-AVX1: ## %bb.0: ## %entry
675 ; X64-AVX1-NEXT: vpermilps $36, (%rdi), %xmm1 ## encoding: [0xc4,0xe3,0x79,0x04,0x0f,0x24]
676 ; X64-AVX1-NEXT: ## xmm1 = mem[0,1,2,0]
677 ; X64-AVX1-NEXT: vblendps $8, %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x0c,0xc1,0x08]
678 ; X64-AVX1-NEXT: ## xmm0 = xmm0[0,1,2],xmm1[3]
679 ; X64-AVX1-NEXT: retq ## encoding: [0xc3]
681 ; X64-AVX512-LABEL: pinsrd_from_shufflevector_i32:
682 ; X64-AVX512: ## %bb.0: ## %entry
683 ; X64-AVX512-NEXT: vpermilps $36, (%rdi), %xmm1 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x04,0x0f,0x24]
684 ; X64-AVX512-NEXT: ## xmm1 = mem[0,1,2,0]
685 ; X64-AVX512-NEXT: vblendps $8, %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x0c,0xc1,0x08]
686 ; X64-AVX512-NEXT: ## xmm0 = xmm0[0,1,2],xmm1[3]
687 ; X64-AVX512-NEXT: retq ## encoding: [0xc3]
689 %0 = load <4 x i32>, <4 x i32>* %pb, align 16
690 %vecinit6 = shufflevector <4 x i32> %a, <4 x i32> %0, <4 x i32> <i32 0, i32 1, i32 2, i32 4>
691 ret <4 x i32> %vecinit6
694 define <4 x i32> @insertps_from_shufflevector_i32_2(<4 x i32> %a, <4 x i32> %b) {
695 ; SSE-LABEL: insertps_from_shufflevector_i32_2:
696 ; SSE: ## %bb.0: ## %entry
697 ; SSE-NEXT: pshufd $78, %xmm1, %xmm1 ## encoding: [0x66,0x0f,0x70,0xc9,0x4e]
698 ; SSE-NEXT: ## xmm1 = xmm1[2,3,0,1]
699 ; SSE-NEXT: pblendw $12, %xmm1, %xmm0 ## encoding: [0x66,0x0f,0x3a,0x0e,0xc1,0x0c]
700 ; SSE-NEXT: ## xmm0 = xmm0[0,1],xmm1[2,3],xmm0[4,5,6,7]
701 ; SSE-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
703 ; AVX1-LABEL: insertps_from_shufflevector_i32_2:
704 ; AVX1: ## %bb.0: ## %entry
705 ; AVX1-NEXT: vpermilps $78, %xmm1, %xmm1 ## encoding: [0xc4,0xe3,0x79,0x04,0xc9,0x4e]
706 ; AVX1-NEXT: ## xmm1 = xmm1[2,3,0,1]
707 ; AVX1-NEXT: vblendps $2, %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x0c,0xc1,0x02]
708 ; AVX1-NEXT: ## xmm0 = xmm0[0],xmm1[1],xmm0[2,3]
709 ; AVX1-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
711 ; AVX512-LABEL: insertps_from_shufflevector_i32_2:
712 ; AVX512: ## %bb.0: ## %entry
713 ; AVX512-NEXT: vpermilps $78, %xmm1, %xmm1 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x04,0xc9,0x4e]
714 ; AVX512-NEXT: ## xmm1 = xmm1[2,3,0,1]
715 ; AVX512-NEXT: vblendps $2, %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x0c,0xc1,0x02]
716 ; AVX512-NEXT: ## xmm0 = xmm0[0],xmm1[1],xmm0[2,3]
717 ; AVX512-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
719 %vecinit6 = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 7, i32 2, i32 3>
720 ret <4 x i32> %vecinit6
723 define <4 x float> @insertps_from_load_ins_elt_undef(<4 x float> %a, float* %b) {
724 ; X86-SSE-LABEL: insertps_from_load_ins_elt_undef:
726 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %eax ## encoding: [0x8b,0x44,0x24,0x04]
727 ; X86-SSE-NEXT: insertps $16, (%eax), %xmm0 ## encoding: [0x66,0x0f,0x3a,0x21,0x00,0x10]
728 ; X86-SSE-NEXT: ## xmm0 = xmm0[0],mem[0],xmm0[2,3]
729 ; X86-SSE-NEXT: retl ## encoding: [0xc3]
731 ; X86-AVX1-LABEL: insertps_from_load_ins_elt_undef:
732 ; X86-AVX1: ## %bb.0:
733 ; X86-AVX1-NEXT: movl {{[0-9]+}}(%esp), %eax ## encoding: [0x8b,0x44,0x24,0x04]
734 ; X86-AVX1-NEXT: vinsertps $16, (%eax), %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x21,0x00,0x10]
735 ; X86-AVX1-NEXT: ## xmm0 = xmm0[0],mem[0],xmm0[2,3]
736 ; X86-AVX1-NEXT: retl ## encoding: [0xc3]
738 ; X86-AVX512-LABEL: insertps_from_load_ins_elt_undef:
739 ; X86-AVX512: ## %bb.0:
740 ; X86-AVX512-NEXT: movl {{[0-9]+}}(%esp), %eax ## encoding: [0x8b,0x44,0x24,0x04]
741 ; X86-AVX512-NEXT: vinsertps $16, (%eax), %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x21,0x00,0x10]
742 ; X86-AVX512-NEXT: ## xmm0 = xmm0[0],mem[0],xmm0[2,3]
743 ; X86-AVX512-NEXT: retl ## encoding: [0xc3]
745 ; X64-SSE-LABEL: insertps_from_load_ins_elt_undef:
747 ; X64-SSE-NEXT: insertps $16, (%rdi), %xmm0 ## encoding: [0x66,0x0f,0x3a,0x21,0x07,0x10]
748 ; X64-SSE-NEXT: ## xmm0 = xmm0[0],mem[0],xmm0[2,3]
749 ; X64-SSE-NEXT: retq ## encoding: [0xc3]
751 ; X64-AVX1-LABEL: insertps_from_load_ins_elt_undef:
752 ; X64-AVX1: ## %bb.0:
753 ; X64-AVX1-NEXT: vinsertps $16, (%rdi), %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x21,0x07,0x10]
754 ; X64-AVX1-NEXT: ## xmm0 = xmm0[0],mem[0],xmm0[2,3]
755 ; X64-AVX1-NEXT: retq ## encoding: [0xc3]
757 ; X64-AVX512-LABEL: insertps_from_load_ins_elt_undef:
758 ; X64-AVX512: ## %bb.0:
759 ; X64-AVX512-NEXT: vinsertps $16, (%rdi), %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x21,0x07,0x10]
760 ; X64-AVX512-NEXT: ## xmm0 = xmm0[0],mem[0],xmm0[2,3]
761 ; X64-AVX512-NEXT: retq ## encoding: [0xc3]
762 %1 = load float, float* %b, align 4
763 %2 = insertelement <4 x float> undef, float %1, i32 0
764 %result = shufflevector <4 x float> %a, <4 x float> %2, <4 x i32> <i32 0, i32 4, i32 2, i32 3>
765 ret <4 x float> %result
768 ; TODO: Like on pinsrd_from_shufflevector_i32, remove this mov instr
769 define <4 x i32> @insertps_from_load_ins_elt_undef_i32(<4 x i32> %a, i32* %b) {
770 ; X86-SSE-LABEL: insertps_from_load_ins_elt_undef_i32:
772 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %eax ## encoding: [0x8b,0x44,0x24,0x04]
773 ; X86-SSE-NEXT: pinsrd $2, (%eax), %xmm0 ## encoding: [0x66,0x0f,0x3a,0x22,0x00,0x02]
774 ; X86-SSE-NEXT: retl ## encoding: [0xc3]
776 ; X86-AVX1-LABEL: insertps_from_load_ins_elt_undef_i32:
777 ; X86-AVX1: ## %bb.0:
778 ; X86-AVX1-NEXT: movl {{[0-9]+}}(%esp), %eax ## encoding: [0x8b,0x44,0x24,0x04]
779 ; X86-AVX1-NEXT: vpinsrd $2, (%eax), %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x22,0x00,0x02]
780 ; X86-AVX1-NEXT: retl ## encoding: [0xc3]
782 ; X86-AVX512-LABEL: insertps_from_load_ins_elt_undef_i32:
783 ; X86-AVX512: ## %bb.0:
784 ; X86-AVX512-NEXT: movl {{[0-9]+}}(%esp), %eax ## encoding: [0x8b,0x44,0x24,0x04]
785 ; X86-AVX512-NEXT: vpinsrd $2, (%eax), %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x22,0x00,0x02]
786 ; X86-AVX512-NEXT: retl ## encoding: [0xc3]
788 ; X64-SSE-LABEL: insertps_from_load_ins_elt_undef_i32:
790 ; X64-SSE-NEXT: pinsrd $2, (%rdi), %xmm0 ## encoding: [0x66,0x0f,0x3a,0x22,0x07,0x02]
791 ; X64-SSE-NEXT: retq ## encoding: [0xc3]
793 ; X64-AVX1-LABEL: insertps_from_load_ins_elt_undef_i32:
794 ; X64-AVX1: ## %bb.0:
795 ; X64-AVX1-NEXT: vpinsrd $2, (%rdi), %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x22,0x07,0x02]
796 ; X64-AVX1-NEXT: retq ## encoding: [0xc3]
798 ; X64-AVX512-LABEL: insertps_from_load_ins_elt_undef_i32:
799 ; X64-AVX512: ## %bb.0:
800 ; X64-AVX512-NEXT: vpinsrd $2, (%rdi), %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x22,0x07,0x02]
801 ; X64-AVX512-NEXT: retq ## encoding: [0xc3]
802 %1 = load i32, i32* %b, align 4
803 %2 = insertelement <4 x i32> undef, i32 %1, i32 0
804 %result = shufflevector <4 x i32> %a, <4 x i32> %2, <4 x i32> <i32 0, i32 1, i32 4, i32 3>
805 ret <4 x i32> %result
808 ;;;;;; Shuffles optimizable with a single insertps or blend instruction
809 define <4 x float> @shuf_XYZ0(<4 x float> %x, <4 x float> %a) {
810 ; SSE-LABEL: shuf_XYZ0:
812 ; SSE-NEXT: xorps %xmm1, %xmm1 ## encoding: [0x0f,0x57,0xc9]
813 ; SSE-NEXT: blendps $8, %xmm1, %xmm0 ## encoding: [0x66,0x0f,0x3a,0x0c,0xc1,0x08]
814 ; SSE-NEXT: ## xmm0 = xmm0[0,1,2],xmm1[3]
815 ; SSE-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
817 ; AVX1-LABEL: shuf_XYZ0:
819 ; AVX1-NEXT: vxorps %xmm1, %xmm1, %xmm1 ## encoding: [0xc5,0xf0,0x57,0xc9]
820 ; AVX1-NEXT: vblendps $8, %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x0c,0xc1,0x08]
821 ; AVX1-NEXT: ## xmm0 = xmm0[0,1,2],xmm1[3]
822 ; AVX1-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
824 ; AVX512-LABEL: shuf_XYZ0:
826 ; AVX512-NEXT: vxorps %xmm1, %xmm1, %xmm1 ## EVEX TO VEX Compression encoding: [0xc5,0xf0,0x57,0xc9]
827 ; AVX512-NEXT: vblendps $8, %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x0c,0xc1,0x08]
828 ; AVX512-NEXT: ## xmm0 = xmm0[0,1,2],xmm1[3]
829 ; AVX512-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
830 %vecext = extractelement <4 x float> %x, i32 0
831 %vecinit = insertelement <4 x float> undef, float %vecext, i32 0
832 %vecext1 = extractelement <4 x float> %x, i32 1
833 %vecinit2 = insertelement <4 x float> %vecinit, float %vecext1, i32 1
834 %vecext3 = extractelement <4 x float> %x, i32 2
835 %vecinit4 = insertelement <4 x float> %vecinit2, float %vecext3, i32 2
836 %vecinit5 = insertelement <4 x float> %vecinit4, float 0.0, i32 3
837 ret <4 x float> %vecinit5
840 define <4 x float> @shuf_XY00(<4 x float> %x, <4 x float> %a) {
841 ; SSE-LABEL: shuf_XY00:
843 ; SSE-NEXT: movq %xmm0, %xmm0 ## encoding: [0xf3,0x0f,0x7e,0xc0]
844 ; SSE-NEXT: ## xmm0 = xmm0[0],zero
845 ; SSE-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
847 ; AVX1-LABEL: shuf_XY00:
849 ; AVX1-NEXT: vmovq %xmm0, %xmm0 ## encoding: [0xc5,0xfa,0x7e,0xc0]
850 ; AVX1-NEXT: ## xmm0 = xmm0[0],zero
851 ; AVX1-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
853 ; AVX512-LABEL: shuf_XY00:
855 ; AVX512-NEXT: vmovq %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc5,0xfa,0x7e,0xc0]
856 ; AVX512-NEXT: ## xmm0 = xmm0[0],zero
857 ; AVX512-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
858 %vecext = extractelement <4 x float> %x, i32 0
859 %vecinit = insertelement <4 x float> undef, float %vecext, i32 0
860 %vecext1 = extractelement <4 x float> %x, i32 1
861 %vecinit2 = insertelement <4 x float> %vecinit, float %vecext1, i32 1
862 %vecinit3 = insertelement <4 x float> %vecinit2, float 0.0, i32 2
863 %vecinit4 = insertelement <4 x float> %vecinit3, float 0.0, i32 3
864 ret <4 x float> %vecinit4
867 define <4 x float> @shuf_XYY0(<4 x float> %x, <4 x float> %a) {
868 ; SSE-LABEL: shuf_XYY0:
870 ; SSE-NEXT: insertps $104, %xmm0, %xmm0 ## encoding: [0x66,0x0f,0x3a,0x21,0xc0,0x68]
871 ; SSE-NEXT: ## xmm0 = xmm0[0,1,1],zero
872 ; SSE-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
874 ; AVX1-LABEL: shuf_XYY0:
876 ; AVX1-NEXT: vinsertps $104, %xmm0, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x21,0xc0,0x68]
877 ; AVX1-NEXT: ## xmm0 = xmm0[0,1,1],zero
878 ; AVX1-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
880 ; AVX512-LABEL: shuf_XYY0:
882 ; AVX512-NEXT: vinsertps $104, %xmm0, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x21,0xc0,0x68]
883 ; AVX512-NEXT: ## xmm0 = xmm0[0,1,1],zero
884 ; AVX512-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
885 %vecext = extractelement <4 x float> %x, i32 0
886 %vecinit = insertelement <4 x float> undef, float %vecext, i32 0
887 %vecext1 = extractelement <4 x float> %x, i32 1
888 %vecinit2 = insertelement <4 x float> %vecinit, float %vecext1, i32 1
889 %vecinit4 = insertelement <4 x float> %vecinit2, float %vecext1, i32 2
890 %vecinit5 = insertelement <4 x float> %vecinit4, float 0.0, i32 3
891 ret <4 x float> %vecinit5
894 define <4 x float> @shuf_XYW0(<4 x float> %x, <4 x float> %a) {
895 ; SSE-LABEL: shuf_XYW0:
897 ; SSE-NEXT: insertps $232, %xmm0, %xmm0 ## encoding: [0x66,0x0f,0x3a,0x21,0xc0,0xe8]
898 ; SSE-NEXT: ## xmm0 = xmm0[0,1,3],zero
899 ; SSE-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
901 ; AVX1-LABEL: shuf_XYW0:
903 ; AVX1-NEXT: vinsertps $232, %xmm0, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x21,0xc0,0xe8]
904 ; AVX1-NEXT: ## xmm0 = xmm0[0,1,3],zero
905 ; AVX1-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
907 ; AVX512-LABEL: shuf_XYW0:
909 ; AVX512-NEXT: vinsertps $232, %xmm0, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x21,0xc0,0xe8]
910 ; AVX512-NEXT: ## xmm0 = xmm0[0,1,3],zero
911 ; AVX512-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
912 %vecext = extractelement <4 x float> %x, i32 0
913 %vecinit = insertelement <4 x float> undef, float %vecext, i32 0
914 %vecext1 = extractelement <4 x float> %x, i32 1
915 %vecinit2 = insertelement <4 x float> %vecinit, float %vecext1, i32 1
916 %vecext2 = extractelement <4 x float> %x, i32 3
917 %vecinit3 = insertelement <4 x float> %vecinit2, float %vecext2, i32 2
918 %vecinit4 = insertelement <4 x float> %vecinit3, float 0.0, i32 3
919 ret <4 x float> %vecinit4
922 define <4 x float> @shuf_W00W(<4 x float> %x, <4 x float> %a) {
923 ; SSE-LABEL: shuf_W00W:
925 ; SSE-NEXT: insertps $198, %xmm0, %xmm0 ## encoding: [0x66,0x0f,0x3a,0x21,0xc0,0xc6]
926 ; SSE-NEXT: ## xmm0 = xmm0[3],zero,zero,xmm0[3]
927 ; SSE-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
929 ; AVX1-LABEL: shuf_W00W:
931 ; AVX1-NEXT: vinsertps $198, %xmm0, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x21,0xc0,0xc6]
932 ; AVX1-NEXT: ## xmm0 = xmm0[3],zero,zero,xmm0[3]
933 ; AVX1-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
935 ; AVX512-LABEL: shuf_W00W:
937 ; AVX512-NEXT: vinsertps $198, %xmm0, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x21,0xc0,0xc6]
938 ; AVX512-NEXT: ## xmm0 = xmm0[3],zero,zero,xmm0[3]
939 ; AVX512-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
940 %vecext = extractelement <4 x float> %x, i32 3
941 %vecinit = insertelement <4 x float> undef, float %vecext, i32 0
942 %vecinit2 = insertelement <4 x float> %vecinit, float 0.0, i32 1
943 %vecinit3 = insertelement <4 x float> %vecinit2, float 0.0, i32 2
944 %vecinit4 = insertelement <4 x float> %vecinit3, float %vecext, i32 3
945 ret <4 x float> %vecinit4
948 define <4 x float> @shuf_X00A(<4 x float> %x, <4 x float> %a) {
949 ; SSE-LABEL: shuf_X00A:
951 ; SSE-NEXT: insertps $54, %xmm1, %xmm0 ## encoding: [0x66,0x0f,0x3a,0x21,0xc1,0x36]
952 ; SSE-NEXT: ## xmm0 = xmm0[0],zero,zero,xmm1[0]
953 ; SSE-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
955 ; AVX1-LABEL: shuf_X00A:
957 ; AVX1-NEXT: vinsertps $54, %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x21,0xc1,0x36]
958 ; AVX1-NEXT: ## xmm0 = xmm0[0],zero,zero,xmm1[0]
959 ; AVX1-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
961 ; AVX512-LABEL: shuf_X00A:
963 ; AVX512-NEXT: vinsertps $54, %xmm1, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x21,0xc1,0x36]
964 ; AVX512-NEXT: ## xmm0 = xmm0[0],zero,zero,xmm1[0]
965 ; AVX512-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
966 %vecext = extractelement <4 x float> %x, i32 0
967 %vecinit = insertelement <4 x float> undef, float %vecext, i32 0
968 %vecinit1 = insertelement <4 x float> %vecinit, float 0.0, i32 1
969 %vecinit2 = insertelement <4 x float> %vecinit1, float 0.0, i32 2
970 %vecinit4 = shufflevector <4 x float> %vecinit2, <4 x float> %a, <4 x i32> <i32 0, i32 1, i32 2, i32 4>
971 ret <4 x float> %vecinit4
974 define <4 x float> @shuf_X00X(<4 x float> %x, <4 x float> %a) {
975 ; SSE-LABEL: shuf_X00X:
977 ; SSE-NEXT: insertps $54, %xmm0, %xmm0 ## encoding: [0x66,0x0f,0x3a,0x21,0xc0,0x36]
978 ; SSE-NEXT: ## xmm0 = xmm0[0],zero,zero,xmm0[0]
979 ; SSE-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
981 ; AVX1-LABEL: shuf_X00X:
983 ; AVX1-NEXT: vinsertps $54, %xmm0, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x21,0xc0,0x36]
984 ; AVX1-NEXT: ## xmm0 = xmm0[0],zero,zero,xmm0[0]
985 ; AVX1-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
987 ; AVX512-LABEL: shuf_X00X:
989 ; AVX512-NEXT: vinsertps $54, %xmm0, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x21,0xc0,0x36]
990 ; AVX512-NEXT: ## xmm0 = xmm0[0],zero,zero,xmm0[0]
991 ; AVX512-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
992 %vecext = extractelement <4 x float> %x, i32 0
993 %vecinit = insertelement <4 x float> undef, float %vecext, i32 0
994 %vecinit1 = insertelement <4 x float> %vecinit, float 0.0, i32 1
995 %vecinit2 = insertelement <4 x float> %vecinit1, float 0.0, i32 2
996 %vecinit4 = shufflevector <4 x float> %vecinit2, <4 x float> %x, <4 x i32> <i32 0, i32 1, i32 2, i32 4>
997 ret <4 x float> %vecinit4
1000 define <4 x float> @shuf_X0YC(<4 x float> %x, <4 x float> %a) {
1001 ; SSE-LABEL: shuf_X0YC:
1003 ; SSE-NEXT: xorps %xmm2, %xmm2 ## encoding: [0x0f,0x57,0xd2]
1004 ; SSE-NEXT: unpcklps %xmm2, %xmm0 ## encoding: [0x0f,0x14,0xc2]
1005 ; SSE-NEXT: ## xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
1006 ; SSE-NEXT: insertps $176, %xmm1, %xmm0 ## encoding: [0x66,0x0f,0x3a,0x21,0xc1,0xb0]
1007 ; SSE-NEXT: ## xmm0 = xmm0[0,1,2],xmm1[2]
1008 ; SSE-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
1010 ; AVX1-LABEL: shuf_X0YC:
1012 ; AVX1-NEXT: vxorps %xmm2, %xmm2, %xmm2 ## encoding: [0xc5,0xe8,0x57,0xd2]
1013 ; AVX1-NEXT: vunpcklps %xmm2, %xmm0, %xmm0 ## encoding: [0xc5,0xf8,0x14,0xc2]
1014 ; AVX1-NEXT: ## xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
1015 ; AVX1-NEXT: vinsertps $176, %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x21,0xc1,0xb0]
1016 ; AVX1-NEXT: ## xmm0 = xmm0[0,1,2],xmm1[2]
1017 ; AVX1-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
1019 ; AVX512-LABEL: shuf_X0YC:
1021 ; AVX512-NEXT: vxorps %xmm2, %xmm2, %xmm2 ## EVEX TO VEX Compression encoding: [0xc5,0xe8,0x57,0xd2]
1022 ; AVX512-NEXT: vunpcklps %xmm2, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc5,0xf8,0x14,0xc2]
1023 ; AVX512-NEXT: ## xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
1024 ; AVX512-NEXT: vinsertps $176, %xmm1, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x21,0xc1,0xb0]
1025 ; AVX512-NEXT: ## xmm0 = xmm0[0,1,2],xmm1[2]
1026 ; AVX512-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
1027 %vecext = extractelement <4 x float> %x, i32 0
1028 %vecinit = insertelement <4 x float> undef, float %vecext, i32 0
1029 %vecinit1 = insertelement <4 x float> %vecinit, float 0.0, i32 1
1030 %vecinit3 = shufflevector <4 x float> %vecinit1, <4 x float> %x, <4 x i32> <i32 0, i32 1, i32 5, i32 undef>
1031 %vecinit5 = shufflevector <4 x float> %vecinit3, <4 x float> %a, <4 x i32> <i32 0, i32 1, i32 2, i32 6>
1032 ret <4 x float> %vecinit5
1035 define <4 x i32> @i32_shuf_XYZ0(<4 x i32> %x, <4 x i32> %a) {
1036 ; SSE-LABEL: i32_shuf_XYZ0:
1038 ; SSE-NEXT: xorps %xmm1, %xmm1 ## encoding: [0x0f,0x57,0xc9]
1039 ; SSE-NEXT: blendps $8, %xmm1, %xmm0 ## encoding: [0x66,0x0f,0x3a,0x0c,0xc1,0x08]
1040 ; SSE-NEXT: ## xmm0 = xmm0[0,1,2],xmm1[3]
1041 ; SSE-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
1043 ; AVX1-LABEL: i32_shuf_XYZ0:
1045 ; AVX1-NEXT: vxorps %xmm1, %xmm1, %xmm1 ## encoding: [0xc5,0xf0,0x57,0xc9]
1046 ; AVX1-NEXT: vblendps $8, %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x0c,0xc1,0x08]
1047 ; AVX1-NEXT: ## xmm0 = xmm0[0,1,2],xmm1[3]
1048 ; AVX1-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
1050 ; AVX512-LABEL: i32_shuf_XYZ0:
1052 ; AVX512-NEXT: vxorps %xmm1, %xmm1, %xmm1 ## EVEX TO VEX Compression encoding: [0xc5,0xf0,0x57,0xc9]
1053 ; AVX512-NEXT: vblendps $8, %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x0c,0xc1,0x08]
1054 ; AVX512-NEXT: ## xmm0 = xmm0[0,1,2],xmm1[3]
1055 ; AVX512-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
1056 %vecext = extractelement <4 x i32> %x, i32 0
1057 %vecinit = insertelement <4 x i32> undef, i32 %vecext, i32 0
1058 %vecext1 = extractelement <4 x i32> %x, i32 1
1059 %vecinit2 = insertelement <4 x i32> %vecinit, i32 %vecext1, i32 1
1060 %vecext3 = extractelement <4 x i32> %x, i32 2
1061 %vecinit4 = insertelement <4 x i32> %vecinit2, i32 %vecext3, i32 2
1062 %vecinit5 = insertelement <4 x i32> %vecinit4, i32 0, i32 3
1063 ret <4 x i32> %vecinit5
1066 define <4 x i32> @i32_shuf_XY00(<4 x i32> %x, <4 x i32> %a) {
1067 ; SSE-LABEL: i32_shuf_XY00:
1069 ; SSE-NEXT: movq %xmm0, %xmm0 ## encoding: [0xf3,0x0f,0x7e,0xc0]
1070 ; SSE-NEXT: ## xmm0 = xmm0[0],zero
1071 ; SSE-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
1073 ; AVX1-LABEL: i32_shuf_XY00:
1075 ; AVX1-NEXT: vmovq %xmm0, %xmm0 ## encoding: [0xc5,0xfa,0x7e,0xc0]
1076 ; AVX1-NEXT: ## xmm0 = xmm0[0],zero
1077 ; AVX1-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
1079 ; AVX512-LABEL: i32_shuf_XY00:
1081 ; AVX512-NEXT: vmovq %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc5,0xfa,0x7e,0xc0]
1082 ; AVX512-NEXT: ## xmm0 = xmm0[0],zero
1083 ; AVX512-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
1084 %vecext = extractelement <4 x i32> %x, i32 0
1085 %vecinit = insertelement <4 x i32> undef, i32 %vecext, i32 0
1086 %vecext1 = extractelement <4 x i32> %x, i32 1
1087 %vecinit2 = insertelement <4 x i32> %vecinit, i32 %vecext1, i32 1
1088 %vecinit3 = insertelement <4 x i32> %vecinit2, i32 0, i32 2
1089 %vecinit4 = insertelement <4 x i32> %vecinit3, i32 0, i32 3
1090 ret <4 x i32> %vecinit4
1093 define <4 x i32> @i32_shuf_XYY0(<4 x i32> %x, <4 x i32> %a) {
1094 ; SSE-LABEL: i32_shuf_XYY0:
1096 ; SSE-NEXT: pshufd $212, %xmm0, %xmm1 ## encoding: [0x66,0x0f,0x70,0xc8,0xd4]
1097 ; SSE-NEXT: ## xmm1 = xmm0[0,1,1,3]
1098 ; SSE-NEXT: pxor %xmm0, %xmm0 ## encoding: [0x66,0x0f,0xef,0xc0]
1099 ; SSE-NEXT: pblendw $63, %xmm1, %xmm0 ## encoding: [0x66,0x0f,0x3a,0x0e,0xc1,0x3f]
1100 ; SSE-NEXT: ## xmm0 = xmm1[0,1,2,3,4,5],xmm0[6,7]
1101 ; SSE-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
1103 ; AVX1-LABEL: i32_shuf_XYY0:
1105 ; AVX1-NEXT: vpermilps $212, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x04,0xc0,0xd4]
1106 ; AVX1-NEXT: ## xmm0 = xmm0[0,1,1,3]
1107 ; AVX1-NEXT: vxorps %xmm1, %xmm1, %xmm1 ## encoding: [0xc5,0xf0,0x57,0xc9]
1108 ; AVX1-NEXT: vblendps $8, %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x0c,0xc1,0x08]
1109 ; AVX1-NEXT: ## xmm0 = xmm0[0,1,2],xmm1[3]
1110 ; AVX1-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
1112 ; AVX512-LABEL: i32_shuf_XYY0:
1114 ; AVX512-NEXT: vpermilps $212, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x04,0xc0,0xd4]
1115 ; AVX512-NEXT: ## xmm0 = xmm0[0,1,1,3]
1116 ; AVX512-NEXT: vxorps %xmm1, %xmm1, %xmm1 ## EVEX TO VEX Compression encoding: [0xc5,0xf0,0x57,0xc9]
1117 ; AVX512-NEXT: vblendps $8, %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x0c,0xc1,0x08]
1118 ; AVX512-NEXT: ## xmm0 = xmm0[0,1,2],xmm1[3]
1119 ; AVX512-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
1120 %vecext = extractelement <4 x i32> %x, i32 0
1121 %vecinit = insertelement <4 x i32> undef, i32 %vecext, i32 0
1122 %vecext1 = extractelement <4 x i32> %x, i32 1
1123 %vecinit2 = insertelement <4 x i32> %vecinit, i32 %vecext1, i32 1
1124 %vecinit4 = insertelement <4 x i32> %vecinit2, i32 %vecext1, i32 2
1125 %vecinit5 = insertelement <4 x i32> %vecinit4, i32 0, i32 3
1126 ret <4 x i32> %vecinit5
1129 define <4 x i32> @i32_shuf_XYW0(<4 x i32> %x, <4 x i32> %a) {
1130 ; SSE-LABEL: i32_shuf_XYW0:
1132 ; SSE-NEXT: pshufd $244, %xmm0, %xmm1 ## encoding: [0x66,0x0f,0x70,0xc8,0xf4]
1133 ; SSE-NEXT: ## xmm1 = xmm0[0,1,3,3]
1134 ; SSE-NEXT: pxor %xmm0, %xmm0 ## encoding: [0x66,0x0f,0xef,0xc0]
1135 ; SSE-NEXT: pblendw $63, %xmm1, %xmm0 ## encoding: [0x66,0x0f,0x3a,0x0e,0xc1,0x3f]
1136 ; SSE-NEXT: ## xmm0 = xmm1[0,1,2,3,4,5],xmm0[6,7]
1137 ; SSE-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
1139 ; AVX1-LABEL: i32_shuf_XYW0:
1141 ; AVX1-NEXT: vpermilps $244, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x04,0xc0,0xf4]
1142 ; AVX1-NEXT: ## xmm0 = xmm0[0,1,3,3]
1143 ; AVX1-NEXT: vxorps %xmm1, %xmm1, %xmm1 ## encoding: [0xc5,0xf0,0x57,0xc9]
1144 ; AVX1-NEXT: vblendps $8, %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x0c,0xc1,0x08]
1145 ; AVX1-NEXT: ## xmm0 = xmm0[0,1,2],xmm1[3]
1146 ; AVX1-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
1148 ; AVX512-LABEL: i32_shuf_XYW0:
1150 ; AVX512-NEXT: vpermilps $244, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x04,0xc0,0xf4]
1151 ; AVX512-NEXT: ## xmm0 = xmm0[0,1,3,3]
1152 ; AVX512-NEXT: vxorps %xmm1, %xmm1, %xmm1 ## EVEX TO VEX Compression encoding: [0xc5,0xf0,0x57,0xc9]
1153 ; AVX512-NEXT: vblendps $8, %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x0c,0xc1,0x08]
1154 ; AVX512-NEXT: ## xmm0 = xmm0[0,1,2],xmm1[3]
1155 ; AVX512-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
1156 %vecext = extractelement <4 x i32> %x, i32 0
1157 %vecinit = insertelement <4 x i32> undef, i32 %vecext, i32 0
1158 %vecext1 = extractelement <4 x i32> %x, i32 1
1159 %vecinit2 = insertelement <4 x i32> %vecinit, i32 %vecext1, i32 1
1160 %vecext2 = extractelement <4 x i32> %x, i32 3
1161 %vecinit3 = insertelement <4 x i32> %vecinit2, i32 %vecext2, i32 2
1162 %vecinit4 = insertelement <4 x i32> %vecinit3, i32 0, i32 3
1163 ret <4 x i32> %vecinit4
1166 define <4 x i32> @i32_shuf_W00W(<4 x i32> %x, <4 x i32> %a) {
1167 ; SSE-LABEL: i32_shuf_W00W:
1169 ; SSE-NEXT: pshufd $231, %xmm0, %xmm1 ## encoding: [0x66,0x0f,0x70,0xc8,0xe7]
1170 ; SSE-NEXT: ## xmm1 = xmm0[3,1,2,3]
1171 ; SSE-NEXT: pxor %xmm0, %xmm0 ## encoding: [0x66,0x0f,0xef,0xc0]
1172 ; SSE-NEXT: pblendw $195, %xmm1, %xmm0 ## encoding: [0x66,0x0f,0x3a,0x0e,0xc1,0xc3]
1173 ; SSE-NEXT: ## xmm0 = xmm1[0,1],xmm0[2,3,4,5],xmm1[6,7]
1174 ; SSE-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
1176 ; AVX1-LABEL: i32_shuf_W00W:
1178 ; AVX1-NEXT: vpermilps $231, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x04,0xc0,0xe7]
1179 ; AVX1-NEXT: ## xmm0 = xmm0[3,1,2,3]
1180 ; AVX1-NEXT: vxorps %xmm1, %xmm1, %xmm1 ## encoding: [0xc5,0xf0,0x57,0xc9]
1181 ; AVX1-NEXT: vblendps $6, %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x0c,0xc1,0x06]
1182 ; AVX1-NEXT: ## xmm0 = xmm0[0],xmm1[1,2],xmm0[3]
1183 ; AVX1-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
1185 ; AVX512-LABEL: i32_shuf_W00W:
1187 ; AVX512-NEXT: vpermilps $231, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x04,0xc0,0xe7]
1188 ; AVX512-NEXT: ## xmm0 = xmm0[3,1,2,3]
1189 ; AVX512-NEXT: vxorps %xmm1, %xmm1, %xmm1 ## EVEX TO VEX Compression encoding: [0xc5,0xf0,0x57,0xc9]
1190 ; AVX512-NEXT: vblendps $6, %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x0c,0xc1,0x06]
1191 ; AVX512-NEXT: ## xmm0 = xmm0[0],xmm1[1,2],xmm0[3]
1192 ; AVX512-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
1193 %vecext = extractelement <4 x i32> %x, i32 3
1194 %vecinit = insertelement <4 x i32> undef, i32 %vecext, i32 0
1195 %vecinit2 = insertelement <4 x i32> %vecinit, i32 0, i32 1
1196 %vecinit3 = insertelement <4 x i32> %vecinit2, i32 0, i32 2
1197 %vecinit4 = insertelement <4 x i32> %vecinit3, i32 %vecext, i32 3
1198 ret <4 x i32> %vecinit4
1201 define <4 x i32> @i32_shuf_X00A(<4 x i32> %x, <4 x i32> %a) {
1202 ; SSE-LABEL: i32_shuf_X00A:
1204 ; SSE-NEXT: pxor %xmm2, %xmm2 ## encoding: [0x66,0x0f,0xef,0xd2]
1205 ; SSE-NEXT: pblendw $252, %xmm2, %xmm0 ## encoding: [0x66,0x0f,0x3a,0x0e,0xc2,0xfc]
1206 ; SSE-NEXT: ## xmm0 = xmm0[0,1],xmm2[2,3,4,5,6,7]
1207 ; SSE-NEXT: pshufd $36, %xmm1, %xmm1 ## encoding: [0x66,0x0f,0x70,0xc9,0x24]
1208 ; SSE-NEXT: ## xmm1 = xmm1[0,1,2,0]
1209 ; SSE-NEXT: pblendw $192, %xmm1, %xmm0 ## encoding: [0x66,0x0f,0x3a,0x0e,0xc1,0xc0]
1210 ; SSE-NEXT: ## xmm0 = xmm0[0,1,2,3,4,5],xmm1[6,7]
1211 ; SSE-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
1213 ; AVX1-LABEL: i32_shuf_X00A:
1215 ; AVX1-NEXT: vxorps %xmm2, %xmm2, %xmm2 ## encoding: [0xc5,0xe8,0x57,0xd2]
1216 ; AVX1-NEXT: vblendps $1, %xmm0, %xmm2, %xmm0 ## encoding: [0xc4,0xe3,0x69,0x0c,0xc0,0x01]
1217 ; AVX1-NEXT: ## xmm0 = xmm0[0],xmm2[1,2,3]
1218 ; AVX1-NEXT: vpermilps $36, %xmm1, %xmm1 ## encoding: [0xc4,0xe3,0x79,0x04,0xc9,0x24]
1219 ; AVX1-NEXT: ## xmm1 = xmm1[0,1,2,0]
1220 ; AVX1-NEXT: vblendps $8, %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x0c,0xc1,0x08]
1221 ; AVX1-NEXT: ## xmm0 = xmm0[0,1,2],xmm1[3]
1222 ; AVX1-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
1224 ; AVX512-LABEL: i32_shuf_X00A:
1226 ; AVX512-NEXT: vxorps %xmm2, %xmm2, %xmm2 ## encoding: [0xc5,0xe8,0x57,0xd2]
1227 ; AVX512-NEXT: vblendps $1, %xmm0, %xmm2, %xmm0 ## encoding: [0xc4,0xe3,0x69,0x0c,0xc0,0x01]
1228 ; AVX512-NEXT: ## xmm0 = xmm0[0],xmm2[1,2,3]
1229 ; AVX512-NEXT: vpermilps $36, %xmm1, %xmm1 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x04,0xc9,0x24]
1230 ; AVX512-NEXT: ## xmm1 = xmm1[0,1,2,0]
1231 ; AVX512-NEXT: vblendps $8, %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x0c,0xc1,0x08]
1232 ; AVX512-NEXT: ## xmm0 = xmm0[0,1,2],xmm1[3]
1233 ; AVX512-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
1234 %vecext = extractelement <4 x i32> %x, i32 0
1235 %vecinit = insertelement <4 x i32> undef, i32 %vecext, i32 0
1236 %vecinit1 = insertelement <4 x i32> %vecinit, i32 0, i32 1
1237 %vecinit2 = insertelement <4 x i32> %vecinit1, i32 0, i32 2
1238 %vecinit4 = shufflevector <4 x i32> %vecinit2, <4 x i32> %a, <4 x i32> <i32 0, i32 1, i32 2, i32 4>
1239 ret <4 x i32> %vecinit4
1242 define <4 x i32> @i32_shuf_X00X(<4 x i32> %x, <4 x i32> %a) {
1243 ; SSE-LABEL: i32_shuf_X00X:
1245 ; SSE-NEXT: pxor %xmm1, %xmm1 ## encoding: [0x66,0x0f,0xef,0xc9]
1246 ; SSE-NEXT: pshufd $36, %xmm0, %xmm0 ## encoding: [0x66,0x0f,0x70,0xc0,0x24]
1247 ; SSE-NEXT: ## xmm0 = xmm0[0,1,2,0]
1248 ; SSE-NEXT: pblendw $60, %xmm1, %xmm0 ## encoding: [0x66,0x0f,0x3a,0x0e,0xc1,0x3c]
1249 ; SSE-NEXT: ## xmm0 = xmm0[0,1],xmm1[2,3,4,5],xmm0[6,7]
1250 ; SSE-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
1252 ; AVX1-LABEL: i32_shuf_X00X:
1254 ; AVX1-NEXT: vxorps %xmm1, %xmm1, %xmm1 ## encoding: [0xc5,0xf0,0x57,0xc9]
1255 ; AVX1-NEXT: vpermilps $36, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x04,0xc0,0x24]
1256 ; AVX1-NEXT: ## xmm0 = xmm0[0,1,2,0]
1257 ; AVX1-NEXT: vblendps $6, %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x0c,0xc1,0x06]
1258 ; AVX1-NEXT: ## xmm0 = xmm0[0],xmm1[1,2],xmm0[3]
1259 ; AVX1-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
1261 ; AVX512-LABEL: i32_shuf_X00X:
1263 ; AVX512-NEXT: vxorps %xmm1, %xmm1, %xmm1 ## EVEX TO VEX Compression encoding: [0xc5,0xf0,0x57,0xc9]
1264 ; AVX512-NEXT: vbroadcastss %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe2,0x79,0x18,0xc0]
1265 ; AVX512-NEXT: vblendps $6, %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x0c,0xc1,0x06]
1266 ; AVX512-NEXT: ## xmm0 = xmm0[0],xmm1[1,2],xmm0[3]
1267 ; AVX512-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
1268 %vecext = extractelement <4 x i32> %x, i32 0
1269 %vecinit = insertelement <4 x i32> undef, i32 %vecext, i32 0
1270 %vecinit1 = insertelement <4 x i32> %vecinit, i32 0, i32 1
1271 %vecinit2 = insertelement <4 x i32> %vecinit1, i32 0, i32 2
1272 %vecinit4 = shufflevector <4 x i32> %vecinit2, <4 x i32> %x, <4 x i32> <i32 0, i32 1, i32 2, i32 4>
1273 ret <4 x i32> %vecinit4
1276 define <4 x i32> @i32_shuf_X0YC(<4 x i32> %x, <4 x i32> %a) {
1277 ; SSE-LABEL: i32_shuf_X0YC:
1279 ; SSE-NEXT: pmovzxdq %xmm0, %xmm2 ## encoding: [0x66,0x0f,0x38,0x35,0xd0]
1280 ; SSE-NEXT: ## xmm2 = xmm0[0],zero,xmm0[1],zero
1281 ; SSE-NEXT: pshufd $164, %xmm1, %xmm0 ## encoding: [0x66,0x0f,0x70,0xc1,0xa4]
1282 ; SSE-NEXT: ## xmm0 = xmm1[0,1,2,2]
1283 ; SSE-NEXT: pblendw $63, %xmm2, %xmm0 ## encoding: [0x66,0x0f,0x3a,0x0e,0xc2,0x3f]
1284 ; SSE-NEXT: ## xmm0 = xmm2[0,1,2,3,4,5],xmm0[6,7]
1285 ; SSE-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
1287 ; AVX1-LABEL: i32_shuf_X0YC:
1289 ; AVX1-NEXT: vpmovzxdq %xmm0, %xmm0 ## encoding: [0xc4,0xe2,0x79,0x35,0xc0]
1290 ; AVX1-NEXT: ## xmm0 = xmm0[0],zero,xmm0[1],zero
1291 ; AVX1-NEXT: vpshufd $164, %xmm1, %xmm1 ## encoding: [0xc5,0xf9,0x70,0xc9,0xa4]
1292 ; AVX1-NEXT: ## xmm1 = xmm1[0,1,2,2]
1293 ; AVX1-NEXT: vpblendw $192, %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x0e,0xc1,0xc0]
1294 ; AVX1-NEXT: ## xmm0 = xmm0[0,1,2,3,4,5],xmm1[6,7]
1295 ; AVX1-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
1297 ; AVX512-LABEL: i32_shuf_X0YC:
1299 ; AVX512-NEXT: vpmovzxdq %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe2,0x79,0x35,0xc0]
1300 ; AVX512-NEXT: ## xmm0 = xmm0[0],zero,xmm0[1],zero
1301 ; AVX512-NEXT: vpshufd $164, %xmm1, %xmm1 ## EVEX TO VEX Compression encoding: [0xc5,0xf9,0x70,0xc9,0xa4]
1302 ; AVX512-NEXT: ## xmm1 = xmm1[0,1,2,2]
1303 ; AVX512-NEXT: vpblendd $8, %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x02,0xc1,0x08]
1304 ; AVX512-NEXT: ## xmm0 = xmm0[0,1,2],xmm1[3]
1305 ; AVX512-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
1306 %vecext = extractelement <4 x i32> %x, i32 0
1307 %vecinit = insertelement <4 x i32> undef, i32 %vecext, i32 0
1308 %vecinit1 = insertelement <4 x i32> %vecinit, i32 0, i32 1
1309 %vecinit3 = shufflevector <4 x i32> %vecinit1, <4 x i32> %x, <4 x i32> <i32 0, i32 1, i32 5, i32 undef>
1310 %vecinit5 = shufflevector <4 x i32> %vecinit3, <4 x i32> %a, <4 x i32> <i32 0, i32 1, i32 2, i32 6>
1311 ret <4 x i32> %vecinit5
1314 ;; Test for a bug in the first implementation of LowerBuildVectorv4X86
1315 define < 4 x float> @test_insertps_no_undef(<4 x float> %x) {
1316 ; SSE-LABEL: test_insertps_no_undef:
1318 ; SSE-NEXT: xorps %xmm1, %xmm1 ## encoding: [0x0f,0x57,0xc9]
1319 ; SSE-NEXT: blendps $7, %xmm0, %xmm1 ## encoding: [0x66,0x0f,0x3a,0x0c,0xc8,0x07]
1320 ; SSE-NEXT: ## xmm1 = xmm0[0,1,2],xmm1[3]
1321 ; SSE-NEXT: maxps %xmm1, %xmm0 ## encoding: [0x0f,0x5f,0xc1]
1322 ; SSE-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
1324 ; AVX1-LABEL: test_insertps_no_undef:
1326 ; AVX1-NEXT: vxorps %xmm1, %xmm1, %xmm1 ## encoding: [0xc5,0xf0,0x57,0xc9]
1327 ; AVX1-NEXT: vblendps $8, %xmm1, %xmm0, %xmm1 ## encoding: [0xc4,0xe3,0x79,0x0c,0xc9,0x08]
1328 ; AVX1-NEXT: ## xmm1 = xmm0[0,1,2],xmm1[3]
1329 ; AVX1-NEXT: vmaxps %xmm1, %xmm0, %xmm0 ## encoding: [0xc5,0xf8,0x5f,0xc1]
1330 ; AVX1-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
1332 ; AVX512-LABEL: test_insertps_no_undef:
1334 ; AVX512-NEXT: vxorps %xmm1, %xmm1, %xmm1 ## EVEX TO VEX Compression encoding: [0xc5,0xf0,0x57,0xc9]
1335 ; AVX512-NEXT: vblendps $8, %xmm1, %xmm0, %xmm1 ## encoding: [0xc4,0xe3,0x79,0x0c,0xc9,0x08]
1336 ; AVX512-NEXT: ## xmm1 = xmm0[0,1,2],xmm1[3]
1337 ; AVX512-NEXT: vmaxps %xmm1, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc5,0xf8,0x5f,0xc1]
1338 ; AVX512-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
1339 %vecext = extractelement <4 x float> %x, i32 0
1340 %vecinit = insertelement <4 x float> undef, float %vecext, i32 0
1341 %vecext1 = extractelement <4 x float> %x, i32 1
1342 %vecinit2 = insertelement <4 x float> %vecinit, float %vecext1, i32 1
1343 %vecext3 = extractelement <4 x float> %x, i32 2
1344 %vecinit4 = insertelement <4 x float> %vecinit2, float %vecext3, i32 2
1345 %vecinit5 = insertelement <4 x float> %vecinit4, float 0.0, i32 3
1346 %mask = fcmp olt <4 x float> %vecinit5, %x
1347 %res = select <4 x i1> %mask, <4 x float> %x, <4 x float>%vecinit5
1348 ret <4 x float> %res
1351 define <8 x i16> @blendvb_fallback(<8 x i1> %mask, <8 x i16> %x, <8 x i16> %y) {
1352 ; SSE-LABEL: blendvb_fallback:
1354 ; SSE-NEXT: psllw $15, %xmm0 ## encoding: [0x66,0x0f,0x71,0xf0,0x0f]
1355 ; SSE-NEXT: psraw $15, %xmm0 ## encoding: [0x66,0x0f,0x71,0xe0,0x0f]
1356 ; SSE-NEXT: pblendvb %xmm0, %xmm1, %xmm2 ## encoding: [0x66,0x0f,0x38,0x10,0xd1]
1357 ; SSE-NEXT: movdqa %xmm2, %xmm0 ## encoding: [0x66,0x0f,0x6f,0xc2]
1358 ; SSE-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
1360 ; AVX1-LABEL: blendvb_fallback:
1362 ; AVX1-NEXT: vpsllw $15, %xmm0, %xmm0 ## encoding: [0xc5,0xf9,0x71,0xf0,0x0f]
1363 ; AVX1-NEXT: vpsraw $15, %xmm0, %xmm0 ## encoding: [0xc5,0xf9,0x71,0xe0,0x0f]
1364 ; AVX1-NEXT: vpblendvb %xmm0, %xmm1, %xmm2, %xmm0 ## encoding: [0xc4,0xe3,0x69,0x4c,0xc1,0x00]
1365 ; AVX1-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
1367 ; AVX512-LABEL: blendvb_fallback:
1369 ; AVX512-NEXT: vpsllw $15, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc5,0xf9,0x71,0xf0,0x0f]
1370 ; AVX512-NEXT: vpmovw2m %xmm0, %k1 ## encoding: [0x62,0xf2,0xfe,0x08,0x29,0xc8]
1371 ; AVX512-NEXT: vpblendmw %xmm1, %xmm2, %xmm0 {%k1} ## encoding: [0x62,0xf2,0xed,0x09,0x66,0xc1]
1372 ; AVX512-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
1373 %ret = select <8 x i1> %mask, <8 x i16> %x, <8 x i16> %y
1377 ; On X86, account for the argument's move to registers
1378 define <4 x float> @insertps_from_vector_load(<4 x float> %a, <4 x float>* nocapture readonly %pb) {
1379 ; X86-SSE-LABEL: insertps_from_vector_load:
1380 ; X86-SSE: ## %bb.0:
1381 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %eax ## encoding: [0x8b,0x44,0x24,0x04]
1382 ; X86-SSE-NEXT: movaps (%eax), %xmm1 ## encoding: [0x0f,0x28,0x08]
1383 ; X86-SSE-NEXT: insertps $48, %xmm1, %xmm0 ## encoding: [0x66,0x0f,0x3a,0x21,0xc1,0x30]
1384 ; X86-SSE-NEXT: ## xmm0 = xmm0[0,1,2],xmm1[0]
1385 ; X86-SSE-NEXT: retl ## encoding: [0xc3]
1387 ; X86-AVX1-LABEL: insertps_from_vector_load:
1388 ; X86-AVX1: ## %bb.0:
1389 ; X86-AVX1-NEXT: movl {{[0-9]+}}(%esp), %eax ## encoding: [0x8b,0x44,0x24,0x04]
1390 ; X86-AVX1-NEXT: vmovaps (%eax), %xmm1 ## encoding: [0xc5,0xf8,0x28,0x08]
1391 ; X86-AVX1-NEXT: vinsertps $48, %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x21,0xc1,0x30]
1392 ; X86-AVX1-NEXT: ## xmm0 = xmm0[0,1,2],xmm1[0]
1393 ; X86-AVX1-NEXT: retl ## encoding: [0xc3]
1395 ; X86-AVX512-LABEL: insertps_from_vector_load:
1396 ; X86-AVX512: ## %bb.0:
1397 ; X86-AVX512-NEXT: movl {{[0-9]+}}(%esp), %eax ## encoding: [0x8b,0x44,0x24,0x04]
1398 ; X86-AVX512-NEXT: vmovaps (%eax), %xmm1 ## EVEX TO VEX Compression encoding: [0xc5,0xf8,0x28,0x08]
1399 ; X86-AVX512-NEXT: vinsertps $48, %xmm1, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x21,0xc1,0x30]
1400 ; X86-AVX512-NEXT: ## xmm0 = xmm0[0,1,2],xmm1[0]
1401 ; X86-AVX512-NEXT: retl ## encoding: [0xc3]
1403 ; X64-SSE-LABEL: insertps_from_vector_load:
1404 ; X64-SSE: ## %bb.0:
1405 ; X64-SSE-NEXT: movaps (%rdi), %xmm1 ## encoding: [0x0f,0x28,0x0f]
1406 ; X64-SSE-NEXT: insertps $48, %xmm1, %xmm0 ## encoding: [0x66,0x0f,0x3a,0x21,0xc1,0x30]
1407 ; X64-SSE-NEXT: ## xmm0 = xmm0[0,1,2],xmm1[0]
1408 ; X64-SSE-NEXT: retq ## encoding: [0xc3]
1410 ; X64-AVX1-LABEL: insertps_from_vector_load:
1411 ; X64-AVX1: ## %bb.0:
1412 ; X64-AVX1-NEXT: vmovaps (%rdi), %xmm1 ## encoding: [0xc5,0xf8,0x28,0x0f]
1413 ; X64-AVX1-NEXT: vinsertps $48, %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x21,0xc1,0x30]
1414 ; X64-AVX1-NEXT: ## xmm0 = xmm0[0,1,2],xmm1[0]
1415 ; X64-AVX1-NEXT: retq ## encoding: [0xc3]
1417 ; X64-AVX512-LABEL: insertps_from_vector_load:
1418 ; X64-AVX512: ## %bb.0:
1419 ; X64-AVX512-NEXT: vmovaps (%rdi), %xmm1 ## EVEX TO VEX Compression encoding: [0xc5,0xf8,0x28,0x0f]
1420 ; X64-AVX512-NEXT: vinsertps $48, %xmm1, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x21,0xc1,0x30]
1421 ; X64-AVX512-NEXT: ## xmm0 = xmm0[0,1,2],xmm1[0]
1422 ; X64-AVX512-NEXT: retq ## encoding: [0xc3]
1423 %1 = load <4 x float>, <4 x float>* %pb, align 16
1424 %2 = tail call <4 x float> @llvm.x86.sse41.insertps(<4 x float> %a, <4 x float> %1, i32 48)
1428 ;; Use a non-zero CountS for insertps
1429 ;; Try to match a bit more of the instr, since we need the load's offset.
1430 define <4 x float> @insertps_from_vector_load_offset(<4 x float> %a, <4 x float>* nocapture readonly %pb) {
1431 ; X86-SSE-LABEL: insertps_from_vector_load_offset:
1432 ; X86-SSE: ## %bb.0:
1433 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %eax ## encoding: [0x8b,0x44,0x24,0x04]
1434 ; X86-SSE-NEXT: movaps (%eax), %xmm1 ## encoding: [0x0f,0x28,0x08]
1435 ; X86-SSE-NEXT: insertps $96, %xmm1, %xmm0 ## encoding: [0x66,0x0f,0x3a,0x21,0xc1,0x60]
1436 ; X86-SSE-NEXT: ## xmm0 = xmm0[0,1],xmm1[1],xmm0[3]
1437 ; X86-SSE-NEXT: retl ## encoding: [0xc3]
1439 ; X86-AVX1-LABEL: insertps_from_vector_load_offset:
1440 ; X86-AVX1: ## %bb.0:
1441 ; X86-AVX1-NEXT: movl {{[0-9]+}}(%esp), %eax ## encoding: [0x8b,0x44,0x24,0x04]
1442 ; X86-AVX1-NEXT: vmovaps (%eax), %xmm1 ## encoding: [0xc5,0xf8,0x28,0x08]
1443 ; X86-AVX1-NEXT: vinsertps $96, %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x21,0xc1,0x60]
1444 ; X86-AVX1-NEXT: ## xmm0 = xmm0[0,1],xmm1[1],xmm0[3]
1445 ; X86-AVX1-NEXT: retl ## encoding: [0xc3]
1447 ; X86-AVX512-LABEL: insertps_from_vector_load_offset:
1448 ; X86-AVX512: ## %bb.0:
1449 ; X86-AVX512-NEXT: movl {{[0-9]+}}(%esp), %eax ## encoding: [0x8b,0x44,0x24,0x04]
1450 ; X86-AVX512-NEXT: vmovaps (%eax), %xmm1 ## EVEX TO VEX Compression encoding: [0xc5,0xf8,0x28,0x08]
1451 ; X86-AVX512-NEXT: vinsertps $96, %xmm1, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x21,0xc1,0x60]
1452 ; X86-AVX512-NEXT: ## xmm0 = xmm0[0,1],xmm1[1],xmm0[3]
1453 ; X86-AVX512-NEXT: retl ## encoding: [0xc3]
1455 ; X64-SSE-LABEL: insertps_from_vector_load_offset:
1456 ; X64-SSE: ## %bb.0:
1457 ; X64-SSE-NEXT: movaps (%rdi), %xmm1 ## encoding: [0x0f,0x28,0x0f]
1458 ; X64-SSE-NEXT: insertps $96, %xmm1, %xmm0 ## encoding: [0x66,0x0f,0x3a,0x21,0xc1,0x60]
1459 ; X64-SSE-NEXT: ## xmm0 = xmm0[0,1],xmm1[1],xmm0[3]
1460 ; X64-SSE-NEXT: retq ## encoding: [0xc3]
1462 ; X64-AVX1-LABEL: insertps_from_vector_load_offset:
1463 ; X64-AVX1: ## %bb.0:
1464 ; X64-AVX1-NEXT: vmovaps (%rdi), %xmm1 ## encoding: [0xc5,0xf8,0x28,0x0f]
1465 ; X64-AVX1-NEXT: vinsertps $96, %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x21,0xc1,0x60]
1466 ; X64-AVX1-NEXT: ## xmm0 = xmm0[0,1],xmm1[1],xmm0[3]
1467 ; X64-AVX1-NEXT: retq ## encoding: [0xc3]
1469 ; X64-AVX512-LABEL: insertps_from_vector_load_offset:
1470 ; X64-AVX512: ## %bb.0:
1471 ; X64-AVX512-NEXT: vmovaps (%rdi), %xmm1 ## EVEX TO VEX Compression encoding: [0xc5,0xf8,0x28,0x0f]
1472 ; X64-AVX512-NEXT: vinsertps $96, %xmm1, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x21,0xc1,0x60]
1473 ; X64-AVX512-NEXT: ## xmm0 = xmm0[0,1],xmm1[1],xmm0[3]
1474 ; X64-AVX512-NEXT: retq ## encoding: [0xc3]
1475 %1 = load <4 x float>, <4 x float>* %pb, align 16
1476 %2 = tail call <4 x float> @llvm.x86.sse41.insertps(<4 x float> %a, <4 x float> %1, i32 96)
1480 ;; Try to match a bit more of the instr, since we need the load's offset.
1481 define <4 x float> @insertps_from_vector_load_offset_2(<4 x float> %a, <4 x float>* nocapture readonly %pb, i64 %index) {
1482 ; X86-SSE-LABEL: insertps_from_vector_load_offset_2:
1483 ; X86-SSE: ## %bb.0:
1484 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %eax ## encoding: [0x8b,0x44,0x24,0x04]
1485 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %ecx ## encoding: [0x8b,0x4c,0x24,0x08]
1486 ; X86-SSE-NEXT: shll $4, %ecx ## encoding: [0xc1,0xe1,0x04]
1487 ; X86-SSE-NEXT: movaps (%eax,%ecx), %xmm1 ## encoding: [0x0f,0x28,0x0c,0x08]
1488 ; X86-SSE-NEXT: insertps $192, %xmm1, %xmm0 ## encoding: [0x66,0x0f,0x3a,0x21,0xc1,0xc0]
1489 ; X86-SSE-NEXT: ## xmm0 = xmm1[3],xmm0[1,2,3]
1490 ; X86-SSE-NEXT: retl ## encoding: [0xc3]
1492 ; X86-AVX1-LABEL: insertps_from_vector_load_offset_2:
1493 ; X86-AVX1: ## %bb.0:
1494 ; X86-AVX1-NEXT: movl {{[0-9]+}}(%esp), %eax ## encoding: [0x8b,0x44,0x24,0x04]
1495 ; X86-AVX1-NEXT: movl {{[0-9]+}}(%esp), %ecx ## encoding: [0x8b,0x4c,0x24,0x08]
1496 ; X86-AVX1-NEXT: shll $4, %ecx ## encoding: [0xc1,0xe1,0x04]
1497 ; X86-AVX1-NEXT: vmovaps (%eax,%ecx), %xmm1 ## encoding: [0xc5,0xf8,0x28,0x0c,0x08]
1498 ; X86-AVX1-NEXT: vinsertps $192, %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x21,0xc1,0xc0]
1499 ; X86-AVX1-NEXT: ## xmm0 = xmm1[3],xmm0[1,2,3]
1500 ; X86-AVX1-NEXT: retl ## encoding: [0xc3]
1502 ; X86-AVX512-LABEL: insertps_from_vector_load_offset_2:
1503 ; X86-AVX512: ## %bb.0:
1504 ; X86-AVX512-NEXT: movl {{[0-9]+}}(%esp), %eax ## encoding: [0x8b,0x44,0x24,0x04]
1505 ; X86-AVX512-NEXT: movl {{[0-9]+}}(%esp), %ecx ## encoding: [0x8b,0x4c,0x24,0x08]
1506 ; X86-AVX512-NEXT: shll $4, %ecx ## encoding: [0xc1,0xe1,0x04]
1507 ; X86-AVX512-NEXT: vmovaps (%eax,%ecx), %xmm1 ## EVEX TO VEX Compression encoding: [0xc5,0xf8,0x28,0x0c,0x08]
1508 ; X86-AVX512-NEXT: vinsertps $192, %xmm1, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x21,0xc1,0xc0]
1509 ; X86-AVX512-NEXT: ## xmm0 = xmm1[3],xmm0[1,2,3]
1510 ; X86-AVX512-NEXT: retl ## encoding: [0xc3]
1512 ; X64-SSE-LABEL: insertps_from_vector_load_offset_2:
1513 ; X64-SSE: ## %bb.0:
1514 ; X64-SSE-NEXT: shlq $4, %rsi ## encoding: [0x48,0xc1,0xe6,0x04]
1515 ; X64-SSE-NEXT: movaps (%rdi,%rsi), %xmm1 ## encoding: [0x0f,0x28,0x0c,0x37]
1516 ; X64-SSE-NEXT: insertps $192, %xmm1, %xmm0 ## encoding: [0x66,0x0f,0x3a,0x21,0xc1,0xc0]
1517 ; X64-SSE-NEXT: ## xmm0 = xmm1[3],xmm0[1,2,3]
1518 ; X64-SSE-NEXT: retq ## encoding: [0xc3]
1520 ; X64-AVX1-LABEL: insertps_from_vector_load_offset_2:
1521 ; X64-AVX1: ## %bb.0:
1522 ; X64-AVX1-NEXT: shlq $4, %rsi ## encoding: [0x48,0xc1,0xe6,0x04]
1523 ; X64-AVX1-NEXT: vmovaps (%rdi,%rsi), %xmm1 ## encoding: [0xc5,0xf8,0x28,0x0c,0x37]
1524 ; X64-AVX1-NEXT: vinsertps $192, %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x21,0xc1,0xc0]
1525 ; X64-AVX1-NEXT: ## xmm0 = xmm1[3],xmm0[1,2,3]
1526 ; X64-AVX1-NEXT: retq ## encoding: [0xc3]
1528 ; X64-AVX512-LABEL: insertps_from_vector_load_offset_2:
1529 ; X64-AVX512: ## %bb.0:
1530 ; X64-AVX512-NEXT: shlq $4, %rsi ## encoding: [0x48,0xc1,0xe6,0x04]
1531 ; X64-AVX512-NEXT: vmovaps (%rdi,%rsi), %xmm1 ## EVEX TO VEX Compression encoding: [0xc5,0xf8,0x28,0x0c,0x37]
1532 ; X64-AVX512-NEXT: vinsertps $192, %xmm1, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x21,0xc1,0xc0]
1533 ; X64-AVX512-NEXT: ## xmm0 = xmm1[3],xmm0[1,2,3]
1534 ; X64-AVX512-NEXT: retq ## encoding: [0xc3]
1535 %1 = getelementptr inbounds <4 x float>, <4 x float>* %pb, i64 %index
1536 %2 = load <4 x float>, <4 x float>* %1, align 16
1537 %3 = tail call <4 x float> @llvm.x86.sse41.insertps(<4 x float> %a, <4 x float> %2, i32 192)
1541 define <4 x float> @insertps_from_broadcast_loadf32(<4 x float> %a, float* nocapture readonly %fb, i64 %index) {
1542 ; X86-SSE-LABEL: insertps_from_broadcast_loadf32:
1543 ; X86-SSE: ## %bb.0:
1544 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %eax ## encoding: [0x8b,0x44,0x24,0x08]
1545 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %ecx ## encoding: [0x8b,0x4c,0x24,0x04]
1546 ; X86-SSE-NEXT: insertps $48, (%ecx,%eax,4), %xmm0 ## encoding: [0x66,0x0f,0x3a,0x21,0x04,0x81,0x30]
1547 ; X86-SSE-NEXT: ## xmm0 = xmm0[0,1,2],mem[0]
1548 ; X86-SSE-NEXT: retl ## encoding: [0xc3]
1550 ; X86-AVX1-LABEL: insertps_from_broadcast_loadf32:
1551 ; X86-AVX1: ## %bb.0:
1552 ; X86-AVX1-NEXT: movl {{[0-9]+}}(%esp), %eax ## encoding: [0x8b,0x44,0x24,0x08]
1553 ; X86-AVX1-NEXT: movl {{[0-9]+}}(%esp), %ecx ## encoding: [0x8b,0x4c,0x24,0x04]
1554 ; X86-AVX1-NEXT: vinsertps $48, (%ecx,%eax,4), %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x21,0x04,0x81,0x30]
1555 ; X86-AVX1-NEXT: ## xmm0 = xmm0[0,1,2],mem[0]
1556 ; X86-AVX1-NEXT: retl ## encoding: [0xc3]
1558 ; X86-AVX512-LABEL: insertps_from_broadcast_loadf32:
1559 ; X86-AVX512: ## %bb.0:
1560 ; X86-AVX512-NEXT: movl {{[0-9]+}}(%esp), %eax ## encoding: [0x8b,0x44,0x24,0x08]
1561 ; X86-AVX512-NEXT: movl {{[0-9]+}}(%esp), %ecx ## encoding: [0x8b,0x4c,0x24,0x04]
1562 ; X86-AVX512-NEXT: vinsertps $48, (%ecx,%eax,4), %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x21,0x04,0x81,0x30]
1563 ; X86-AVX512-NEXT: ## xmm0 = xmm0[0,1,2],mem[0]
1564 ; X86-AVX512-NEXT: retl ## encoding: [0xc3]
1566 ; X64-SSE-LABEL: insertps_from_broadcast_loadf32:
1567 ; X64-SSE: ## %bb.0:
1568 ; X64-SSE-NEXT: insertps $48, (%rdi,%rsi,4), %xmm0 ## encoding: [0x66,0x0f,0x3a,0x21,0x04,0xb7,0x30]
1569 ; X64-SSE-NEXT: ## xmm0 = xmm0[0,1,2],mem[0]
1570 ; X64-SSE-NEXT: retq ## encoding: [0xc3]
1572 ; X64-AVX1-LABEL: insertps_from_broadcast_loadf32:
1573 ; X64-AVX1: ## %bb.0:
1574 ; X64-AVX1-NEXT: vinsertps $48, (%rdi,%rsi,4), %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x21,0x04,0xb7,0x30]
1575 ; X64-AVX1-NEXT: ## xmm0 = xmm0[0,1,2],mem[0]
1576 ; X64-AVX1-NEXT: retq ## encoding: [0xc3]
1578 ; X64-AVX512-LABEL: insertps_from_broadcast_loadf32:
1579 ; X64-AVX512: ## %bb.0:
1580 ; X64-AVX512-NEXT: vinsertps $48, (%rdi,%rsi,4), %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x21,0x04,0xb7,0x30]
1581 ; X64-AVX512-NEXT: ## xmm0 = xmm0[0,1,2],mem[0]
1582 ; X64-AVX512-NEXT: retq ## encoding: [0xc3]
1583 %1 = getelementptr inbounds float, float* %fb, i64 %index
1584 %2 = load float, float* %1, align 4
1585 %3 = insertelement <4 x float> undef, float %2, i32 0
1586 %4 = insertelement <4 x float> %3, float %2, i32 1
1587 %5 = insertelement <4 x float> %4, float %2, i32 2
1588 %6 = insertelement <4 x float> %5, float %2, i32 3
1589 %7 = tail call <4 x float> @llvm.x86.sse41.insertps(<4 x float> %a, <4 x float> %6, i32 48)
1593 define <4 x float> @insertps_from_broadcast_loadv4f32(<4 x float> %a, <4 x float>* nocapture readonly %b) {
1594 ; X86-SSE-LABEL: insertps_from_broadcast_loadv4f32:
1595 ; X86-SSE: ## %bb.0:
1596 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %eax ## encoding: [0x8b,0x44,0x24,0x04]
1597 ; X86-SSE-NEXT: movups (%eax), %xmm1 ## encoding: [0x0f,0x10,0x08]
1598 ; X86-SSE-NEXT: insertps $48, %xmm1, %xmm0 ## encoding: [0x66,0x0f,0x3a,0x21,0xc1,0x30]
1599 ; X86-SSE-NEXT: ## xmm0 = xmm0[0,1,2],xmm1[0]
1600 ; X86-SSE-NEXT: retl ## encoding: [0xc3]
1602 ; X86-AVX1-LABEL: insertps_from_broadcast_loadv4f32:
1603 ; X86-AVX1: ## %bb.0:
1604 ; X86-AVX1-NEXT: movl {{[0-9]+}}(%esp), %eax ## encoding: [0x8b,0x44,0x24,0x04]
1605 ; X86-AVX1-NEXT: vinsertps $48, (%eax), %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x21,0x00,0x30]
1606 ; X86-AVX1-NEXT: ## xmm0 = xmm0[0,1,2],mem[0]
1607 ; X86-AVX1-NEXT: retl ## encoding: [0xc3]
1609 ; X86-AVX512-LABEL: insertps_from_broadcast_loadv4f32:
1610 ; X86-AVX512: ## %bb.0:
1611 ; X86-AVX512-NEXT: movl {{[0-9]+}}(%esp), %eax ## encoding: [0x8b,0x44,0x24,0x04]
1612 ; X86-AVX512-NEXT: vinsertps $48, (%eax), %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x21,0x00,0x30]
1613 ; X86-AVX512-NEXT: ## xmm0 = xmm0[0,1,2],mem[0]
1614 ; X86-AVX512-NEXT: retl ## encoding: [0xc3]
1616 ; X64-SSE-LABEL: insertps_from_broadcast_loadv4f32:
1617 ; X64-SSE: ## %bb.0:
1618 ; X64-SSE-NEXT: movups (%rdi), %xmm1 ## encoding: [0x0f,0x10,0x0f]
1619 ; X64-SSE-NEXT: insertps $48, %xmm1, %xmm0 ## encoding: [0x66,0x0f,0x3a,0x21,0xc1,0x30]
1620 ; X64-SSE-NEXT: ## xmm0 = xmm0[0,1,2],xmm1[0]
1621 ; X64-SSE-NEXT: retq ## encoding: [0xc3]
1623 ; X64-AVX1-LABEL: insertps_from_broadcast_loadv4f32:
1624 ; X64-AVX1: ## %bb.0:
1625 ; X64-AVX1-NEXT: vinsertps $48, (%rdi), %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x21,0x07,0x30]
1626 ; X64-AVX1-NEXT: ## xmm0 = xmm0[0,1,2],mem[0]
1627 ; X64-AVX1-NEXT: retq ## encoding: [0xc3]
1629 ; X64-AVX512-LABEL: insertps_from_broadcast_loadv4f32:
1630 ; X64-AVX512: ## %bb.0:
1631 ; X64-AVX512-NEXT: vinsertps $48, (%rdi), %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x21,0x07,0x30]
1632 ; X64-AVX512-NEXT: ## xmm0 = xmm0[0,1,2],mem[0]
1633 ; X64-AVX512-NEXT: retq ## encoding: [0xc3]
1634 %1 = load <4 x float>, <4 x float>* %b, align 4
1635 %2 = extractelement <4 x float> %1, i32 0
1636 %3 = insertelement <4 x float> undef, float %2, i32 0
1637 %4 = insertelement <4 x float> %3, float %2, i32 1
1638 %5 = insertelement <4 x float> %4, float %2, i32 2
1639 %6 = insertelement <4 x float> %5, float %2, i32 3
1640 %7 = tail call <4 x float> @llvm.x86.sse41.insertps(<4 x float> %a, <4 x float> %6, i32 48)
1644 define <4 x float> @insertps_from_broadcast_multiple_use(<4 x float> %a, <4 x float> %b, <4 x float> %c, <4 x float> %d, float* nocapture readonly %fb, i64 %index) {
1645 ; X86-SSE-LABEL: insertps_from_broadcast_multiple_use:
1646 ; X86-SSE: ## %bb.0:
1647 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %eax ## encoding: [0x8b,0x44,0x24,0x08]
1648 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %ecx ## encoding: [0x8b,0x4c,0x24,0x04]
1649 ; X86-SSE-NEXT: movss (%ecx,%eax,4), %xmm4 ## encoding: [0xf3,0x0f,0x10,0x24,0x81]
1650 ; X86-SSE-NEXT: ## xmm4 = mem[0],zero,zero,zero
1651 ; X86-SSE-NEXT: insertps $48, %xmm4, %xmm0 ## encoding: [0x66,0x0f,0x3a,0x21,0xc4,0x30]
1652 ; X86-SSE-NEXT: ## xmm0 = xmm0[0,1,2],xmm4[0]
1653 ; X86-SSE-NEXT: insertps $48, %xmm4, %xmm1 ## encoding: [0x66,0x0f,0x3a,0x21,0xcc,0x30]
1654 ; X86-SSE-NEXT: ## xmm1 = xmm1[0,1,2],xmm4[0]
1655 ; X86-SSE-NEXT: addps %xmm1, %xmm0 ## encoding: [0x0f,0x58,0xc1]
1656 ; X86-SSE-NEXT: insertps $48, %xmm4, %xmm2 ## encoding: [0x66,0x0f,0x3a,0x21,0xd4,0x30]
1657 ; X86-SSE-NEXT: ## xmm2 = xmm2[0,1,2],xmm4[0]
1658 ; X86-SSE-NEXT: insertps $48, %xmm4, %xmm3 ## encoding: [0x66,0x0f,0x3a,0x21,0xdc,0x30]
1659 ; X86-SSE-NEXT: ## xmm3 = xmm3[0,1,2],xmm4[0]
1660 ; X86-SSE-NEXT: addps %xmm2, %xmm3 ## encoding: [0x0f,0x58,0xda]
1661 ; X86-SSE-NEXT: addps %xmm3, %xmm0 ## encoding: [0x0f,0x58,0xc3]
1662 ; X86-SSE-NEXT: retl ## encoding: [0xc3]
1664 ; X86-AVX1-LABEL: insertps_from_broadcast_multiple_use:
1665 ; X86-AVX1: ## %bb.0:
1666 ; X86-AVX1-NEXT: movl {{[0-9]+}}(%esp), %eax ## encoding: [0x8b,0x44,0x24,0x08]
1667 ; X86-AVX1-NEXT: movl {{[0-9]+}}(%esp), %ecx ## encoding: [0x8b,0x4c,0x24,0x04]
1668 ; X86-AVX1-NEXT: vbroadcastss (%ecx,%eax,4), %xmm4 ## encoding: [0xc4,0xe2,0x79,0x18,0x24,0x81]
1669 ; X86-AVX1-NEXT: vinsertps $48, %xmm4, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x21,0xc4,0x30]
1670 ; X86-AVX1-NEXT: ## xmm0 = xmm0[0,1,2],xmm4[0]
1671 ; X86-AVX1-NEXT: vinsertps $48, %xmm4, %xmm1, %xmm1 ## encoding: [0xc4,0xe3,0x71,0x21,0xcc,0x30]
1672 ; X86-AVX1-NEXT: ## xmm1 = xmm1[0,1,2],xmm4[0]
1673 ; X86-AVX1-NEXT: vaddps %xmm1, %xmm0, %xmm0 ## encoding: [0xc5,0xf8,0x58,0xc1]
1674 ; X86-AVX1-NEXT: vinsertps $48, %xmm4, %xmm2, %xmm1 ## encoding: [0xc4,0xe3,0x69,0x21,0xcc,0x30]
1675 ; X86-AVX1-NEXT: ## xmm1 = xmm2[0,1,2],xmm4[0]
1676 ; X86-AVX1-NEXT: vinsertps $48, %xmm4, %xmm3, %xmm2 ## encoding: [0xc4,0xe3,0x61,0x21,0xd4,0x30]
1677 ; X86-AVX1-NEXT: ## xmm2 = xmm3[0,1,2],xmm4[0]
1678 ; X86-AVX1-NEXT: vaddps %xmm2, %xmm1, %xmm1 ## encoding: [0xc5,0xf0,0x58,0xca]
1679 ; X86-AVX1-NEXT: vaddps %xmm1, %xmm0, %xmm0 ## encoding: [0xc5,0xf8,0x58,0xc1]
1680 ; X86-AVX1-NEXT: retl ## encoding: [0xc3]
1682 ; X86-AVX512-LABEL: insertps_from_broadcast_multiple_use:
1683 ; X86-AVX512: ## %bb.0:
1684 ; X86-AVX512-NEXT: movl {{[0-9]+}}(%esp), %eax ## encoding: [0x8b,0x44,0x24,0x08]
1685 ; X86-AVX512-NEXT: movl {{[0-9]+}}(%esp), %ecx ## encoding: [0x8b,0x4c,0x24,0x04]
1686 ; X86-AVX512-NEXT: vbroadcastss (%ecx,%eax,4), %xmm4 ## EVEX TO VEX Compression encoding: [0xc4,0xe2,0x79,0x18,0x24,0x81]
1687 ; X86-AVX512-NEXT: vinsertps $48, %xmm4, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x21,0xc4,0x30]
1688 ; X86-AVX512-NEXT: ## xmm0 = xmm0[0,1,2],xmm4[0]
1689 ; X86-AVX512-NEXT: vinsertps $48, %xmm4, %xmm1, %xmm1 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x71,0x21,0xcc,0x30]
1690 ; X86-AVX512-NEXT: ## xmm1 = xmm1[0,1,2],xmm4[0]
1691 ; X86-AVX512-NEXT: vaddps %xmm1, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc5,0xf8,0x58,0xc1]
1692 ; X86-AVX512-NEXT: vinsertps $48, %xmm4, %xmm2, %xmm1 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x69,0x21,0xcc,0x30]
1693 ; X86-AVX512-NEXT: ## xmm1 = xmm2[0,1,2],xmm4[0]
1694 ; X86-AVX512-NEXT: vinsertps $48, %xmm4, %xmm3, %xmm2 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x61,0x21,0xd4,0x30]
1695 ; X86-AVX512-NEXT: ## xmm2 = xmm3[0,1,2],xmm4[0]
1696 ; X86-AVX512-NEXT: vaddps %xmm2, %xmm1, %xmm1 ## EVEX TO VEX Compression encoding: [0xc5,0xf0,0x58,0xca]
1697 ; X86-AVX512-NEXT: vaddps %xmm1, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc5,0xf8,0x58,0xc1]
1698 ; X86-AVX512-NEXT: retl ## encoding: [0xc3]
1700 ; X64-SSE-LABEL: insertps_from_broadcast_multiple_use:
1701 ; X64-SSE: ## %bb.0:
1702 ; X64-SSE-NEXT: movss (%rdi,%rsi,4), %xmm4 ## encoding: [0xf3,0x0f,0x10,0x24,0xb7]
1703 ; X64-SSE-NEXT: ## xmm4 = mem[0],zero,zero,zero
1704 ; X64-SSE-NEXT: insertps $48, %xmm4, %xmm0 ## encoding: [0x66,0x0f,0x3a,0x21,0xc4,0x30]
1705 ; X64-SSE-NEXT: ## xmm0 = xmm0[0,1,2],xmm4[0]
1706 ; X64-SSE-NEXT: insertps $48, %xmm4, %xmm1 ## encoding: [0x66,0x0f,0x3a,0x21,0xcc,0x30]
1707 ; X64-SSE-NEXT: ## xmm1 = xmm1[0,1,2],xmm4[0]
1708 ; X64-SSE-NEXT: addps %xmm1, %xmm0 ## encoding: [0x0f,0x58,0xc1]
1709 ; X64-SSE-NEXT: insertps $48, %xmm4, %xmm2 ## encoding: [0x66,0x0f,0x3a,0x21,0xd4,0x30]
1710 ; X64-SSE-NEXT: ## xmm2 = xmm2[0,1,2],xmm4[0]
1711 ; X64-SSE-NEXT: insertps $48, %xmm4, %xmm3 ## encoding: [0x66,0x0f,0x3a,0x21,0xdc,0x30]
1712 ; X64-SSE-NEXT: ## xmm3 = xmm3[0,1,2],xmm4[0]
1713 ; X64-SSE-NEXT: addps %xmm2, %xmm3 ## encoding: [0x0f,0x58,0xda]
1714 ; X64-SSE-NEXT: addps %xmm3, %xmm0 ## encoding: [0x0f,0x58,0xc3]
1715 ; X64-SSE-NEXT: retq ## encoding: [0xc3]
1717 ; X64-AVX1-LABEL: insertps_from_broadcast_multiple_use:
1718 ; X64-AVX1: ## %bb.0:
1719 ; X64-AVX1-NEXT: vbroadcastss (%rdi,%rsi,4), %xmm4 ## encoding: [0xc4,0xe2,0x79,0x18,0x24,0xb7]
1720 ; X64-AVX1-NEXT: vinsertps $48, %xmm4, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x21,0xc4,0x30]
1721 ; X64-AVX1-NEXT: ## xmm0 = xmm0[0,1,2],xmm4[0]
1722 ; X64-AVX1-NEXT: vinsertps $48, %xmm4, %xmm1, %xmm1 ## encoding: [0xc4,0xe3,0x71,0x21,0xcc,0x30]
1723 ; X64-AVX1-NEXT: ## xmm1 = xmm1[0,1,2],xmm4[0]
1724 ; X64-AVX1-NEXT: vaddps %xmm1, %xmm0, %xmm0 ## encoding: [0xc5,0xf8,0x58,0xc1]
1725 ; X64-AVX1-NEXT: vinsertps $48, %xmm4, %xmm2, %xmm1 ## encoding: [0xc4,0xe3,0x69,0x21,0xcc,0x30]
1726 ; X64-AVX1-NEXT: ## xmm1 = xmm2[0,1,2],xmm4[0]
1727 ; X64-AVX1-NEXT: vinsertps $48, %xmm4, %xmm3, %xmm2 ## encoding: [0xc4,0xe3,0x61,0x21,0xd4,0x30]
1728 ; X64-AVX1-NEXT: ## xmm2 = xmm3[0,1,2],xmm4[0]
1729 ; X64-AVX1-NEXT: vaddps %xmm2, %xmm1, %xmm1 ## encoding: [0xc5,0xf0,0x58,0xca]
1730 ; X64-AVX1-NEXT: vaddps %xmm1, %xmm0, %xmm0 ## encoding: [0xc5,0xf8,0x58,0xc1]
1731 ; X64-AVX1-NEXT: retq ## encoding: [0xc3]
1733 ; X64-AVX512-LABEL: insertps_from_broadcast_multiple_use:
1734 ; X64-AVX512: ## %bb.0:
1735 ; X64-AVX512-NEXT: vbroadcastss (%rdi,%rsi,4), %xmm4 ## EVEX TO VEX Compression encoding: [0xc4,0xe2,0x79,0x18,0x24,0xb7]
1736 ; X64-AVX512-NEXT: vinsertps $48, %xmm4, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x21,0xc4,0x30]
1737 ; X64-AVX512-NEXT: ## xmm0 = xmm0[0,1,2],xmm4[0]
1738 ; X64-AVX512-NEXT: vinsertps $48, %xmm4, %xmm1, %xmm1 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x71,0x21,0xcc,0x30]
1739 ; X64-AVX512-NEXT: ## xmm1 = xmm1[0,1,2],xmm4[0]
1740 ; X64-AVX512-NEXT: vaddps %xmm1, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc5,0xf8,0x58,0xc1]
1741 ; X64-AVX512-NEXT: vinsertps $48, %xmm4, %xmm2, %xmm1 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x69,0x21,0xcc,0x30]
1742 ; X64-AVX512-NEXT: ## xmm1 = xmm2[0,1,2],xmm4[0]
1743 ; X64-AVX512-NEXT: vinsertps $48, %xmm4, %xmm3, %xmm2 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x61,0x21,0xd4,0x30]
1744 ; X64-AVX512-NEXT: ## xmm2 = xmm3[0,1,2],xmm4[0]
1745 ; X64-AVX512-NEXT: vaddps %xmm2, %xmm1, %xmm1 ## EVEX TO VEX Compression encoding: [0xc5,0xf0,0x58,0xca]
1746 ; X64-AVX512-NEXT: vaddps %xmm1, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc5,0xf8,0x58,0xc1]
1747 ; X64-AVX512-NEXT: retq ## encoding: [0xc3]
1748 %1 = getelementptr inbounds float, float* %fb, i64 %index
1749 %2 = load float, float* %1, align 4
1750 %3 = insertelement <4 x float> undef, float %2, i32 0
1751 %4 = insertelement <4 x float> %3, float %2, i32 1
1752 %5 = insertelement <4 x float> %4, float %2, i32 2
1753 %6 = insertelement <4 x float> %5, float %2, i32 3
1754 %7 = tail call <4 x float> @llvm.x86.sse41.insertps(<4 x float> %a, <4 x float> %6, i32 48)
1755 %8 = tail call <4 x float> @llvm.x86.sse41.insertps(<4 x float> %b, <4 x float> %6, i32 48)
1756 %9 = tail call <4 x float> @llvm.x86.sse41.insertps(<4 x float> %c, <4 x float> %6, i32 48)
1757 %10 = tail call <4 x float> @llvm.x86.sse41.insertps(<4 x float> %d, <4 x float> %6, i32 48)
1758 %11 = fadd <4 x float> %7, %8
1759 %12 = fadd <4 x float> %9, %10
1760 %13 = fadd <4 x float> %11, %12
1764 define <4 x float> @insertps_with_undefs(<4 x float> %a, float* %b) {
1765 ; X86-SSE-LABEL: insertps_with_undefs:
1766 ; X86-SSE: ## %bb.0:
1767 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %eax ## encoding: [0x8b,0x44,0x24,0x04]
1768 ; X86-SSE-NEXT: movss (%eax), %xmm1 ## encoding: [0xf3,0x0f,0x10,0x08]
1769 ; X86-SSE-NEXT: ## xmm1 = mem[0],zero,zero,zero
1770 ; X86-SSE-NEXT: movlhps %xmm0, %xmm1 ## encoding: [0x0f,0x16,0xc8]
1771 ; X86-SSE-NEXT: ## xmm1 = xmm1[0],xmm0[0]
1772 ; X86-SSE-NEXT: movaps %xmm1, %xmm0 ## encoding: [0x0f,0x28,0xc1]
1773 ; X86-SSE-NEXT: retl ## encoding: [0xc3]
1775 ; X86-AVX1-LABEL: insertps_with_undefs:
1776 ; X86-AVX1: ## %bb.0:
1777 ; X86-AVX1-NEXT: movl {{[0-9]+}}(%esp), %eax ## encoding: [0x8b,0x44,0x24,0x04]
1778 ; X86-AVX1-NEXT: vmovss (%eax), %xmm1 ## encoding: [0xc5,0xfa,0x10,0x08]
1779 ; X86-AVX1-NEXT: ## xmm1 = mem[0],zero,zero,zero
1780 ; X86-AVX1-NEXT: vmovlhps %xmm0, %xmm1, %xmm0 ## encoding: [0xc5,0xf0,0x16,0xc0]
1781 ; X86-AVX1-NEXT: ## xmm0 = xmm1[0],xmm0[0]
1782 ; X86-AVX1-NEXT: retl ## encoding: [0xc3]
1784 ; X86-AVX512-LABEL: insertps_with_undefs:
1785 ; X86-AVX512: ## %bb.0:
1786 ; X86-AVX512-NEXT: movl {{[0-9]+}}(%esp), %eax ## encoding: [0x8b,0x44,0x24,0x04]
1787 ; X86-AVX512-NEXT: vmovss (%eax), %xmm1 ## EVEX TO VEX Compression encoding: [0xc5,0xfa,0x10,0x08]
1788 ; X86-AVX512-NEXT: ## xmm1 = mem[0],zero,zero,zero
1789 ; X86-AVX512-NEXT: vmovlhps %xmm0, %xmm1, %xmm0 ## EVEX TO VEX Compression encoding: [0xc5,0xf0,0x16,0xc0]
1790 ; X86-AVX512-NEXT: ## xmm0 = xmm1[0],xmm0[0]
1791 ; X86-AVX512-NEXT: retl ## encoding: [0xc3]
1793 ; X64-SSE-LABEL: insertps_with_undefs:
1794 ; X64-SSE: ## %bb.0:
1795 ; X64-SSE-NEXT: movss (%rdi), %xmm1 ## encoding: [0xf3,0x0f,0x10,0x0f]
1796 ; X64-SSE-NEXT: ## xmm1 = mem[0],zero,zero,zero
1797 ; X64-SSE-NEXT: movlhps %xmm0, %xmm1 ## encoding: [0x0f,0x16,0xc8]
1798 ; X64-SSE-NEXT: ## xmm1 = xmm1[0],xmm0[0]
1799 ; X64-SSE-NEXT: movaps %xmm1, %xmm0 ## encoding: [0x0f,0x28,0xc1]
1800 ; X64-SSE-NEXT: retq ## encoding: [0xc3]
1802 ; X64-AVX1-LABEL: insertps_with_undefs:
1803 ; X64-AVX1: ## %bb.0:
1804 ; X64-AVX1-NEXT: vmovss (%rdi), %xmm1 ## encoding: [0xc5,0xfa,0x10,0x0f]
1805 ; X64-AVX1-NEXT: ## xmm1 = mem[0],zero,zero,zero
1806 ; X64-AVX1-NEXT: vmovlhps %xmm0, %xmm1, %xmm0 ## encoding: [0xc5,0xf0,0x16,0xc0]
1807 ; X64-AVX1-NEXT: ## xmm0 = xmm1[0],xmm0[0]
1808 ; X64-AVX1-NEXT: retq ## encoding: [0xc3]
1810 ; X64-AVX512-LABEL: insertps_with_undefs:
1811 ; X64-AVX512: ## %bb.0:
1812 ; X64-AVX512-NEXT: vmovss (%rdi), %xmm1 ## EVEX TO VEX Compression encoding: [0xc5,0xfa,0x10,0x0f]
1813 ; X64-AVX512-NEXT: ## xmm1 = mem[0],zero,zero,zero
1814 ; X64-AVX512-NEXT: vmovlhps %xmm0, %xmm1, %xmm0 ## EVEX TO VEX Compression encoding: [0xc5,0xf0,0x16,0xc0]
1815 ; X64-AVX512-NEXT: ## xmm0 = xmm1[0],xmm0[0]
1816 ; X64-AVX512-NEXT: retq ## encoding: [0xc3]
1817 %1 = load float, float* %b, align 4
1818 %2 = insertelement <4 x float> undef, float %1, i32 0
1819 %result = shufflevector <4 x float> %a, <4 x float> %2, <4 x i32> <i32 4, i32 undef, i32 0, i32 7>
1820 ret <4 x float> %result
1823 ; Test for a bug in X86ISelLowering.cpp:getINSERTPS where we were using
1824 ; the destination index to change the load, instead of the source index.
1825 define <4 x float> @pr20087(<4 x float> %a, <4 x float> *%ptr) {
1826 ; X86-SSE-LABEL: pr20087:
1827 ; X86-SSE: ## %bb.0:
1828 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %eax ## encoding: [0x8b,0x44,0x24,0x04]
1829 ; X86-SSE-NEXT: movaps (%eax), %xmm1 ## encoding: [0x0f,0x28,0x08]
1830 ; X86-SSE-NEXT: insertps $178, %xmm1, %xmm0 ## encoding: [0x66,0x0f,0x3a,0x21,0xc1,0xb2]
1831 ; X86-SSE-NEXT: ## xmm0 = xmm0[0],zero,xmm0[2],xmm1[2]
1832 ; X86-SSE-NEXT: retl ## encoding: [0xc3]
1834 ; X86-AVX1-LABEL: pr20087:
1835 ; X86-AVX1: ## %bb.0:
1836 ; X86-AVX1-NEXT: movl {{[0-9]+}}(%esp), %eax ## encoding: [0x8b,0x44,0x24,0x04]
1837 ; X86-AVX1-NEXT: vmovaps (%eax), %xmm1 ## encoding: [0xc5,0xf8,0x28,0x08]
1838 ; X86-AVX1-NEXT: vinsertps $178, %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x21,0xc1,0xb2]
1839 ; X86-AVX1-NEXT: ## xmm0 = xmm0[0],zero,xmm0[2],xmm1[2]
1840 ; X86-AVX1-NEXT: retl ## encoding: [0xc3]
1842 ; X86-AVX512-LABEL: pr20087:
1843 ; X86-AVX512: ## %bb.0:
1844 ; X86-AVX512-NEXT: movl {{[0-9]+}}(%esp), %eax ## encoding: [0x8b,0x44,0x24,0x04]
1845 ; X86-AVX512-NEXT: vmovaps (%eax), %xmm1 ## EVEX TO VEX Compression encoding: [0xc5,0xf8,0x28,0x08]
1846 ; X86-AVX512-NEXT: vinsertps $178, %xmm1, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x21,0xc1,0xb2]
1847 ; X86-AVX512-NEXT: ## xmm0 = xmm0[0],zero,xmm0[2],xmm1[2]
1848 ; X86-AVX512-NEXT: retl ## encoding: [0xc3]
1850 ; X64-SSE-LABEL: pr20087:
1851 ; X64-SSE: ## %bb.0:
1852 ; X64-SSE-NEXT: movaps (%rdi), %xmm1 ## encoding: [0x0f,0x28,0x0f]
1853 ; X64-SSE-NEXT: insertps $178, %xmm1, %xmm0 ## encoding: [0x66,0x0f,0x3a,0x21,0xc1,0xb2]
1854 ; X64-SSE-NEXT: ## xmm0 = xmm0[0],zero,xmm0[2],xmm1[2]
1855 ; X64-SSE-NEXT: retq ## encoding: [0xc3]
1857 ; X64-AVX1-LABEL: pr20087:
1858 ; X64-AVX1: ## %bb.0:
1859 ; X64-AVX1-NEXT: vmovaps (%rdi), %xmm1 ## encoding: [0xc5,0xf8,0x28,0x0f]
1860 ; X64-AVX1-NEXT: vinsertps $178, %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x21,0xc1,0xb2]
1861 ; X64-AVX1-NEXT: ## xmm0 = xmm0[0],zero,xmm0[2],xmm1[2]
1862 ; X64-AVX1-NEXT: retq ## encoding: [0xc3]
1864 ; X64-AVX512-LABEL: pr20087:
1865 ; X64-AVX512: ## %bb.0:
1866 ; X64-AVX512-NEXT: vmovaps (%rdi), %xmm1 ## EVEX TO VEX Compression encoding: [0xc5,0xf8,0x28,0x0f]
1867 ; X64-AVX512-NEXT: vinsertps $178, %xmm1, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x21,0xc1,0xb2]
1868 ; X64-AVX512-NEXT: ## xmm0 = xmm0[0],zero,xmm0[2],xmm1[2]
1869 ; X64-AVX512-NEXT: retq ## encoding: [0xc3]
1870 %load = load <4 x float> , <4 x float> *%ptr
1871 %ret = shufflevector <4 x float> %load, <4 x float> %a, <4 x i32> <i32 4, i32 undef, i32 6, i32 2>
1872 ret <4 x float> %ret
1875 ; Edge case for insertps where we end up with a shuffle with mask=<0, 7, -1, -1>
1876 define void @insertps_pr20411(<4 x i32> %shuffle109, <4 x i32> %shuffle116, i32* noalias nocapture %RET) #1 {
1877 ; X86-SSE-LABEL: insertps_pr20411:
1878 ; X86-SSE: ## %bb.0:
1879 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %eax ## encoding: [0x8b,0x44,0x24,0x04]
1880 ; X86-SSE-NEXT: pshufd $78, %xmm1, %xmm1 ## encoding: [0x66,0x0f,0x70,0xc9,0x4e]
1881 ; X86-SSE-NEXT: ## xmm1 = xmm1[2,3,0,1]
1882 ; X86-SSE-NEXT: pblendw $243, %xmm0, %xmm1 ## encoding: [0x66,0x0f,0x3a,0x0e,0xc8,0xf3]
1883 ; X86-SSE-NEXT: ## xmm1 = xmm0[0,1],xmm1[2,3],xmm0[4,5,6,7]
1884 ; X86-SSE-NEXT: movdqu %xmm1, (%eax) ## encoding: [0xf3,0x0f,0x7f,0x08]
1885 ; X86-SSE-NEXT: retl ## encoding: [0xc3]
1887 ; X86-AVX1-LABEL: insertps_pr20411:
1888 ; X86-AVX1: ## %bb.0:
1889 ; X86-AVX1-NEXT: movl {{[0-9]+}}(%esp), %eax ## encoding: [0x8b,0x44,0x24,0x04]
1890 ; X86-AVX1-NEXT: vpermilps $78, %xmm1, %xmm1 ## encoding: [0xc4,0xe3,0x79,0x04,0xc9,0x4e]
1891 ; X86-AVX1-NEXT: ## xmm1 = xmm1[2,3,0,1]
1892 ; X86-AVX1-NEXT: vblendps $2, %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x0c,0xc1,0x02]
1893 ; X86-AVX1-NEXT: ## xmm0 = xmm0[0],xmm1[1],xmm0[2,3]
1894 ; X86-AVX1-NEXT: vmovups %xmm0, (%eax) ## encoding: [0xc5,0xf8,0x11,0x00]
1895 ; X86-AVX1-NEXT: retl ## encoding: [0xc3]
1897 ; X86-AVX512-LABEL: insertps_pr20411:
1898 ; X86-AVX512: ## %bb.0:
1899 ; X86-AVX512-NEXT: movl {{[0-9]+}}(%esp), %eax ## encoding: [0x8b,0x44,0x24,0x04]
1900 ; X86-AVX512-NEXT: vpermilps $78, %xmm1, %xmm1 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x04,0xc9,0x4e]
1901 ; X86-AVX512-NEXT: ## xmm1 = xmm1[2,3,0,1]
1902 ; X86-AVX512-NEXT: vblendps $2, %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x0c,0xc1,0x02]
1903 ; X86-AVX512-NEXT: ## xmm0 = xmm0[0],xmm1[1],xmm0[2,3]
1904 ; X86-AVX512-NEXT: vmovups %xmm0, (%eax) ## EVEX TO VEX Compression encoding: [0xc5,0xf8,0x11,0x00]
1905 ; X86-AVX512-NEXT: retl ## encoding: [0xc3]
1907 ; X64-SSE-LABEL: insertps_pr20411:
1908 ; X64-SSE: ## %bb.0:
1909 ; X64-SSE-NEXT: pshufd $78, %xmm1, %xmm1 ## encoding: [0x66,0x0f,0x70,0xc9,0x4e]
1910 ; X64-SSE-NEXT: ## xmm1 = xmm1[2,3,0,1]
1911 ; X64-SSE-NEXT: pblendw $243, %xmm0, %xmm1 ## encoding: [0x66,0x0f,0x3a,0x0e,0xc8,0xf3]
1912 ; X64-SSE-NEXT: ## xmm1 = xmm0[0,1],xmm1[2,3],xmm0[4,5,6,7]
1913 ; X64-SSE-NEXT: movdqu %xmm1, (%rdi) ## encoding: [0xf3,0x0f,0x7f,0x0f]
1914 ; X64-SSE-NEXT: retq ## encoding: [0xc3]
1916 ; X64-AVX1-LABEL: insertps_pr20411:
1917 ; X64-AVX1: ## %bb.0:
1918 ; X64-AVX1-NEXT: vpermilps $78, %xmm1, %xmm1 ## encoding: [0xc4,0xe3,0x79,0x04,0xc9,0x4e]
1919 ; X64-AVX1-NEXT: ## xmm1 = xmm1[2,3,0,1]
1920 ; X64-AVX1-NEXT: vblendps $2, %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x0c,0xc1,0x02]
1921 ; X64-AVX1-NEXT: ## xmm0 = xmm0[0],xmm1[1],xmm0[2,3]
1922 ; X64-AVX1-NEXT: vmovups %xmm0, (%rdi) ## encoding: [0xc5,0xf8,0x11,0x07]
1923 ; X64-AVX1-NEXT: retq ## encoding: [0xc3]
1925 ; X64-AVX512-LABEL: insertps_pr20411:
1926 ; X64-AVX512: ## %bb.0:
1927 ; X64-AVX512-NEXT: vpermilps $78, %xmm1, %xmm1 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x04,0xc9,0x4e]
1928 ; X64-AVX512-NEXT: ## xmm1 = xmm1[2,3,0,1]
1929 ; X64-AVX512-NEXT: vblendps $2, %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x0c,0xc1,0x02]
1930 ; X64-AVX512-NEXT: ## xmm0 = xmm0[0],xmm1[1],xmm0[2,3]
1931 ; X64-AVX512-NEXT: vmovups %xmm0, (%rdi) ## EVEX TO VEX Compression encoding: [0xc5,0xf8,0x11,0x07]
1932 ; X64-AVX512-NEXT: retq ## encoding: [0xc3]
1933 %shuffle117 = shufflevector <4 x i32> %shuffle109, <4 x i32> %shuffle116, <4 x i32> <i32 0, i32 7, i32 undef, i32 undef>
1934 %ptrcast = bitcast i32* %RET to <4 x i32>*
1935 store <4 x i32> %shuffle117, <4 x i32>* %ptrcast, align 4
1939 define <4 x float> @insertps_4(<4 x float> %A, <4 x float> %B) {
1940 ; SSE-LABEL: insertps_4:
1942 ; SSE-NEXT: insertps $170, %xmm1, %xmm0 ## encoding: [0x66,0x0f,0x3a,0x21,0xc1,0xaa]
1943 ; SSE-NEXT: ## xmm0 = xmm0[0],zero,xmm1[2],zero
1944 ; SSE-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
1946 ; AVX1-LABEL: insertps_4:
1948 ; AVX1-NEXT: vinsertps $170, %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x21,0xc1,0xaa]
1949 ; AVX1-NEXT: ## xmm0 = xmm0[0],zero,xmm1[2],zero
1950 ; AVX1-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
1952 ; AVX512-LABEL: insertps_4:
1954 ; AVX512-NEXT: vinsertps $170, %xmm1, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x21,0xc1,0xaa]
1955 ; AVX512-NEXT: ## xmm0 = xmm0[0],zero,xmm1[2],zero
1956 ; AVX512-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
1957 %vecext = extractelement <4 x float> %A, i32 0
1958 %vecinit = insertelement <4 x float> undef, float %vecext, i32 0
1959 %vecinit1 = insertelement <4 x float> %vecinit, float 0.000000e+00, i32 1
1960 %vecext2 = extractelement <4 x float> %B, i32 2
1961 %vecinit3 = insertelement <4 x float> %vecinit1, float %vecext2, i32 2
1962 %vecinit4 = insertelement <4 x float> %vecinit3, float 0.000000e+00, i32 3
1963 ret <4 x float> %vecinit4
1966 define <4 x float> @insertps_5(<4 x float> %A, <4 x float> %B) {
1967 ; SSE-LABEL: insertps_5:
1969 ; SSE-NEXT: insertps $92, %xmm1, %xmm0 ## encoding: [0x66,0x0f,0x3a,0x21,0xc1,0x5c]
1970 ; SSE-NEXT: ## xmm0 = xmm0[0],xmm1[1],zero,zero
1971 ; SSE-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
1973 ; AVX1-LABEL: insertps_5:
1975 ; AVX1-NEXT: vinsertps $92, %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x21,0xc1,0x5c]
1976 ; AVX1-NEXT: ## xmm0 = xmm0[0],xmm1[1],zero,zero
1977 ; AVX1-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
1979 ; AVX512-LABEL: insertps_5:
1981 ; AVX512-NEXT: vpblendd $2, %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x02,0xc1,0x02]
1982 ; AVX512-NEXT: ## xmm0 = xmm0[0],xmm1[1],xmm0[2,3]
1983 ; AVX512-NEXT: vmovq %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc5,0xfa,0x7e,0xc0]
1984 ; AVX512-NEXT: ## xmm0 = xmm0[0],zero
1985 ; AVX512-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
1986 %vecext = extractelement <4 x float> %A, i32 0
1987 %vecinit = insertelement <4 x float> undef, float %vecext, i32 0
1988 %vecext1 = extractelement <4 x float> %B, i32 1
1989 %vecinit2 = insertelement <4 x float> %vecinit, float %vecext1, i32 1
1990 %vecinit3 = insertelement <4 x float> %vecinit2, float 0.000000e+00, i32 2
1991 %vecinit4 = insertelement <4 x float> %vecinit3, float 0.000000e+00, i32 3
1992 ret <4 x float> %vecinit4
1995 define <4 x float> @insertps_6(<4 x float> %A, <4 x float> %B) {
1996 ; SSE-LABEL: insertps_6:
1998 ; SSE-NEXT: insertps $169, %xmm1, %xmm0 ## encoding: [0x66,0x0f,0x3a,0x21,0xc1,0xa9]
1999 ; SSE-NEXT: ## xmm0 = zero,xmm0[1],xmm1[2],zero
2000 ; SSE-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
2002 ; AVX1-LABEL: insertps_6:
2004 ; AVX1-NEXT: vinsertps $169, %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x21,0xc1,0xa9]
2005 ; AVX1-NEXT: ## xmm0 = zero,xmm0[1],xmm1[2],zero
2006 ; AVX1-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
2008 ; AVX512-LABEL: insertps_6:
2010 ; AVX512-NEXT: vinsertps $169, %xmm1, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x21,0xc1,0xa9]
2011 ; AVX512-NEXT: ## xmm0 = zero,xmm0[1],xmm1[2],zero
2012 ; AVX512-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
2013 %vecext = extractelement <4 x float> %A, i32 1
2014 %vecinit = insertelement <4 x float> <float 0.000000e+00, float undef, float undef, float undef>, float %vecext, i32 1
2015 %vecext1 = extractelement <4 x float> %B, i32 2
2016 %vecinit2 = insertelement <4 x float> %vecinit, float %vecext1, i32 2
2017 %vecinit3 = insertelement <4 x float> %vecinit2, float 0.000000e+00, i32 3
2018 ret <4 x float> %vecinit3
2021 define <4 x float> @insertps_7(<4 x float> %A, <4 x float> %B) {
2022 ; SSE-LABEL: insertps_7:
2024 ; SSE-NEXT: insertps $106, %xmm1, %xmm0 ## encoding: [0x66,0x0f,0x3a,0x21,0xc1,0x6a]
2025 ; SSE-NEXT: ## xmm0 = xmm0[0],zero,xmm1[1],zero
2026 ; SSE-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
2028 ; AVX1-LABEL: insertps_7:
2030 ; AVX1-NEXT: vinsertps $106, %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x21,0xc1,0x6a]
2031 ; AVX1-NEXT: ## xmm0 = xmm0[0],zero,xmm1[1],zero
2032 ; AVX1-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
2034 ; AVX512-LABEL: insertps_7:
2036 ; AVX512-NEXT: vinsertps $106, %xmm1, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x21,0xc1,0x6a]
2037 ; AVX512-NEXT: ## xmm0 = xmm0[0],zero,xmm1[1],zero
2038 ; AVX512-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
2039 %vecext = extractelement <4 x float> %A, i32 0
2040 %vecinit = insertelement <4 x float> undef, float %vecext, i32 0
2041 %vecinit1 = insertelement <4 x float> %vecinit, float 0.000000e+00, i32 1
2042 %vecext2 = extractelement <4 x float> %B, i32 1
2043 %vecinit3 = insertelement <4 x float> %vecinit1, float %vecext2, i32 2
2044 %vecinit4 = insertelement <4 x float> %vecinit3, float 0.000000e+00, i32 3
2045 ret <4 x float> %vecinit4
2048 define <4 x float> @insertps_8(<4 x float> %A, <4 x float> %B) {
2049 ; SSE-LABEL: insertps_8:
2051 ; SSE-NEXT: insertps $28, %xmm1, %xmm0 ## encoding: [0x66,0x0f,0x3a,0x21,0xc1,0x1c]
2052 ; SSE-NEXT: ## xmm0 = xmm0[0],xmm1[0],zero,zero
2053 ; SSE-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
2055 ; AVX1-LABEL: insertps_8:
2057 ; AVX1-NEXT: vinsertps $28, %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x21,0xc1,0x1c]
2058 ; AVX1-NEXT: ## xmm0 = xmm0[0],xmm1[0],zero,zero
2059 ; AVX1-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
2061 ; AVX512-LABEL: insertps_8:
2063 ; AVX512-NEXT: vinsertps $28, %xmm1, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x21,0xc1,0x1c]
2064 ; AVX512-NEXT: ## xmm0 = xmm0[0],xmm1[0],zero,zero
2065 ; AVX512-NEXT: vmovq %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc5,0xfa,0x7e,0xc0]
2066 ; AVX512-NEXT: ## xmm0 = xmm0[0],zero
2067 ; AVX512-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
2068 %vecext = extractelement <4 x float> %A, i32 0
2069 %vecinit = insertelement <4 x float> undef, float %vecext, i32 0
2070 %vecext1 = extractelement <4 x float> %B, i32 0
2071 %vecinit2 = insertelement <4 x float> %vecinit, float %vecext1, i32 1
2072 %vecinit3 = insertelement <4 x float> %vecinit2, float 0.000000e+00, i32 2
2073 %vecinit4 = insertelement <4 x float> %vecinit3, float 0.000000e+00, i32 3
2074 ret <4 x float> %vecinit4
2077 define <4 x float> @insertps_9(<4 x float> %A, <4 x float> %B) {
2078 ; SSE-LABEL: insertps_9:
2080 ; SSE-NEXT: insertps $25, %xmm0, %xmm1 ## encoding: [0x66,0x0f,0x3a,0x21,0xc8,0x19]
2081 ; SSE-NEXT: ## xmm1 = zero,xmm0[0],xmm1[2],zero
2082 ; SSE-NEXT: movaps %xmm1, %xmm0 ## encoding: [0x0f,0x28,0xc1]
2083 ; SSE-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
2085 ; AVX1-LABEL: insertps_9:
2087 ; AVX1-NEXT: vinsertps $25, %xmm0, %xmm1, %xmm0 ## encoding: [0xc4,0xe3,0x71,0x21,0xc0,0x19]
2088 ; AVX1-NEXT: ## xmm0 = zero,xmm0[0],xmm1[2],zero
2089 ; AVX1-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
2091 ; AVX512-LABEL: insertps_9:
2093 ; AVX512-NEXT: vinsertps $25, %xmm0, %xmm1, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x71,0x21,0xc0,0x19]
2094 ; AVX512-NEXT: ## xmm0 = zero,xmm0[0],xmm1[2],zero
2095 ; AVX512-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
2096 %vecext = extractelement <4 x float> %A, i32 0
2097 %vecinit = insertelement <4 x float> <float 0.000000e+00, float undef, float undef, float undef>, float %vecext, i32 1
2098 %vecext1 = extractelement <4 x float> %B, i32 2
2099 %vecinit2 = insertelement <4 x float> %vecinit, float %vecext1, i32 2
2100 %vecinit3 = insertelement <4 x float> %vecinit2, float 0.000000e+00, i32 3
2101 ret <4 x float> %vecinit3
2104 define <4 x float> @insertps_10(<4 x float> %A) {
2105 ; SSE-LABEL: insertps_10:
2107 ; SSE-NEXT: insertps $42, %xmm0, %xmm0 ## encoding: [0x66,0x0f,0x3a,0x21,0xc0,0x2a]
2108 ; SSE-NEXT: ## xmm0 = xmm0[0],zero,xmm0[0],zero
2109 ; SSE-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
2111 ; AVX1-LABEL: insertps_10:
2113 ; AVX1-NEXT: vinsertps $42, %xmm0, %xmm0, %xmm0 ## encoding: [0xc4,0xe3,0x79,0x21,0xc0,0x2a]
2114 ; AVX1-NEXT: ## xmm0 = xmm0[0],zero,xmm0[0],zero
2115 ; AVX1-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
2117 ; AVX512-LABEL: insertps_10:
2119 ; AVX512-NEXT: vinsertps $42, %xmm0, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe3,0x79,0x21,0xc0,0x2a]
2120 ; AVX512-NEXT: ## xmm0 = xmm0[0],zero,xmm0[0],zero
2121 ; AVX512-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
2122 %vecext = extractelement <4 x float> %A, i32 0
2123 %vecbuild1 = insertelement <4 x float> <float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00>, float %vecext, i32 0
2124 %vecbuild2 = insertelement <4 x float> %vecbuild1, float %vecext, i32 2
2125 ret <4 x float> %vecbuild2
2128 define <4 x float> @build_vector_to_shuffle_1(<4 x float> %A) {
2129 ; SSE-LABEL: build_vector_to_shuffle_1:
2131 ; SSE-NEXT: xorps %xmm1, %xmm1 ## encoding: [0x0f,0x57,0xc9]
2132 ; SSE-NEXT: blendps $5, %xmm1, %xmm0 ## encoding: [0x66,0x0f,0x3a,0x0c,0xc1,0x05]
2133 ; SSE-NEXT: ## xmm0 = xmm1[0],xmm0[1],xmm1[2],xmm0[3]
2134 ; SSE-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
2136 ; AVX1-LABEL: build_vector_to_shuffle_1:
2138 ; AVX1-NEXT: vxorps %xmm1, %xmm1, %xmm1 ## encoding: [0xc5,0xf0,0x57,0xc9]
2139 ; AVX1-NEXT: vblendps $10, %xmm0, %xmm1, %xmm0 ## encoding: [0xc4,0xe3,0x71,0x0c,0xc0,0x0a]
2140 ; AVX1-NEXT: ## xmm0 = xmm1[0],xmm0[1],xmm1[2],xmm0[3]
2141 ; AVX1-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
2143 ; AVX512-LABEL: build_vector_to_shuffle_1:
2145 ; AVX512-NEXT: vxorps %xmm1, %xmm1, %xmm1 ## EVEX TO VEX Compression encoding: [0xc5,0xf0,0x57,0xc9]
2146 ; AVX512-NEXT: vblendps $10, %xmm0, %xmm1, %xmm0 ## encoding: [0xc4,0xe3,0x71,0x0c,0xc0,0x0a]
2147 ; AVX512-NEXT: ## xmm0 = xmm1[0],xmm0[1],xmm1[2],xmm0[3]
2148 ; AVX512-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
2149 %vecext = extractelement <4 x float> %A, i32 1
2150 %vecinit = insertelement <4 x float> zeroinitializer, float %vecext, i32 1
2151 %vecinit1 = insertelement <4 x float> %vecinit, float 0.0, i32 2
2152 %vecinit3 = shufflevector <4 x float> %vecinit1, <4 x float> %A, <4 x i32> <i32 0, i32 1, i32 2, i32 7>
2153 ret <4 x float> %vecinit3
2156 define <4 x float> @build_vector_to_shuffle_2(<4 x float> %A) {
2157 ; SSE-LABEL: build_vector_to_shuffle_2:
2159 ; SSE-NEXT: xorps %xmm1, %xmm1 ## encoding: [0x0f,0x57,0xc9]
2160 ; SSE-NEXT: blendps $13, %xmm1, %xmm0 ## encoding: [0x66,0x0f,0x3a,0x0c,0xc1,0x0d]
2161 ; SSE-NEXT: ## xmm0 = xmm1[0],xmm0[1],xmm1[2,3]
2162 ; SSE-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
2164 ; AVX1-LABEL: build_vector_to_shuffle_2:
2166 ; AVX1-NEXT: vxorps %xmm1, %xmm1, %xmm1 ## encoding: [0xc5,0xf0,0x57,0xc9]
2167 ; AVX1-NEXT: vblendps $2, %xmm0, %xmm1, %xmm0 ## encoding: [0xc4,0xe3,0x71,0x0c,0xc0,0x02]
2168 ; AVX1-NEXT: ## xmm0 = xmm1[0],xmm0[1],xmm1[2,3]
2169 ; AVX1-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
2171 ; AVX512-LABEL: build_vector_to_shuffle_2:
2173 ; AVX512-NEXT: vxorps %xmm1, %xmm1, %xmm1 ## EVEX TO VEX Compression encoding: [0xc5,0xf0,0x57,0xc9]
2174 ; AVX512-NEXT: vblendps $2, %xmm0, %xmm1, %xmm0 ## encoding: [0xc4,0xe3,0x71,0x0c,0xc0,0x02]
2175 ; AVX512-NEXT: ## xmm0 = xmm1[0],xmm0[1],xmm1[2,3]
2176 ; AVX512-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
2177 %vecext = extractelement <4 x float> %A, i32 1
2178 %vecinit = insertelement <4 x float> zeroinitializer, float %vecext, i32 1
2179 %vecinit1 = insertelement <4 x float> %vecinit, float 0.0, i32 2
2180 ret <4 x float> %vecinit1