1 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse4.1 | FileCheck %s
3 define void @foo(<3 x float> %in, <4 x i8>* nocapture %out) nounwind {
6 ; CHECK-NEXT: cvttps2dq %xmm0, %xmm0
7 ; CHECK-NEXT: movl $255, %eax
8 ; CHECK-NEXT: pinsrd $3, %eax, %xmm0
9 ; CHECK-NEXT: pshufb {{.*#+}} xmm0 = xmm0[0,4,8,12,u,u,u,u,u,u,u,u,u,u,u,u]
10 ; CHECK-NEXT: movd %xmm0, (%rdi)
12 %t0 = fptoui <3 x float> %in to <3 x i8>
13 %t1 = shufflevector <3 x i8> %t0, <3 x i8> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 undef>
14 %t2 = insertelement <4 x i8> %t1, i8 -1, i32 3
15 store <4 x i8> %t2, <4 x i8>* %out, align 4
19 ; Verify that the DAGCombiner doesn't wrongly fold a build_vector into a
20 ; blend with a zero vector if the build_vector contains negative zero.
22 ; TODO: the codegen for function 'test_negative_zero_1' is sub-optimal.
23 ; Ideally, we should generate a single shuffle blend operation.
25 define <4 x float> @test_negative_zero_1(<4 x float> %A) {
26 ; CHECK-LABEL: test_negative_zero_1:
27 ; CHECK: # BB#0: # %entry
28 ; CHECK-NEXT: movapd %xmm0, %xmm1
29 ; CHECK-NEXT: shufpd {{.*#+}} xmm1 = xmm1[1,0]
30 ; CHECK-NEXT: xorps %xmm2, %xmm2
31 ; CHECK-NEXT: blendps {{.*#+}} xmm2 = xmm1[0],xmm2[1,2,3]
32 ; CHECK-NEXT: movss {{.*#+}} xmm1 = mem[0],zero,zero,zero
33 ; CHECK-NEXT: unpcklps {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
34 ; CHECK-NEXT: unpcklpd {{.*#+}} xmm0 = xmm0[0],xmm2[0]
37 %0 = extractelement <4 x float> %A, i32 0
38 %1 = insertelement <4 x float> undef, float %0, i32 0
39 %2 = insertelement <4 x float> %1, float -0.0, i32 1
40 %3 = extractelement <4 x float> %A, i32 2
41 %4 = insertelement <4 x float> %2, float %3, i32 2
42 %5 = insertelement <4 x float> %4, float 0.0, i32 3
46 define <2 x double> @test_negative_zero_2(<2 x double> %A) {
47 ; CHECK-LABEL: test_negative_zero_2:
48 ; CHECK: # BB#0: # %entry
49 ; CHECK-NEXT: movhpd {{.*}}(%rip), %xmm0
52 %0 = extractelement <2 x double> %A, i32 0
53 %1 = insertelement <2 x double> undef, double %0, i32 0
54 %2 = insertelement <2 x double> %1, double -0.0, i32 1