1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i686-- -mattr=+avx | FileCheck %s --check-prefixes=CHECK,X86
3 ; RUN: llc < %s -mtriple=x86_64-- -mattr=+avx2 | FileCheck %s --check-prefixes=CHECK,X64
5 define <2 x i64> @freeze_insert_vector_elt(<2 x i64> %a0) {
6 ; CHECK-LABEL: freeze_insert_vector_elt:
8 ; CHECK-NEXT: vxorps %xmm0, %xmm0, %xmm0
9 ; CHECK-NEXT: ret{{[l|q]}}
10 %idx0 = insertelement <2 x i64> %a0, i64 0, i64 0
11 %freeze0 = freeze <2 x i64> %idx0
12 %idx1 = insertelement <2 x i64> %freeze0, i64 0, i64 1
13 %freeze1 = freeze <2 x i64> %idx1
14 ret <2 x i64> %freeze1
17 define <4 x i32> @freeze_insert_subvector(<8 x i32> %a0) nounwind {
18 ; CHECK-LABEL: freeze_insert_subvector:
20 ; CHECK-NEXT: vxorps %xmm0, %xmm0, %xmm0
21 ; CHECK-NEXT: ret{{[l|q]}}
22 %x = shufflevector <8 x i32> %a0, <8 x i32> zeroinitializer, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 8, i32 9, i32 10, i32 11>
23 %y = freeze <8 x i32> %x
24 %z = shufflevector <8 x i32> %y, <8 x i32> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
28 define <2 x i64> @freeze_sign_extend_vector_inreg(<16 x i8> %a0) nounwind {
29 ; CHECK-LABEL: freeze_sign_extend_vector_inreg:
31 ; CHECK-NEXT: vpmovsxbq %xmm0, %xmm0
32 ; CHECK-NEXT: ret{{[l|q]}}
33 %x = sext <16 x i8> %a0 to <16 x i32>
34 %y = shufflevector <16 x i32> %x, <16 x i32> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
35 %z = freeze <4 x i32> %y
36 %w = sext <4 x i32> %z to <4 x i64>
37 %r = shufflevector <4 x i64> %w, <4 x i64> poison, <2 x i32> <i32 0, i32 1>
41 define <2 x i64> @freeze_zero_extend_vector_inreg(<16 x i8> %a0) nounwind {
42 ; CHECK-LABEL: freeze_zero_extend_vector_inreg:
44 ; CHECK-NEXT: vpmovzxbq {{.*#+}} xmm0 = xmm0[0],zero,zero,zero,zero,zero,zero,zero,xmm0[1],zero,zero,zero,zero,zero,zero,zero
45 ; CHECK-NEXT: ret{{[l|q]}}
46 %x = zext <16 x i8> %a0 to <16 x i32>
47 %y = shufflevector <16 x i32> %x, <16 x i32> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
48 %z = freeze <4 x i32> %y
49 %w = zext <4 x i32> %z to <4 x i64>
50 %r = shufflevector <4 x i64> %w, <4 x i64> poison, <2 x i32> <i32 0, i32 1>
54 define <4 x i32> @freeze_pshufd(<4 x i32> %a0) nounwind {
55 ; CHECK-LABEL: freeze_pshufd:
57 ; CHECK-NEXT: ret{{[l|q]}}
58 %x = shufflevector <4 x i32> %a0, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
59 %y = freeze <4 x i32> %x
60 %z = shufflevector <4 x i32> %y, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
64 define <4 x float> @freeze_permilps(<4 x float> %a0) nounwind {
65 ; CHECK-LABEL: freeze_permilps:
67 ; CHECK-NEXT: ret{{[l|q]}}
68 %x = shufflevector <4 x float> %a0, <4 x float> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
69 %y = freeze <4 x float> %x
70 %z = shufflevector <4 x float> %y, <4 x float> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
74 define void @freeze_bitcast_from_wider_elt(ptr %origin, ptr %dst) nounwind {
75 ; X86-LABEL: freeze_bitcast_from_wider_elt:
77 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
78 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
79 ; X86-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
80 ; X86-NEXT: vmovsd %xmm0, (%eax)
83 ; X64-LABEL: freeze_bitcast_from_wider_elt:
85 ; X64-NEXT: movq (%rdi), %rax
86 ; X64-NEXT: movq %rax, (%rsi)
88 %i0 = load <4 x i16>, ptr %origin
89 %i1 = bitcast <4 x i16> %i0 to <8 x i8>
90 %i2 = freeze <8 x i8> %i1
91 %i3 = bitcast <8 x i8> %i2 to i64
92 store i64 %i3, ptr %dst
95 define void @freeze_bitcast_from_wider_elt_escape(ptr %origin, ptr %escape, ptr %dst) nounwind {
96 ; X86-LABEL: freeze_bitcast_from_wider_elt_escape:
98 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
99 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
100 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
101 ; X86-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
102 ; X86-NEXT: vmovsd %xmm0, (%ecx)
103 ; X86-NEXT: vmovsd %xmm0, (%eax)
106 ; X64-LABEL: freeze_bitcast_from_wider_elt_escape:
108 ; X64-NEXT: movq (%rdi), %rax
109 ; X64-NEXT: movq %rax, (%rsi)
110 ; X64-NEXT: movq %rax, (%rdx)
112 %i0 = load <4 x i16>, ptr %origin
113 %i1 = bitcast <4 x i16> %i0 to <8 x i8>
114 store <8 x i8> %i1, ptr %escape
115 %i2 = freeze <8 x i8> %i1
116 %i3 = bitcast <8 x i8> %i2 to i64
117 store i64 %i3, ptr %dst
121 define void @freeze_bitcast_to_wider_elt(ptr %origin, ptr %dst) nounwind {
122 ; X86-LABEL: freeze_bitcast_to_wider_elt:
124 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
125 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
126 ; X86-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
127 ; X86-NEXT: vmovsd %xmm0, (%eax)
130 ; X64-LABEL: freeze_bitcast_to_wider_elt:
132 ; X64-NEXT: movq (%rdi), %rax
133 ; X64-NEXT: movq %rax, (%rsi)
135 %i0 = load <8 x i8>, ptr %origin
136 %i1 = bitcast <8 x i8> %i0 to <4 x i16>
137 %i2 = freeze <4 x i16> %i1
138 %i3 = bitcast <4 x i16> %i2 to i64
139 store i64 %i3, ptr %dst
142 define void @freeze_bitcast_to_wider_elt_escape(ptr %origin, ptr %escape, ptr %dst) nounwind {
143 ; X86-LABEL: freeze_bitcast_to_wider_elt_escape:
145 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
146 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
147 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
148 ; X86-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
149 ; X86-NEXT: vmovsd %xmm0, (%ecx)
150 ; X86-NEXT: vmovsd %xmm0, (%eax)
153 ; X64-LABEL: freeze_bitcast_to_wider_elt_escape:
155 ; X64-NEXT: movq (%rdi), %rax
156 ; X64-NEXT: movq %rax, (%rsi)
157 ; X64-NEXT: movq %rax, (%rdx)
159 %i0 = load <8 x i8>, ptr %origin
160 %i1 = bitcast <8 x i8> %i0 to <4 x i16>
161 store <4 x i16> %i1, ptr %escape
162 %i2 = freeze <4 x i16> %i1
163 %i3 = bitcast <4 x i16> %i2 to i64
164 store i64 %i3, ptr %dst
168 define void @freeze_extractelement(ptr %origin0, ptr %origin1, ptr %dst) nounwind {
169 ; X86-LABEL: freeze_extractelement:
171 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
172 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
173 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
174 ; X86-NEXT: vmovdqa (%edx), %xmm0
175 ; X86-NEXT: vpand (%ecx), %xmm0, %xmm0
176 ; X86-NEXT: vpextrb $6, %xmm0, %ecx
177 ; X86-NEXT: movb %cl, (%eax)
180 ; X64-LABEL: freeze_extractelement:
182 ; X64-NEXT: vmovdqa (%rdi), %xmm0
183 ; X64-NEXT: vpand (%rsi), %xmm0, %xmm0
184 ; X64-NEXT: vpextrb $6, %xmm0, %eax
185 ; X64-NEXT: movb %al, (%rdx)
187 %i0 = load <16 x i8>, ptr %origin0
188 %i1 = load <16 x i8>, ptr %origin1
189 %i2 = and <16 x i8> %i0, %i1
190 %i3 = freeze <16 x i8> %i2
191 %i4 = extractelement <16 x i8> %i3, i64 6
192 store i8 %i4, ptr %dst
195 define void @freeze_extractelement_escape(ptr %origin0, ptr %origin1, ptr %dst, ptr %escape) nounwind {
196 ; X86-LABEL: freeze_extractelement_escape:
198 ; X86-NEXT: pushl %esi
199 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
200 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
201 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
202 ; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
203 ; X86-NEXT: vmovdqa (%esi), %xmm0
204 ; X86-NEXT: vpand (%edx), %xmm0, %xmm0
205 ; X86-NEXT: vmovdqa %xmm0, (%ecx)
206 ; X86-NEXT: vpextrb $6, %xmm0, (%eax)
207 ; X86-NEXT: popl %esi
210 ; X64-LABEL: freeze_extractelement_escape:
212 ; X64-NEXT: vmovdqa (%rdi), %xmm0
213 ; X64-NEXT: vpand (%rsi), %xmm0, %xmm0
214 ; X64-NEXT: vmovdqa %xmm0, (%rcx)
215 ; X64-NEXT: vpextrb $6, %xmm0, (%rdx)
217 %i0 = load <16 x i8>, ptr %origin0
218 %i1 = load <16 x i8>, ptr %origin1
219 %i2 = and <16 x i8> %i0, %i1
220 %i3 = freeze <16 x i8> %i2
221 store <16 x i8> %i3, ptr %escape
222 %i4 = extractelement <16 x i8> %i3, i64 6
223 store i8 %i4, ptr %dst
227 ; It would be a miscompilation to pull freeze out of extractelement here.
228 define void @freeze_extractelement_extra_use(ptr %origin0, ptr %origin1, i64 %idx0, i64 %idx1, ptr %dst, ptr %escape) nounwind {
229 ; X86-LABEL: freeze_extractelement_extra_use:
231 ; X86-NEXT: pushl %ebp
232 ; X86-NEXT: movl %esp, %ebp
233 ; X86-NEXT: pushl %edi
234 ; X86-NEXT: pushl %esi
235 ; X86-NEXT: andl $-16, %esp
236 ; X86-NEXT: subl $16, %esp
237 ; X86-NEXT: movl 24(%ebp), %eax
238 ; X86-NEXT: andl $15, %eax
239 ; X86-NEXT: movl 16(%ebp), %ecx
240 ; X86-NEXT: andl $15, %ecx
241 ; X86-NEXT: movl 32(%ebp), %edx
242 ; X86-NEXT: movl 12(%ebp), %esi
243 ; X86-NEXT: movl 8(%ebp), %edi
244 ; X86-NEXT: vmovaps (%edi), %xmm0
245 ; X86-NEXT: vandps (%esi), %xmm0, %xmm0
246 ; X86-NEXT: vmovaps %xmm0, (%esp)
247 ; X86-NEXT: movzbl (%esp,%ecx), %ecx
248 ; X86-NEXT: cmpb (%esp,%eax), %cl
249 ; X86-NEXT: sete (%edx)
250 ; X86-NEXT: leal -8(%ebp), %esp
251 ; X86-NEXT: popl %esi
252 ; X86-NEXT: popl %edi
253 ; X86-NEXT: popl %ebp
256 ; X64-LABEL: freeze_extractelement_extra_use:
258 ; X64-NEXT: andl $15, %ecx
259 ; X64-NEXT: andl $15, %edx
260 ; X64-NEXT: vmovaps (%rdi), %xmm0
261 ; X64-NEXT: vandps (%rsi), %xmm0, %xmm0
262 ; X64-NEXT: vmovaps %xmm0, -{{[0-9]+}}(%rsp)
263 ; X64-NEXT: movzbl -24(%rsp,%rdx), %eax
264 ; X64-NEXT: cmpb -24(%rsp,%rcx), %al
265 ; X64-NEXT: sete (%r8)
267 %i0 = load <16 x i8>, ptr %origin0
268 %i1 = load <16 x i8>, ptr %origin1
269 %i2 = and <16 x i8> %i0, %i1
270 %i3 = freeze <16 x i8> %i2
271 %i4 = extractelement <16 x i8> %i3, i64 %idx0
272 %i5 = extractelement <16 x i8> %i3, i64 %idx1
273 %i6 = icmp eq i8 %i4, %i5
274 store i1 %i6, ptr %dst
278 define void @freeze_buildvector_single_maybe_poison_operand(ptr %origin, ptr %dst) nounwind {
279 ; X86-LABEL: freeze_buildvector_single_maybe_poison_operand:
281 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
282 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
283 ; X86-NEXT: vbroadcastss {{.*#+}} xmm0 = [42,42,42,42]
284 ; X86-NEXT: vpinsrd $0, (%ecx), %xmm0, %xmm0
285 ; X86-NEXT: vpand {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0, %xmm0
286 ; X86-NEXT: vmovdqa %xmm0, (%eax)
289 ; X64-LABEL: freeze_buildvector_single_maybe_poison_operand:
291 ; X64-NEXT: vpbroadcastd {{.*#+}} xmm0 = [42,42,42,42]
292 ; X64-NEXT: vpinsrd $0, (%rdi), %xmm0, %xmm0
293 ; X64-NEXT: vpbroadcastd {{.*#+}} xmm1 = [7,7,7,7]
294 ; X64-NEXT: vpand %xmm1, %xmm0, %xmm0
295 ; X64-NEXT: vmovdqa %xmm0, (%rsi)
297 %i0.src = load i32, ptr %origin
298 %i0 = and i32 %i0.src, 15
299 %i1 = insertelement <4 x i32> poison, i32 %i0, i64 0
300 %i2 = insertelement <4 x i32> %i1, i32 42, i64 1
301 %i3 = insertelement <4 x i32> %i2, i32 42, i64 2
302 %i4 = insertelement <4 x i32> %i3, i32 42, i64 3
303 %i5 = freeze <4 x i32> %i4
304 %i6 = and <4 x i32> %i5, <i32 7, i32 7, i32 7, i32 7>
305 store <4 x i32> %i6, ptr %dst
309 define void @freeze_buildvector_single_repeated_maybe_poison_operand(ptr %origin, ptr %dst) nounwind {
310 ; X86-LABEL: freeze_buildvector_single_repeated_maybe_poison_operand:
312 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
313 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
314 ; X86-NEXT: movl (%ecx), %ecx
315 ; X86-NEXT: andl $15, %ecx
316 ; X86-NEXT: vbroadcastss {{.*#+}} xmm0 = [42,42,42,42]
317 ; X86-NEXT: vpinsrd $0, %ecx, %xmm0, %xmm0
318 ; X86-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[0,1,0,1]
319 ; X86-NEXT: vpand {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0, %xmm0
320 ; X86-NEXT: vmovdqa %xmm0, (%eax)
323 ; X64-LABEL: freeze_buildvector_single_repeated_maybe_poison_operand:
325 ; X64-NEXT: vpbroadcastd {{.*#+}} xmm0 = [42,42,42,42]
326 ; X64-NEXT: vpinsrd $0, (%rdi), %xmm0, %xmm0
327 ; X64-NEXT: vpbroadcastq %xmm0, %xmm0
328 ; X64-NEXT: vpbroadcastd {{.*#+}} xmm1 = [7,7,7,7]
329 ; X64-NEXT: vpand %xmm1, %xmm0, %xmm0
330 ; X64-NEXT: vmovdqa %xmm0, (%rsi)
332 %i0.src = load i32, ptr %origin
333 %i0 = and i32 %i0.src, 15
334 %i1 = insertelement <4 x i32> poison, i32 %i0, i64 0
335 %i2 = insertelement <4 x i32> %i1, i32 42, i64 1
336 %i3 = insertelement <4 x i32> %i2, i32 %i0, i64 2
337 %i4 = insertelement <4 x i32> %i3, i32 42, i64 3
338 %i5 = freeze <4 x i32> %i4
339 %i6 = and <4 x i32> %i5, <i32 7, i32 7, i32 7, i32 7>
340 store <4 x i32> %i6, ptr %dst
344 define void @freeze_two_frozen_buildvectors(ptr %origin0, ptr %origin1, ptr %dst0, ptr %dst1) nounwind {
345 ; X86-LABEL: freeze_two_frozen_buildvectors:
347 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
348 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
349 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
350 ; X86-NEXT: movl (%edx), %edx
351 ; X86-NEXT: andl $15, %edx
352 ; X86-NEXT: vpinsrd $1, %edx, %xmm0, %xmm0
353 ; X86-NEXT: vbroadcastss {{.*#+}} xmm1 = [7,7,7,7]
354 ; X86-NEXT: vpand %xmm1, %xmm0, %xmm0
355 ; X86-NEXT: vmovdqa %xmm0, (%ecx)
356 ; X86-NEXT: vmovd %edx, %xmm0
357 ; X86-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[0,1,0,1]
358 ; X86-NEXT: vpxor %xmm2, %xmm2, %xmm2
359 ; X86-NEXT: vpblendw {{.*#+}} xmm0 = xmm2[0,1,2,3],xmm0[4,5],xmm2[6,7]
360 ; X86-NEXT: vpand %xmm1, %xmm0, %xmm0
361 ; X86-NEXT: vmovdqa %xmm0, (%eax)
364 ; X64-LABEL: freeze_two_frozen_buildvectors:
366 ; X64-NEXT: movl (%rdi), %eax
367 ; X64-NEXT: andl $15, %eax
368 ; X64-NEXT: vpinsrd $1, %eax, %xmm0, %xmm0
369 ; X64-NEXT: vpbroadcastd {{.*#+}} xmm1 = [7,7,7,7]
370 ; X64-NEXT: vpand %xmm1, %xmm0, %xmm0
371 ; X64-NEXT: vmovdqa %xmm0, (%rdx)
372 ; X64-NEXT: vmovd %eax, %xmm0
373 ; X64-NEXT: vpbroadcastd %xmm0, %xmm0
374 ; X64-NEXT: vpxor %xmm2, %xmm2, %xmm2
375 ; X64-NEXT: vpblendd {{.*#+}} xmm0 = xmm2[0,1],xmm0[2],xmm2[3]
376 ; X64-NEXT: vpand %xmm1, %xmm0, %xmm0
377 ; X64-NEXT: vmovdqa %xmm0, (%rcx)
379 %i0.src = load i32, ptr %origin0
380 %i0 = and i32 %i0.src, 15
381 %i1.src = load i32, ptr %origin1
382 %i1 = and i32 %i0.src, 15
383 %i2 = insertelement <4 x i32> poison, i32 %i0, i64 1
384 %i3 = and <4 x i32> %i2, <i32 7, i32 7, i32 7, i32 7>
385 %i4 = freeze <4 x i32> %i3
386 store <4 x i32> %i4, ptr %dst0
387 %i5 = insertelement <4 x i32> poison, i32 %i1, i64 2
388 %i6 = and <4 x i32> %i5, <i32 7, i32 7, i32 7, i32 7>
389 %i7 = freeze <4 x i32> %i6
390 store <4 x i32> %i7, ptr %dst1
394 define void @freeze_two_buildvectors_only_one_frozen(ptr %origin0, ptr %origin1, ptr %dst0, ptr %dst1) nounwind {
395 ; X86-LABEL: freeze_two_buildvectors_only_one_frozen:
397 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
398 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
399 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
400 ; X86-NEXT: movl (%edx), %edx
401 ; X86-NEXT: andl $15, %edx
402 ; X86-NEXT: vpxor %xmm0, %xmm0, %xmm0
403 ; X86-NEXT: vmovd %edx, %xmm1
404 ; X86-NEXT: vpshufd {{.*#+}} xmm2 = xmm1[0,0,1,1]
405 ; X86-NEXT: vpblendw {{.*#+}} xmm0 = xmm0[0,1],xmm2[2,3],xmm0[4,5,6,7]
406 ; X86-NEXT: vbroadcastss {{.*#+}} xmm2 = [7,7,7,7]
407 ; X86-NEXT: vpand %xmm2, %xmm0, %xmm0
408 ; X86-NEXT: vmovdqa %xmm0, (%ecx)
409 ; X86-NEXT: vpshufd {{.*#+}} xmm0 = xmm1[0,1,0,1]
410 ; X86-NEXT: vpand %xmm2, %xmm0, %xmm0
411 ; X86-NEXT: vmovdqa %xmm0, (%eax)
414 ; X64-LABEL: freeze_two_buildvectors_only_one_frozen:
416 ; X64-NEXT: movl (%rdi), %eax
417 ; X64-NEXT: andl $15, %eax
418 ; X64-NEXT: vpxor %xmm0, %xmm0, %xmm0
419 ; X64-NEXT: vmovd %eax, %xmm1
420 ; X64-NEXT: vpbroadcastd %xmm1, %xmm1
421 ; X64-NEXT: vpblendd {{.*#+}} xmm0 = xmm0[0],xmm1[1],xmm0[2,3]
422 ; X64-NEXT: vpbroadcastd {{.*#+}} xmm2 = [7,7,7,7]
423 ; X64-NEXT: vpand %xmm2, %xmm0, %xmm0
424 ; X64-NEXT: vmovdqa %xmm0, (%rdx)
425 ; X64-NEXT: vpand %xmm2, %xmm1, %xmm0
426 ; X64-NEXT: vmovdqa %xmm0, (%rcx)
428 %i0.src = load i32, ptr %origin0
429 %i0 = and i32 %i0.src, 15
430 %i1.src = load i32, ptr %origin1
431 %i1 = and i32 %i0.src, 15
432 %i2 = insertelement <4 x i32> poison, i32 %i0, i64 1
433 %i3 = and <4 x i32> %i2, <i32 7, i32 7, i32 7, i32 7>
434 %i4 = freeze <4 x i32> %i3
435 store <4 x i32> %i4, ptr %dst0
436 %i5 = insertelement <4 x i32> poison, i32 %i1, i64 2
437 %i6 = and <4 x i32> %i5, <i32 7, i32 7, i32 7, i32 7>
438 store <4 x i32> %i6, ptr %dst1
442 define void @freeze_two_buildvectors_one_undef_elt(ptr %origin0, ptr %origin1, ptr %dst0, ptr %dst1) nounwind {
443 ; X86-LABEL: freeze_two_buildvectors_one_undef_elt:
445 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
446 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
447 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
448 ; X86-NEXT: movl (%edx), %edx
449 ; X86-NEXT: andl $15, %edx
450 ; X86-NEXT: vmovddup {{.*#+}} xmm0 = [7,0,7,0]
451 ; X86-NEXT: # xmm0 = mem[0,0]
452 ; X86-NEXT: vmovd %edx, %xmm1
453 ; X86-NEXT: vpand %xmm0, %xmm1, %xmm2
454 ; X86-NEXT: vmovdqa %xmm2, (%ecx)
455 ; X86-NEXT: vpslldq {{.*#+}} xmm1 = zero,zero,zero,zero,zero,zero,zero,zero,xmm1[0,1,2,3,4,5,6,7]
456 ; X86-NEXT: vpand %xmm0, %xmm1, %xmm0
457 ; X86-NEXT: vmovdqa %xmm0, (%eax)
460 ; X64-LABEL: freeze_two_buildvectors_one_undef_elt:
462 ; X64-NEXT: movq (%rdi), %rax
463 ; X64-NEXT: vmovd %eax, %xmm0
464 ; X64-NEXT: vpbroadcastd %xmm0, %xmm0
465 ; X64-NEXT: vpand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
466 ; X64-NEXT: vmovdqa %xmm0, (%rdx)
467 ; X64-NEXT: vmovdqa %xmm0, (%rcx)
469 %i0.src = load i64, ptr %origin0
470 %i0 = and i64 %i0.src, 15
471 %i1.src = load i64, ptr %origin1
472 %i1 = and i64 %i0.src, 15
473 %i2 = insertelement <2 x i64> poison, i64 %i0, i64 0
474 %i3 = and <2 x i64> %i2, <i64 7, i64 7>
475 %i4 = freeze <2 x i64> %i3
476 store <2 x i64> %i4, ptr %dst0
477 %i5 = insertelement <2 x i64> poison, i64 %i1, i64 1
478 %i6 = and <2 x i64> %i5, <i64 7, i64 7>
479 store <2 x i64> %i6, ptr %dst1
483 define void @freeze_buildvector(ptr %origin0, ptr %origin1, ptr %origin2, ptr %origin3, ptr %dst) nounwind {
484 ; X86-LABEL: freeze_buildvector:
486 ; X86-NEXT: pushl %edi
487 ; X86-NEXT: pushl %esi
488 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
489 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
490 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
491 ; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
492 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edi
493 ; X86-NEXT: vmovd {{.*#+}} xmm0 = mem[0],zero,zero,zero
494 ; X86-NEXT: vpinsrd $1, (%esi), %xmm0, %xmm0
495 ; X86-NEXT: vpinsrd $2, (%edx), %xmm0, %xmm0
496 ; X86-NEXT: vpinsrd $3, (%ecx), %xmm0, %xmm0
497 ; X86-NEXT: vpand {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0, %xmm0
498 ; X86-NEXT: vmovdqa %xmm0, (%eax)
499 ; X86-NEXT: popl %esi
500 ; X86-NEXT: popl %edi
503 ; X64-LABEL: freeze_buildvector:
505 ; X64-NEXT: vmovd {{.*#+}} xmm0 = mem[0],zero,zero,zero
506 ; X64-NEXT: vpinsrd $1, (%rsi), %xmm0, %xmm0
507 ; X64-NEXT: vpinsrd $2, (%rdx), %xmm0, %xmm0
508 ; X64-NEXT: vpinsrd $3, (%rcx), %xmm0, %xmm0
509 ; X64-NEXT: vpbroadcastd {{.*#+}} xmm1 = [7,7,7,7]
510 ; X64-NEXT: vpand %xmm1, %xmm0, %xmm0
511 ; X64-NEXT: vmovdqa %xmm0, (%r8)
513 %i0.src = load i32, ptr %origin0
514 %i1.src = load i32, ptr %origin1
515 %i2.src = load i32, ptr %origin2
516 %i3.src = load i32, ptr %origin3
517 %i0 = and i32 %i0.src, 15
518 %i1 = and i32 %i1.src, 15
519 %i2 = and i32 %i2.src, 15
520 %i3 = and i32 %i3.src, 15
521 %i4 = insertelement <4 x i32> poison, i32 %i0, i64 0
522 %i5 = insertelement <4 x i32> %i4, i32 %i1, i64 1
523 %i6 = insertelement <4 x i32> %i5, i32 %i2, i64 2
524 %i7 = insertelement <4 x i32> %i6, i32 %i3, i64 3
525 %i8 = freeze <4 x i32> %i7
526 %i9 = and <4 x i32> %i8, <i32 7, i32 7, i32 7, i32 7>
527 store <4 x i32> %i9, ptr %dst
531 define void @freeze_buildvector_one_undef_elt(ptr %origin0, ptr %origin1, ptr %origin2, ptr %origin3, ptr %dst) nounwind {
532 ; X86-LABEL: freeze_buildvector_one_undef_elt:
534 ; X86-NEXT: pushl %esi
535 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
536 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
537 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
538 ; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
539 ; X86-NEXT: vmovd {{.*#+}} xmm0 = mem[0],zero,zero,zero
540 ; X86-NEXT: vpinsrd $1, (%edx), %xmm0, %xmm0
541 ; X86-NEXT: vpinsrd $2, %eax, %xmm0, %xmm0
542 ; X86-NEXT: vpinsrd $3, (%ecx), %xmm0, %xmm0
543 ; X86-NEXT: vpand {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0, %xmm0
544 ; X86-NEXT: vmovdqa %xmm0, (%eax)
545 ; X86-NEXT: popl %esi
548 ; X64-LABEL: freeze_buildvector_one_undef_elt:
550 ; X64-NEXT: vmovd {{.*#+}} xmm0 = mem[0],zero,zero,zero
551 ; X64-NEXT: vpinsrd $1, (%rsi), %xmm0, %xmm0
552 ; X64-NEXT: vpinsrd $2, %eax, %xmm0, %xmm0
553 ; X64-NEXT: vpinsrd $3, (%rcx), %xmm0, %xmm0
554 ; X64-NEXT: vpbroadcastd {{.*#+}} xmm1 = [7,7,7,7]
555 ; X64-NEXT: vpand %xmm1, %xmm0, %xmm0
556 ; X64-NEXT: vmovdqa %xmm0, (%r8)
558 %i0.src = load i32, ptr %origin0
559 %i1.src = load i32, ptr %origin1
560 %i3.src = load i32, ptr %origin3
561 %i0 = and i32 %i0.src, 15
562 %i1 = and i32 %i1.src, 15
563 %i3 = and i32 %i3.src, 15
564 %i4 = insertelement <4 x i32> poison, i32 %i0, i64 0
565 %i5 = insertelement <4 x i32> %i4, i32 %i1, i64 1
566 %i7 = insertelement <4 x i32> %i5, i32 %i3, i64 3
567 %i8 = freeze <4 x i32> %i7
568 %i9 = and <4 x i32> %i8, <i32 7, i32 7, i32 7, i32 7>
569 store <4 x i32> %i9, ptr %dst
573 define void @freeze_buildvector_extrause(ptr %origin0, ptr %origin1, ptr %origin2, ptr %origin3, ptr %dst, ptr %escape) nounwind {
574 ; X86-LABEL: freeze_buildvector_extrause:
576 ; X86-NEXT: pushl %ebx
577 ; X86-NEXT: pushl %edi
578 ; X86-NEXT: pushl %esi
579 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
580 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
581 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
582 ; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
583 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edi
584 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ebx
585 ; X86-NEXT: vmovd {{.*#+}} xmm0 = mem[0],zero,zero,zero
586 ; X86-NEXT: vpinsrd $1, (%edi), %xmm0, %xmm0
587 ; X86-NEXT: vpinsrd $2, (%esi), %xmm0, %xmm0
588 ; X86-NEXT: vpinsrd $3, (%edx), %xmm0, %xmm0
589 ; X86-NEXT: vpand {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0, %xmm0
590 ; X86-NEXT: vmovdqa %xmm0, (%ecx)
591 ; X86-NEXT: vpand {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0, %xmm0
592 ; X86-NEXT: vmovdqa %xmm0, (%eax)
593 ; X86-NEXT: popl %esi
594 ; X86-NEXT: popl %edi
595 ; X86-NEXT: popl %ebx
598 ; X64-LABEL: freeze_buildvector_extrause:
600 ; X64-NEXT: vmovd {{.*#+}} xmm0 = mem[0],zero,zero,zero
601 ; X64-NEXT: vpinsrd $1, (%rsi), %xmm0, %xmm0
602 ; X64-NEXT: vpinsrd $2, (%rdx), %xmm0, %xmm0
603 ; X64-NEXT: vpinsrd $3, (%rcx), %xmm0, %xmm0
604 ; X64-NEXT: vpbroadcastd {{.*#+}} xmm1 = [15,15,15,15]
605 ; X64-NEXT: vpand %xmm1, %xmm0, %xmm0
606 ; X64-NEXT: vmovdqa %xmm0, (%r9)
607 ; X64-NEXT: vpbroadcastd {{.*#+}} xmm1 = [7,7,7,7]
608 ; X64-NEXT: vpand %xmm1, %xmm0, %xmm0
609 ; X64-NEXT: vmovdqa %xmm0, (%r8)
611 %i0.src = load i32, ptr %origin0
612 %i1.src = load i32, ptr %origin1
613 %i2.src = load i32, ptr %origin2
614 %i3.src = load i32, ptr %origin3
615 %i0 = and i32 %i0.src, 15
616 %i1 = and i32 %i1.src, 15
617 %i2 = and i32 %i2.src, 15
618 %i3 = and i32 %i3.src, 15
619 %i4 = insertelement <4 x i32> poison, i32 %i0, i64 0
620 %i5 = insertelement <4 x i32> %i4, i32 %i1, i64 1
621 %i6 = insertelement <4 x i32> %i5, i32 %i2, i64 2
622 %i7 = insertelement <4 x i32> %i6, i32 %i3, i64 3
623 store <4 x i32> %i7, ptr %escape
624 %i8 = freeze <4 x i32> %i7
625 %i9 = and <4 x i32> %i8, <i32 7, i32 7, i32 7, i32 7>
626 store <4 x i32> %i9, ptr %dst
630 define void @pr59677(i32 %x, ptr %out) nounwind {
631 ; X86-LABEL: pr59677:
633 ; X86-NEXT: pushl %esi
634 ; X86-NEXT: pushl %eax
635 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
636 ; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
637 ; X86-NEXT: vmovd %eax, %xmm0
638 ; X86-NEXT: orl $1, %eax
639 ; X86-NEXT: vmovd %eax, %xmm1
640 ; X86-NEXT: vpunpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
641 ; X86-NEXT: vmovq {{.*#+}} xmm0 = xmm0[0],zero
642 ; X86-NEXT: vpaddd %xmm0, %xmm0, %xmm0
643 ; X86-NEXT: vcvtdq2ps %xmm0, %xmm0
644 ; X86-NEXT: vmovss %xmm0, (%esp)
645 ; X86-NEXT: calll sinf
646 ; X86-NEXT: fstps (%esi)
647 ; X86-NEXT: addl $4, %esp
648 ; X86-NEXT: popl %esi
651 ; X64-LABEL: pr59677:
653 ; X64-NEXT: pushq %rbx
654 ; X64-NEXT: movq %rsi, %rbx
655 ; X64-NEXT: vmovd %edi, %xmm0
656 ; X64-NEXT: orl $1, %edi
657 ; X64-NEXT: vmovd %edi, %xmm1
658 ; X64-NEXT: vpunpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
659 ; X64-NEXT: vmovq {{.*#+}} xmm0 = xmm0[0],zero
660 ; X64-NEXT: vpaddd %xmm0, %xmm0, %xmm0
661 ; X64-NEXT: vcvtdq2ps %xmm0, %xmm0
662 ; X64-NEXT: callq sinf@PLT
663 ; X64-NEXT: vmovss %xmm0, (%rbx)
664 ; X64-NEXT: popq %rbx
667 %i1 = insertelement <4 x i32> zeroinitializer, i32 %x, i64 0
668 %i2 = insertelement <4 x i32> %i1, i32 %i0, i64 1
669 %i3 = shl <4 x i32> %i2, <i32 1, i32 1, i32 1, i32 1>
670 %i4 = sitofp <4 x i32> %i3 to <4 x float>
671 %i5 = tail call <4 x float> @llvm.sin.v4f32(<4 x float> %i4)
672 %i6 = extractelement <4 x float> %i5, i64 0
673 store float %i6, ptr %out, align 4
676 declare <4 x float> @llvm.sin.v4f32(<4 x float>)