1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -disable-peephole -mtriple=i686-unknown-unknown -mattr=avx | FileCheck %s --check-prefix=X86
3 ; RUN: llc < %s -disable-peephole -mtriple=x86_64-unknown-unknown -mattr=avx | FileCheck %s --check-prefix=X64
5 ; Insertion/shuffles of all-zero/all-bits/constants into v8i32->v8f32 sitofp conversion.
7 define <8 x float> @sitofp_insert_zero_v8i32(<8 x i32> %a0) {
8 ; X86-LABEL: sitofp_insert_zero_v8i32:
10 ; X86-NEXT: vxorps %xmm1, %xmm1, %xmm1
11 ; X86-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0],ymm0[1],ymm1[2],ymm0[3],ymm1[4,5],ymm0[6,7]
12 ; X86-NEXT: vcvtdq2ps %ymm0, %ymm0
15 ; X64-LABEL: sitofp_insert_zero_v8i32:
17 ; X64-NEXT: vxorps %xmm1, %xmm1, %xmm1
18 ; X64-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0],ymm0[1],ymm1[2],ymm0[3],ymm1[4,5],ymm0[6,7]
19 ; X64-NEXT: vcvtdq2ps %ymm0, %ymm0
21 %1 = insertelement <8 x i32> %a0, i32 0, i32 0
22 %2 = insertelement <8 x i32> %1, i32 0, i32 2
23 %3 = insertelement <8 x i32> %2, i32 0, i32 4
24 %4 = insertelement <8 x i32> %3, i32 0, i32 5
25 %5 = sitofp <8 x i32> %4 to <8 x float>
29 define <8 x float> @sitofp_shuffle_zero_v8i32(<8 x i32> %a0) {
30 ; X86-LABEL: sitofp_shuffle_zero_v8i32:
32 ; X86-NEXT: vxorps %xmm1, %xmm1, %xmm1
33 ; X86-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0],ymm0[1],ymm1[2],ymm0[3],ymm1[4],ymm0[5],ymm1[6],ymm0[7]
34 ; X86-NEXT: vcvtdq2ps %ymm0, %ymm0
37 ; X64-LABEL: sitofp_shuffle_zero_v8i32:
39 ; X64-NEXT: vxorps %xmm1, %xmm1, %xmm1
40 ; X64-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0],ymm0[1],ymm1[2],ymm0[3],ymm1[4],ymm0[5],ymm1[6],ymm0[7]
41 ; X64-NEXT: vcvtdq2ps %ymm0, %ymm0
43 %1 = shufflevector <8 x i32> %a0, <8 x i32> <i32 0, i32 undef, i32 0, i32 undef, i32 0, i32 undef, i32 0, i32 undef>, <8 x i32> <i32 8, i32 1, i32 10, i32 3, i32 12, i32 5, i32 14, i32 7>
44 %2 = sitofp <8 x i32> %1 to <8 x float>
48 define <8 x float> @sitofp_insert_allbits_v8i32(<8 x i32> %a0) {
49 ; X86-LABEL: sitofp_insert_allbits_v8i32:
51 ; X86-NEXT: vxorps %xmm1, %xmm1, %xmm1
52 ; X86-NEXT: vcmptrueps %ymm1, %ymm1, %ymm1
53 ; X86-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0],ymm0[1],ymm1[2],ymm0[3],ymm1[4,5],ymm0[6,7]
54 ; X86-NEXT: vcvtdq2ps %ymm0, %ymm0
57 ; X64-LABEL: sitofp_insert_allbits_v8i32:
59 ; X64-NEXT: vxorps %xmm1, %xmm1, %xmm1
60 ; X64-NEXT: vcmptrueps %ymm1, %ymm1, %ymm1
61 ; X64-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0],ymm0[1],ymm1[2],ymm0[3],ymm1[4,5],ymm0[6,7]
62 ; X64-NEXT: vcvtdq2ps %ymm0, %ymm0
64 %1 = insertelement <8 x i32> %a0, i32 -1, i32 0
65 %2 = insertelement <8 x i32> %1, i32 -1, i32 2
66 %3 = insertelement <8 x i32> %2, i32 -1, i32 4
67 %4 = insertelement <8 x i32> %3, i32 -1, i32 5
68 %5 = sitofp <8 x i32> %4 to <8 x float>
72 define <8 x float> @sitofp_shuffle_allbits_v8i32(<8 x i32> %a0) {
73 ; X86-LABEL: sitofp_shuffle_allbits_v8i32:
75 ; X86-NEXT: vxorps %xmm1, %xmm1, %xmm1
76 ; X86-NEXT: vcmptrueps %ymm1, %ymm1, %ymm1
77 ; X86-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0],ymm0[1],ymm1[2],ymm0[3],ymm1[4],ymm0[5],ymm1[6],ymm0[7]
78 ; X86-NEXT: vcvtdq2ps %ymm0, %ymm0
81 ; X64-LABEL: sitofp_shuffle_allbits_v8i32:
83 ; X64-NEXT: vxorps %xmm1, %xmm1, %xmm1
84 ; X64-NEXT: vcmptrueps %ymm1, %ymm1, %ymm1
85 ; X64-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0],ymm0[1],ymm1[2],ymm0[3],ymm1[4],ymm0[5],ymm1[6],ymm0[7]
86 ; X64-NEXT: vcvtdq2ps %ymm0, %ymm0
88 %1 = shufflevector <8 x i32> %a0, <8 x i32> <i32 -1, i32 undef, i32 -1, i32 undef, i32 -1, i32 undef, i32 -1, i32 undef>, <8 x i32> <i32 8, i32 1, i32 10, i32 3, i32 12, i32 5, i32 14, i32 7>
89 %2 = sitofp <8 x i32> %1 to <8 x float>
93 define <8 x float> @sitofp_insert_constants_v8i32(<8 x i32> %a0) {
94 ; X86-LABEL: sitofp_insert_constants_v8i32:
96 ; X86-NEXT: vpxor %xmm1, %xmm1, %xmm1
97 ; X86-NEXT: vpblendw {{.*#+}} xmm1 = xmm1[0,1],xmm0[2,3,4,5,6,7]
98 ; X86-NEXT: vpcmpeqd %xmm2, %xmm2, %xmm2
99 ; X86-NEXT: vpblendw {{.*#+}} xmm1 = xmm1[0,1,2,3],xmm2[4,5],xmm1[6,7]
100 ; X86-NEXT: vextractf128 $1, %ymm0, %xmm0
101 ; X86-NEXT: movl $2, %eax
102 ; X86-NEXT: vpinsrd $0, %eax, %xmm0, %xmm0
103 ; X86-NEXT: movl $-3, %eax
104 ; X86-NEXT: vpinsrd $1, %eax, %xmm0, %xmm0
105 ; X86-NEXT: vinsertf128 $1, %xmm0, %ymm1, %ymm0
106 ; X86-NEXT: vcvtdq2ps %ymm0, %ymm0
109 ; X64-LABEL: sitofp_insert_constants_v8i32:
111 ; X64-NEXT: vpxor %xmm1, %xmm1, %xmm1
112 ; X64-NEXT: vpblendw {{.*#+}} xmm1 = xmm1[0,1],xmm0[2,3,4,5,6,7]
113 ; X64-NEXT: vpcmpeqd %xmm2, %xmm2, %xmm2
114 ; X64-NEXT: vpblendw {{.*#+}} xmm1 = xmm1[0,1,2,3],xmm2[4,5],xmm1[6,7]
115 ; X64-NEXT: vextractf128 $1, %ymm0, %xmm0
116 ; X64-NEXT: movl $2, %eax
117 ; X64-NEXT: vpinsrd $0, %eax, %xmm0, %xmm0
118 ; X64-NEXT: movl $-3, %eax
119 ; X64-NEXT: vpinsrd $1, %eax, %xmm0, %xmm0
120 ; X64-NEXT: vinsertf128 $1, %xmm0, %ymm1, %ymm0
121 ; X64-NEXT: vcvtdq2ps %ymm0, %ymm0
123 %1 = insertelement <8 x i32> %a0, i32 0, i32 0
124 %2 = insertelement <8 x i32> %1, i32 -1, i32 2
125 %3 = insertelement <8 x i32> %2, i32 2, i32 4
126 %4 = insertelement <8 x i32> %3, i32 -3, i32 5
127 %5 = sitofp <8 x i32> %4 to <8 x float>
131 define <8 x float> @sitofp_shuffle_constants_v8i32(<8 x i32> %a0) {
132 ; X86-LABEL: sitofp_shuffle_constants_v8i32:
134 ; X86-NEXT: vblendps {{.*#+}} ymm0 = mem[0],ymm0[1],mem[2],ymm0[3],mem[4],ymm0[5],mem[6],ymm0[7]
135 ; X86-NEXT: vcvtdq2ps %ymm0, %ymm0
138 ; X64-LABEL: sitofp_shuffle_constants_v8i32:
140 ; X64-NEXT: vblendps {{.*#+}} ymm0 = mem[0],ymm0[1],mem[2],ymm0[3],mem[4],ymm0[5],mem[6],ymm0[7]
141 ; X64-NEXT: vcvtdq2ps %ymm0, %ymm0
143 %1 = shufflevector <8 x i32> %a0, <8 x i32> <i32 0, i32 undef, i32 -1, i32 undef, i32 2, i32 undef, i32 -3, i32 undef>, <8 x i32> <i32 8, i32 1, i32 10, i32 3, i32 12, i32 5, i32 14, i32 7>
144 %2 = sitofp <8 x i32> %1 to <8 x float>