1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt < %s -mtriple=x86_64-unknown -basic-aa -slp-vectorizer -instcombine -S | FileCheck %s --check-prefix=CHECK --check-prefix=SSE
3; RUN: opt < %s -mtriple=x86_64-unknown -mcpu=slm -basic-aa -slp-vectorizer -instcombine -S | FileCheck %s --check-prefix=CHECK --check-prefix=SLM
4; RUN: opt < %s -mtriple=x86_64-unknown -mcpu=corei7-avx -basic-aa -slp-vectorizer -instcombine -S | FileCheck %s --check-prefix=CHECK --check-prefix=AVX
5; RUN: opt < %s -mtriple=x86_64-unknown -mcpu=core-avx2 -basic-aa -slp-vectorizer -instcombine -S | FileCheck %s --check-prefix=CHECK --check-prefix=AVX
6; RUN: opt < %s -mtriple=x86_64-unknown -mcpu=knl -basic-aa -slp-vectorizer -instcombine -S | FileCheck %s --check-prefix=CHECK --check-prefix=AVX512
7; RUN: opt < %s -mtriple=x86_64-unknown -mcpu=skx -basic-aa -slp-vectorizer -instcombine -S | FileCheck %s --check-prefix=CHECK --check-prefix=AVX512
8
9define <8 x float> @sitofp_uitofp(<8 x i32> %a) {
10; SSE-LABEL: @sitofp_uitofp(
11; SSE-NEXT:    [[A0:%.*]] = extractelement <8 x i32> [[A:%.*]], i32 0
12; SSE-NEXT:    [[A1:%.*]] = extractelement <8 x i32> [[A]], i32 1
13; SSE-NEXT:    [[A2:%.*]] = extractelement <8 x i32> [[A]], i32 2
14; SSE-NEXT:    [[A3:%.*]] = extractelement <8 x i32> [[A]], i32 3
15; SSE-NEXT:    [[A4:%.*]] = extractelement <8 x i32> [[A]], i32 4
16; SSE-NEXT:    [[A5:%.*]] = extractelement <8 x i32> [[A]], i32 5
17; SSE-NEXT:    [[A6:%.*]] = extractelement <8 x i32> [[A]], i32 6
18; SSE-NEXT:    [[A7:%.*]] = extractelement <8 x i32> [[A]], i32 7
19; SSE-NEXT:    [[AB0:%.*]] = sitofp i32 [[A0]] to float
20; SSE-NEXT:    [[AB1:%.*]] = sitofp i32 [[A1]] to float
21; SSE-NEXT:    [[AB2:%.*]] = sitofp i32 [[A2]] to float
22; SSE-NEXT:    [[AB3:%.*]] = sitofp i32 [[A3]] to float
23; SSE-NEXT:    [[AB4:%.*]] = uitofp i32 [[A4]] to float
24; SSE-NEXT:    [[AB5:%.*]] = uitofp i32 [[A5]] to float
25; SSE-NEXT:    [[AB6:%.*]] = uitofp i32 [[A6]] to float
26; SSE-NEXT:    [[AB7:%.*]] = uitofp i32 [[A7]] to float
27; SSE-NEXT:    [[R0:%.*]] = insertelement <8 x float> undef, float [[AB0]], i32 0
28; SSE-NEXT:    [[R1:%.*]] = insertelement <8 x float> [[R0]], float [[AB1]], i32 1
29; SSE-NEXT:    [[R2:%.*]] = insertelement <8 x float> [[R1]], float [[AB2]], i32 2
30; SSE-NEXT:    [[R3:%.*]] = insertelement <8 x float> [[R2]], float [[AB3]], i32 3
31; SSE-NEXT:    [[R4:%.*]] = insertelement <8 x float> [[R3]], float [[AB4]], i32 4
32; SSE-NEXT:    [[R5:%.*]] = insertelement <8 x float> [[R4]], float [[AB5]], i32 5
33; SSE-NEXT:    [[R6:%.*]] = insertelement <8 x float> [[R5]], float [[AB6]], i32 6
34; SSE-NEXT:    [[R7:%.*]] = insertelement <8 x float> [[R6]], float [[AB7]], i32 7
35; SSE-NEXT:    ret <8 x float> [[R7]]
36;
37; SLM-LABEL: @sitofp_uitofp(
38; SLM-NEXT:    [[TMP1:%.*]] = sitofp <8 x i32> [[A:%.*]] to <8 x float>
39; SLM-NEXT:    [[TMP2:%.*]] = uitofp <8 x i32> [[A]] to <8 x float>
40; SLM-NEXT:    [[R7:%.*]] = shufflevector <8 x float> [[TMP1]], <8 x float> [[TMP2]], <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 12, i32 13, i32 14, i32 15>
41; SLM-NEXT:    ret <8 x float> [[R7]]
42;
43; AVX-LABEL: @sitofp_uitofp(
44; AVX-NEXT:    [[TMP1:%.*]] = sitofp <8 x i32> [[A:%.*]] to <8 x float>
45; AVX-NEXT:    [[TMP2:%.*]] = uitofp <8 x i32> [[A]] to <8 x float>
46; AVX-NEXT:    [[R7:%.*]] = shufflevector <8 x float> [[TMP1]], <8 x float> [[TMP2]], <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 12, i32 13, i32 14, i32 15>
47; AVX-NEXT:    ret <8 x float> [[R7]]
48;
49; AVX512-LABEL: @sitofp_uitofp(
50; AVX512-NEXT:    [[TMP1:%.*]] = sitofp <8 x i32> [[A:%.*]] to <8 x float>
51; AVX512-NEXT:    [[TMP2:%.*]] = uitofp <8 x i32> [[A]] to <8 x float>
52; AVX512-NEXT:    [[R7:%.*]] = shufflevector <8 x float> [[TMP1]], <8 x float> [[TMP2]], <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 12, i32 13, i32 14, i32 15>
53; AVX512-NEXT:    ret <8 x float> [[R7]]
54;
55  %a0 = extractelement <8 x i32> %a, i32 0
56  %a1 = extractelement <8 x i32> %a, i32 1
57  %a2 = extractelement <8 x i32> %a, i32 2
58  %a3 = extractelement <8 x i32> %a, i32 3
59  %a4 = extractelement <8 x i32> %a, i32 4
60  %a5 = extractelement <8 x i32> %a, i32 5
61  %a6 = extractelement <8 x i32> %a, i32 6
62  %a7 = extractelement <8 x i32> %a, i32 7
63  %ab0 = sitofp i32 %a0 to float
64  %ab1 = sitofp i32 %a1 to float
65  %ab2 = sitofp i32 %a2 to float
66  %ab3 = sitofp i32 %a3 to float
67  %ab4 = uitofp i32 %a4 to float
68  %ab5 = uitofp i32 %a5 to float
69  %ab6 = uitofp i32 %a6 to float
70  %ab7 = uitofp i32 %a7 to float
71  %r0 = insertelement <8 x float> undef, float %ab0, i32 0
72  %r1 = insertelement <8 x float>   %r0, float %ab1, i32 1
73  %r2 = insertelement <8 x float>   %r1, float %ab2, i32 2
74  %r3 = insertelement <8 x float>   %r2, float %ab3, i32 3
75  %r4 = insertelement <8 x float>   %r3, float %ab4, i32 4
76  %r5 = insertelement <8 x float>   %r4, float %ab5, i32 5
77  %r6 = insertelement <8 x float>   %r5, float %ab6, i32 6
78  %r7 = insertelement <8 x float>   %r6, float %ab7, i32 7
79  ret <8 x float> %r7
80}
81
82define <8 x i32> @fptosi_fptoui(<8 x float> %a) {
83; SSE-LABEL: @fptosi_fptoui(
84; SSE-NEXT:    [[A0:%.*]] = extractelement <8 x float> [[A:%.*]], i32 0
85; SSE-NEXT:    [[A1:%.*]] = extractelement <8 x float> [[A]], i32 1
86; SSE-NEXT:    [[A2:%.*]] = extractelement <8 x float> [[A]], i32 2
87; SSE-NEXT:    [[A3:%.*]] = extractelement <8 x float> [[A]], i32 3
88; SSE-NEXT:    [[A4:%.*]] = extractelement <8 x float> [[A]], i32 4
89; SSE-NEXT:    [[A5:%.*]] = extractelement <8 x float> [[A]], i32 5
90; SSE-NEXT:    [[A6:%.*]] = extractelement <8 x float> [[A]], i32 6
91; SSE-NEXT:    [[A7:%.*]] = extractelement <8 x float> [[A]], i32 7
92; SSE-NEXT:    [[AB0:%.*]] = fptosi float [[A0]] to i32
93; SSE-NEXT:    [[AB1:%.*]] = fptosi float [[A1]] to i32
94; SSE-NEXT:    [[AB2:%.*]] = fptosi float [[A2]] to i32
95; SSE-NEXT:    [[AB3:%.*]] = fptosi float [[A3]] to i32
96; SSE-NEXT:    [[AB4:%.*]] = fptoui float [[A4]] to i32
97; SSE-NEXT:    [[AB5:%.*]] = fptoui float [[A5]] to i32
98; SSE-NEXT:    [[AB6:%.*]] = fptoui float [[A6]] to i32
99; SSE-NEXT:    [[AB7:%.*]] = fptoui float [[A7]] to i32
100; SSE-NEXT:    [[R0:%.*]] = insertelement <8 x i32> undef, i32 [[AB0]], i32 0
101; SSE-NEXT:    [[R1:%.*]] = insertelement <8 x i32> [[R0]], i32 [[AB1]], i32 1
102; SSE-NEXT:    [[R2:%.*]] = insertelement <8 x i32> [[R1]], i32 [[AB2]], i32 2
103; SSE-NEXT:    [[R3:%.*]] = insertelement <8 x i32> [[R2]], i32 [[AB3]], i32 3
104; SSE-NEXT:    [[R4:%.*]] = insertelement <8 x i32> [[R3]], i32 [[AB4]], i32 4
105; SSE-NEXT:    [[R5:%.*]] = insertelement <8 x i32> [[R4]], i32 [[AB5]], i32 5
106; SSE-NEXT:    [[R6:%.*]] = insertelement <8 x i32> [[R5]], i32 [[AB6]], i32 6
107; SSE-NEXT:    [[R7:%.*]] = insertelement <8 x i32> [[R6]], i32 [[AB7]], i32 7
108; SSE-NEXT:    ret <8 x i32> [[R7]]
109;
110; SLM-LABEL: @fptosi_fptoui(
111; SLM-NEXT:    [[A0:%.*]] = extractelement <8 x float> [[A:%.*]], i32 0
112; SLM-NEXT:    [[A1:%.*]] = extractelement <8 x float> [[A]], i32 1
113; SLM-NEXT:    [[A2:%.*]] = extractelement <8 x float> [[A]], i32 2
114; SLM-NEXT:    [[A3:%.*]] = extractelement <8 x float> [[A]], i32 3
115; SLM-NEXT:    [[A4:%.*]] = extractelement <8 x float> [[A]], i32 4
116; SLM-NEXT:    [[A5:%.*]] = extractelement <8 x float> [[A]], i32 5
117; SLM-NEXT:    [[A6:%.*]] = extractelement <8 x float> [[A]], i32 6
118; SLM-NEXT:    [[A7:%.*]] = extractelement <8 x float> [[A]], i32 7
119; SLM-NEXT:    [[AB0:%.*]] = fptosi float [[A0]] to i32
120; SLM-NEXT:    [[AB1:%.*]] = fptosi float [[A1]] to i32
121; SLM-NEXT:    [[AB2:%.*]] = fptosi float [[A2]] to i32
122; SLM-NEXT:    [[AB3:%.*]] = fptosi float [[A3]] to i32
123; SLM-NEXT:    [[AB4:%.*]] = fptoui float [[A4]] to i32
124; SLM-NEXT:    [[AB5:%.*]] = fptoui float [[A5]] to i32
125; SLM-NEXT:    [[AB6:%.*]] = fptoui float [[A6]] to i32
126; SLM-NEXT:    [[AB7:%.*]] = fptoui float [[A7]] to i32
127; SLM-NEXT:    [[R0:%.*]] = insertelement <8 x i32> undef, i32 [[AB0]], i32 0
128; SLM-NEXT:    [[R1:%.*]] = insertelement <8 x i32> [[R0]], i32 [[AB1]], i32 1
129; SLM-NEXT:    [[R2:%.*]] = insertelement <8 x i32> [[R1]], i32 [[AB2]], i32 2
130; SLM-NEXT:    [[R3:%.*]] = insertelement <8 x i32> [[R2]], i32 [[AB3]], i32 3
131; SLM-NEXT:    [[R4:%.*]] = insertelement <8 x i32> [[R3]], i32 [[AB4]], i32 4
132; SLM-NEXT:    [[R5:%.*]] = insertelement <8 x i32> [[R4]], i32 [[AB5]], i32 5
133; SLM-NEXT:    [[R6:%.*]] = insertelement <8 x i32> [[R5]], i32 [[AB6]], i32 6
134; SLM-NEXT:    [[R7:%.*]] = insertelement <8 x i32> [[R6]], i32 [[AB7]], i32 7
135; SLM-NEXT:    ret <8 x i32> [[R7]]
136;
137; AVX-LABEL: @fptosi_fptoui(
138; AVX-NEXT:    [[A0:%.*]] = extractelement <8 x float> [[A:%.*]], i32 0
139; AVX-NEXT:    [[A1:%.*]] = extractelement <8 x float> [[A]], i32 1
140; AVX-NEXT:    [[A2:%.*]] = extractelement <8 x float> [[A]], i32 2
141; AVX-NEXT:    [[A3:%.*]] = extractelement <8 x float> [[A]], i32 3
142; AVX-NEXT:    [[A4:%.*]] = extractelement <8 x float> [[A]], i32 4
143; AVX-NEXT:    [[A5:%.*]] = extractelement <8 x float> [[A]], i32 5
144; AVX-NEXT:    [[A6:%.*]] = extractelement <8 x float> [[A]], i32 6
145; AVX-NEXT:    [[A7:%.*]] = extractelement <8 x float> [[A]], i32 7
146; AVX-NEXT:    [[AB0:%.*]] = fptosi float [[A0]] to i32
147; AVX-NEXT:    [[AB1:%.*]] = fptosi float [[A1]] to i32
148; AVX-NEXT:    [[AB2:%.*]] = fptosi float [[A2]] to i32
149; AVX-NEXT:    [[AB3:%.*]] = fptosi float [[A3]] to i32
150; AVX-NEXT:    [[AB4:%.*]] = fptoui float [[A4]] to i32
151; AVX-NEXT:    [[AB5:%.*]] = fptoui float [[A5]] to i32
152; AVX-NEXT:    [[AB6:%.*]] = fptoui float [[A6]] to i32
153; AVX-NEXT:    [[AB7:%.*]] = fptoui float [[A7]] to i32
154; AVX-NEXT:    [[R0:%.*]] = insertelement <8 x i32> undef, i32 [[AB0]], i32 0
155; AVX-NEXT:    [[R1:%.*]] = insertelement <8 x i32> [[R0]], i32 [[AB1]], i32 1
156; AVX-NEXT:    [[R2:%.*]] = insertelement <8 x i32> [[R1]], i32 [[AB2]], i32 2
157; AVX-NEXT:    [[R3:%.*]] = insertelement <8 x i32> [[R2]], i32 [[AB3]], i32 3
158; AVX-NEXT:    [[R4:%.*]] = insertelement <8 x i32> [[R3]], i32 [[AB4]], i32 4
159; AVX-NEXT:    [[R5:%.*]] = insertelement <8 x i32> [[R4]], i32 [[AB5]], i32 5
160; AVX-NEXT:    [[R6:%.*]] = insertelement <8 x i32> [[R5]], i32 [[AB6]], i32 6
161; AVX-NEXT:    [[R7:%.*]] = insertelement <8 x i32> [[R6]], i32 [[AB7]], i32 7
162; AVX-NEXT:    ret <8 x i32> [[R7]]
163;
164; AVX512-LABEL: @fptosi_fptoui(
165; AVX512-NEXT:    [[TMP1:%.*]] = fptosi <8 x float> [[A:%.*]] to <8 x i32>
166; AVX512-NEXT:    [[TMP2:%.*]] = fptoui <8 x float> [[A]] to <8 x i32>
167; AVX512-NEXT:    [[R7:%.*]] = shufflevector <8 x i32> [[TMP1]], <8 x i32> [[TMP2]], <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 12, i32 13, i32 14, i32 15>
168; AVX512-NEXT:    ret <8 x i32> [[R7]]
169;
170  %a0 = extractelement <8 x float> %a, i32 0
171  %a1 = extractelement <8 x float> %a, i32 1
172  %a2 = extractelement <8 x float> %a, i32 2
173  %a3 = extractelement <8 x float> %a, i32 3
174  %a4 = extractelement <8 x float> %a, i32 4
175  %a5 = extractelement <8 x float> %a, i32 5
176  %a6 = extractelement <8 x float> %a, i32 6
177  %a7 = extractelement <8 x float> %a, i32 7
178  %ab0 = fptosi float %a0 to i32
179  %ab1 = fptosi float %a1 to i32
180  %ab2 = fptosi float %a2 to i32
181  %ab3 = fptosi float %a3 to i32
182  %ab4 = fptoui float %a4 to i32
183  %ab5 = fptoui float %a5 to i32
184  %ab6 = fptoui float %a6 to i32
185  %ab7 = fptoui float %a7 to i32
186  %r0 = insertelement <8 x i32> undef, i32 %ab0, i32 0
187  %r1 = insertelement <8 x i32>   %r0, i32 %ab1, i32 1
188  %r2 = insertelement <8 x i32>   %r1, i32 %ab2, i32 2
189  %r3 = insertelement <8 x i32>   %r2, i32 %ab3, i32 3
190  %r4 = insertelement <8 x i32>   %r3, i32 %ab4, i32 4
191  %r5 = insertelement <8 x i32>   %r4, i32 %ab5, i32 5
192  %r6 = insertelement <8 x i32>   %r5, i32 %ab6, i32 6
193  %r7 = insertelement <8 x i32>   %r6, i32 %ab7, i32 7
194  ret <8 x i32> %r7
195}
196
197define <8 x float> @fneg_fabs(<8 x float> %a) {
198; CHECK-LABEL: @fneg_fabs(
199; CHECK-NEXT:    [[TMP1:%.*]] = bitcast <8 x float> [[A:%.*]] to <8 x i32>
200; CHECK-NEXT:    [[TMP2:%.*]] = xor <8 x i32> [[TMP1]], <i32 -2147483648, i32 -2147483648, i32 -2147483648, i32 -2147483648, i32 undef, i32 undef, i32 undef, i32 undef>
201; CHECK-NEXT:    [[TMP3:%.*]] = and <8 x i32> [[TMP1]], <i32 undef, i32 undef, i32 undef, i32 undef, i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647>
202; CHECK-NEXT:    [[TMP4:%.*]] = shufflevector <8 x i32> [[TMP2]], <8 x i32> [[TMP3]], <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 12, i32 13, i32 14, i32 15>
203; CHECK-NEXT:    [[TMP5:%.*]] = bitcast <8 x i32> [[TMP4]] to <8 x float>
204; CHECK-NEXT:    ret <8 x float> [[TMP5]]
205;
206  %a0 = extractelement <8 x float> %a, i32 0
207  %a1 = extractelement <8 x float> %a, i32 1
208  %a2 = extractelement <8 x float> %a, i32 2
209  %a3 = extractelement <8 x float> %a, i32 3
210  %a4 = extractelement <8 x float> %a, i32 4
211  %a5 = extractelement <8 x float> %a, i32 5
212  %a6 = extractelement <8 x float> %a, i32 6
213  %a7 = extractelement <8 x float> %a, i32 7
214  %aa0 = bitcast float %a0 to i32
215  %aa1 = bitcast float %a1 to i32
216  %aa2 = bitcast float %a2 to i32
217  %aa3 = bitcast float %a3 to i32
218  %aa4 = bitcast float %a4 to i32
219  %aa5 = bitcast float %a5 to i32
220  %aa6 = bitcast float %a6 to i32
221  %aa7 = bitcast float %a7 to i32
222  %ab0 = xor i32 %aa0, -2147483648
223  %ab1 = xor i32 %aa1, -2147483648
224  %ab2 = xor i32 %aa2, -2147483648
225  %ab3 = xor i32 %aa3, -2147483648
226  %ab4 = and i32 %aa4, 2147483647
227  %ab5 = and i32 %aa5, 2147483647
228  %ab6 = and i32 %aa6, 2147483647
229  %ab7 = and i32 %aa7, 2147483647
230  %ac0 = bitcast i32 %ab0 to float
231  %ac1 = bitcast i32 %ab1 to float
232  %ac2 = bitcast i32 %ab2 to float
233  %ac3 = bitcast i32 %ab3 to float
234  %ac4 = bitcast i32 %ab4 to float
235  %ac5 = bitcast i32 %ab5 to float
236  %ac6 = bitcast i32 %ab6 to float
237  %ac7 = bitcast i32 %ab7 to float
238  %r0 = insertelement <8 x float> undef, float %ac0, i32 0
239  %r1 = insertelement <8 x float>   %r0, float %ac1, i32 1
240  %r2 = insertelement <8 x float>   %r1, float %ac2, i32 2
241  %r3 = insertelement <8 x float>   %r2, float %ac3, i32 3
242  %r4 = insertelement <8 x float>   %r3, float %ac4, i32 4
243  %r5 = insertelement <8 x float>   %r4, float %ac5, i32 5
244  %r6 = insertelement <8 x float>   %r5, float %ac6, i32 6
245  %r7 = insertelement <8 x float>   %r6, float %ac7, i32 7
246  ret <8 x float> %r7
247}
248
249define <8 x i32> @sext_zext(<8 x i16> %a) {
250; CHECK-LABEL: @sext_zext(
251; CHECK-NEXT:    [[TMP1:%.*]] = sext <8 x i16> [[A:%.*]] to <8 x i32>
252; CHECK-NEXT:    [[TMP2:%.*]] = zext <8 x i16> [[A]] to <8 x i32>
253; CHECK-NEXT:    [[R7:%.*]] = shufflevector <8 x i32> [[TMP1]], <8 x i32> [[TMP2]], <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 12, i32 13, i32 14, i32 15>
254; CHECK-NEXT:    ret <8 x i32> [[R7]]
255;
256  %a0 = extractelement <8 x i16> %a, i32 0
257  %a1 = extractelement <8 x i16> %a, i32 1
258  %a2 = extractelement <8 x i16> %a, i32 2
259  %a3 = extractelement <8 x i16> %a, i32 3
260  %a4 = extractelement <8 x i16> %a, i32 4
261  %a5 = extractelement <8 x i16> %a, i32 5
262  %a6 = extractelement <8 x i16> %a, i32 6
263  %a7 = extractelement <8 x i16> %a, i32 7
264  %ab0 = sext i16 %a0 to i32
265  %ab1 = sext i16 %a1 to i32
266  %ab2 = sext i16 %a2 to i32
267  %ab3 = sext i16 %a3 to i32
268  %ab4 = zext i16 %a4 to i32
269  %ab5 = zext i16 %a5 to i32
270  %ab6 = zext i16 %a6 to i32
271  %ab7 = zext i16 %a7 to i32
272  %r0 = insertelement <8 x i32> undef, i32 %ab0, i32 0
273  %r1 = insertelement <8 x i32>   %r0, i32 %ab1, i32 1
274  %r2 = insertelement <8 x i32>   %r1, i32 %ab2, i32 2
275  %r3 = insertelement <8 x i32>   %r2, i32 %ab3, i32 3
276  %r4 = insertelement <8 x i32>   %r3, i32 %ab4, i32 4
277  %r5 = insertelement <8 x i32>   %r4, i32 %ab5, i32 5
278  %r6 = insertelement <8 x i32>   %r5, i32 %ab6, i32 6
279  %r7 = insertelement <8 x i32>   %r6, i32 %ab7, i32 7
280  ret <8 x i32> %r7
281}
282
283define <8 x float> @sitofp_4i32_8i16(<4 x i32> %a, <8 x i16> %b) {
284; CHECK-LABEL: @sitofp_4i32_8i16(
285; CHECK-NEXT:    [[B0:%.*]] = extractelement <8 x i16> [[B:%.*]], i32 0
286; CHECK-NEXT:    [[B1:%.*]] = extractelement <8 x i16> [[B]], i32 1
287; CHECK-NEXT:    [[B2:%.*]] = extractelement <8 x i16> [[B]], i32 2
288; CHECK-NEXT:    [[B3:%.*]] = extractelement <8 x i16> [[B]], i32 3
289; CHECK-NEXT:    [[TMP1:%.*]] = sitofp <4 x i32> [[A:%.*]] to <4 x float>
290; CHECK-NEXT:    [[AB4:%.*]] = sitofp i16 [[B0]] to float
291; CHECK-NEXT:    [[AB5:%.*]] = sitofp i16 [[B1]] to float
292; CHECK-NEXT:    [[AB6:%.*]] = sitofp i16 [[B2]] to float
293; CHECK-NEXT:    [[AB7:%.*]] = sitofp i16 [[B3]] to float
294; CHECK-NEXT:    [[TMP2:%.*]] = extractelement <4 x float> [[TMP1]], i32 0
295; CHECK-NEXT:    [[R0:%.*]] = insertelement <8 x float> undef, float [[TMP2]], i32 0
296; CHECK-NEXT:    [[TMP3:%.*]] = extractelement <4 x float> [[TMP1]], i32 1
297; CHECK-NEXT:    [[R1:%.*]] = insertelement <8 x float> [[R0]], float [[TMP3]], i32 1
298; CHECK-NEXT:    [[TMP4:%.*]] = extractelement <4 x float> [[TMP1]], i32 2
299; CHECK-NEXT:    [[R2:%.*]] = insertelement <8 x float> [[R1]], float [[TMP4]], i32 2
300; CHECK-NEXT:    [[TMP5:%.*]] = extractelement <4 x float> [[TMP1]], i32 3
301; CHECK-NEXT:    [[R3:%.*]] = insertelement <8 x float> [[R2]], float [[TMP5]], i32 3
302; CHECK-NEXT:    [[R4:%.*]] = insertelement <8 x float> [[R3]], float [[AB4]], i32 4
303; CHECK-NEXT:    [[R5:%.*]] = insertelement <8 x float> [[R4]], float [[AB5]], i32 5
304; CHECK-NEXT:    [[R6:%.*]] = insertelement <8 x float> [[R5]], float [[AB6]], i32 6
305; CHECK-NEXT:    [[R7:%.*]] = insertelement <8 x float> [[R6]], float [[AB7]], i32 7
306; CHECK-NEXT:    ret <8 x float> [[R7]]
307;
308  %a0 = extractelement <4 x i32> %a, i32 0
309  %a1 = extractelement <4 x i32> %a, i32 1
310  %a2 = extractelement <4 x i32> %a, i32 2
311  %a3 = extractelement <4 x i32> %a, i32 3
312  %b0 = extractelement <8 x i16> %b, i32 0
313  %b1 = extractelement <8 x i16> %b, i32 1
314  %b2 = extractelement <8 x i16> %b, i32 2
315  %b3 = extractelement <8 x i16> %b, i32 3
316  %ab0 = sitofp i32 %a0 to float
317  %ab1 = sitofp i32 %a1 to float
318  %ab2 = sitofp i32 %a2 to float
319  %ab3 = sitofp i32 %a3 to float
320  %ab4 = sitofp i16 %b0 to float
321  %ab5 = sitofp i16 %b1 to float
322  %ab6 = sitofp i16 %b2 to float
323  %ab7 = sitofp i16 %b3 to float
324  %r0 = insertelement <8 x float> undef, float %ab0, i32 0
325  %r1 = insertelement <8 x float>   %r0, float %ab1, i32 1
326  %r2 = insertelement <8 x float>   %r1, float %ab2, i32 2
327  %r3 = insertelement <8 x float>   %r2, float %ab3, i32 3
328  %r4 = insertelement <8 x float>   %r3, float %ab4, i32 4
329  %r5 = insertelement <8 x float>   %r4, float %ab5, i32 5
330  %r6 = insertelement <8 x float>   %r5, float %ab6, i32 6
331  %r7 = insertelement <8 x float>   %r6, float %ab7, i32 7
332  ret <8 x float> %r7
333}
334
335; Inspired by PR38154
336define <8 x float> @sitofp_uitofp_4i32_8i16_16i8(<4 x i32> %a, <8 x i16> %b, <16 x i8> %c) {
337; SSE-LABEL: @sitofp_uitofp_4i32_8i16_16i8(
338; SSE-NEXT:    [[A0:%.*]] = extractelement <4 x i32> [[A:%.*]], i32 0
339; SSE-NEXT:    [[A1:%.*]] = extractelement <4 x i32> [[A]], i32 1
340; SSE-NEXT:    [[A2:%.*]] = extractelement <4 x i32> [[A]], i32 2
341; SSE-NEXT:    [[A3:%.*]] = extractelement <4 x i32> [[A]], i32 3
342; SSE-NEXT:    [[B0:%.*]] = extractelement <8 x i16> [[B:%.*]], i32 0
343; SSE-NEXT:    [[B1:%.*]] = extractelement <8 x i16> [[B]], i32 1
344; SSE-NEXT:    [[C0:%.*]] = extractelement <16 x i8> [[C:%.*]], i32 0
345; SSE-NEXT:    [[C1:%.*]] = extractelement <16 x i8> [[C]], i32 1
346; SSE-NEXT:    [[AB0:%.*]] = sitofp i32 [[A0]] to float
347; SSE-NEXT:    [[AB1:%.*]] = sitofp i32 [[A1]] to float
348; SSE-NEXT:    [[AB2:%.*]] = uitofp i32 [[A2]] to float
349; SSE-NEXT:    [[AB3:%.*]] = uitofp i32 [[A3]] to float
350; SSE-NEXT:    [[AB4:%.*]] = sitofp i16 [[B0]] to float
351; SSE-NEXT:    [[AB5:%.*]] = uitofp i16 [[B1]] to float
352; SSE-NEXT:    [[AB6:%.*]] = sitofp i8 [[C0]] to float
353; SSE-NEXT:    [[AB7:%.*]] = uitofp i8 [[C1]] to float
354; SSE-NEXT:    [[R0:%.*]] = insertelement <8 x float> undef, float [[AB0]], i32 0
355; SSE-NEXT:    [[R1:%.*]] = insertelement <8 x float> [[R0]], float [[AB1]], i32 1
356; SSE-NEXT:    [[R2:%.*]] = insertelement <8 x float> [[R1]], float [[AB2]], i32 2
357; SSE-NEXT:    [[R3:%.*]] = insertelement <8 x float> [[R2]], float [[AB3]], i32 3
358; SSE-NEXT:    [[R4:%.*]] = insertelement <8 x float> [[R3]], float [[AB4]], i32 4
359; SSE-NEXT:    [[R5:%.*]] = insertelement <8 x float> [[R4]], float [[AB5]], i32 5
360; SSE-NEXT:    [[R6:%.*]] = insertelement <8 x float> [[R5]], float [[AB6]], i32 6
361; SSE-NEXT:    [[R7:%.*]] = insertelement <8 x float> [[R6]], float [[AB7]], i32 7
362; SSE-NEXT:    ret <8 x float> [[R7]]
363;
364; SLM-LABEL: @sitofp_uitofp_4i32_8i16_16i8(
365; SLM-NEXT:    [[B0:%.*]] = extractelement <8 x i16> [[B:%.*]], i32 0
366; SLM-NEXT:    [[B1:%.*]] = extractelement <8 x i16> [[B]], i32 1
367; SLM-NEXT:    [[C0:%.*]] = extractelement <16 x i8> [[C:%.*]], i32 0
368; SLM-NEXT:    [[C1:%.*]] = extractelement <16 x i8> [[C]], i32 1
369; SLM-NEXT:    [[TMP1:%.*]] = sitofp <4 x i32> [[A:%.*]] to <4 x float>
370; SLM-NEXT:    [[TMP2:%.*]] = uitofp <4 x i32> [[A]] to <4 x float>
371; SLM-NEXT:    [[AB4:%.*]] = sitofp i16 [[B0]] to float
372; SLM-NEXT:    [[AB5:%.*]] = uitofp i16 [[B1]] to float
373; SLM-NEXT:    [[AB6:%.*]] = sitofp i8 [[C0]] to float
374; SLM-NEXT:    [[AB7:%.*]] = uitofp i8 [[C1]] to float
375; SLM-NEXT:    [[TMP3:%.*]] = extractelement <4 x float> [[TMP1]], i32 0
376; SLM-NEXT:    [[R0:%.*]] = insertelement <8 x float> undef, float [[TMP3]], i32 0
377; SLM-NEXT:    [[TMP4:%.*]] = extractelement <4 x float> [[TMP1]], i32 1
378; SLM-NEXT:    [[R1:%.*]] = insertelement <8 x float> [[R0]], float [[TMP4]], i32 1
379; SLM-NEXT:    [[TMP5:%.*]] = extractelement <4 x float> [[TMP2]], i32 2
380; SLM-NEXT:    [[R2:%.*]] = insertelement <8 x float> [[R1]], float [[TMP5]], i32 2
381; SLM-NEXT:    [[TMP6:%.*]] = extractelement <4 x float> [[TMP2]], i32 3
382; SLM-NEXT:    [[R3:%.*]] = insertelement <8 x float> [[R2]], float [[TMP6]], i32 3
383; SLM-NEXT:    [[R4:%.*]] = insertelement <8 x float> [[R3]], float [[AB4]], i32 4
384; SLM-NEXT:    [[R5:%.*]] = insertelement <8 x float> [[R4]], float [[AB5]], i32 5
385; SLM-NEXT:    [[R6:%.*]] = insertelement <8 x float> [[R5]], float [[AB6]], i32 6
386; SLM-NEXT:    [[R7:%.*]] = insertelement <8 x float> [[R6]], float [[AB7]], i32 7
387; SLM-NEXT:    ret <8 x float> [[R7]]
388;
389; AVX-LABEL: @sitofp_uitofp_4i32_8i16_16i8(
390; AVX-NEXT:    [[A0:%.*]] = extractelement <4 x i32> [[A:%.*]], i32 0
391; AVX-NEXT:    [[A1:%.*]] = extractelement <4 x i32> [[A]], i32 1
392; AVX-NEXT:    [[A2:%.*]] = extractelement <4 x i32> [[A]], i32 2
393; AVX-NEXT:    [[A3:%.*]] = extractelement <4 x i32> [[A]], i32 3
394; AVX-NEXT:    [[B0:%.*]] = extractelement <8 x i16> [[B:%.*]], i32 0
395; AVX-NEXT:    [[B1:%.*]] = extractelement <8 x i16> [[B]], i32 1
396; AVX-NEXT:    [[C0:%.*]] = extractelement <16 x i8> [[C:%.*]], i32 0
397; AVX-NEXT:    [[C1:%.*]] = extractelement <16 x i8> [[C]], i32 1
398; AVX-NEXT:    [[AB0:%.*]] = sitofp i32 [[A0]] to float
399; AVX-NEXT:    [[AB1:%.*]] = sitofp i32 [[A1]] to float
400; AVX-NEXT:    [[AB2:%.*]] = uitofp i32 [[A2]] to float
401; AVX-NEXT:    [[AB3:%.*]] = uitofp i32 [[A3]] to float
402; AVX-NEXT:    [[AB4:%.*]] = sitofp i16 [[B0]] to float
403; AVX-NEXT:    [[AB5:%.*]] = uitofp i16 [[B1]] to float
404; AVX-NEXT:    [[AB6:%.*]] = sitofp i8 [[C0]] to float
405; AVX-NEXT:    [[AB7:%.*]] = uitofp i8 [[C1]] to float
406; AVX-NEXT:    [[R0:%.*]] = insertelement <8 x float> undef, float [[AB0]], i32 0
407; AVX-NEXT:    [[R1:%.*]] = insertelement <8 x float> [[R0]], float [[AB1]], i32 1
408; AVX-NEXT:    [[R2:%.*]] = insertelement <8 x float> [[R1]], float [[AB2]], i32 2
409; AVX-NEXT:    [[R3:%.*]] = insertelement <8 x float> [[R2]], float [[AB3]], i32 3
410; AVX-NEXT:    [[R4:%.*]] = insertelement <8 x float> [[R3]], float [[AB4]], i32 4
411; AVX-NEXT:    [[R5:%.*]] = insertelement <8 x float> [[R4]], float [[AB5]], i32 5
412; AVX-NEXT:    [[R6:%.*]] = insertelement <8 x float> [[R5]], float [[AB6]], i32 6
413; AVX-NEXT:    [[R7:%.*]] = insertelement <8 x float> [[R6]], float [[AB7]], i32 7
414; AVX-NEXT:    ret <8 x float> [[R7]]
415;
416; AVX512-LABEL: @sitofp_uitofp_4i32_8i16_16i8(
417; AVX512-NEXT:    [[B0:%.*]] = extractelement <8 x i16> [[B:%.*]], i32 0
418; AVX512-NEXT:    [[B1:%.*]] = extractelement <8 x i16> [[B]], i32 1
419; AVX512-NEXT:    [[C0:%.*]] = extractelement <16 x i8> [[C:%.*]], i32 0
420; AVX512-NEXT:    [[C1:%.*]] = extractelement <16 x i8> [[C]], i32 1
421; AVX512-NEXT:    [[TMP1:%.*]] = sitofp <4 x i32> [[A:%.*]] to <4 x float>
422; AVX512-NEXT:    [[TMP2:%.*]] = uitofp <4 x i32> [[A]] to <4 x float>
423; AVX512-NEXT:    [[AB4:%.*]] = sitofp i16 [[B0]] to float
424; AVX512-NEXT:    [[AB5:%.*]] = uitofp i16 [[B1]] to float
425; AVX512-NEXT:    [[AB6:%.*]] = sitofp i8 [[C0]] to float
426; AVX512-NEXT:    [[AB7:%.*]] = uitofp i8 [[C1]] to float
427; AVX512-NEXT:    [[TMP3:%.*]] = extractelement <4 x float> [[TMP1]], i32 0
428; AVX512-NEXT:    [[R0:%.*]] = insertelement <8 x float> undef, float [[TMP3]], i32 0
429; AVX512-NEXT:    [[TMP4:%.*]] = extractelement <4 x float> [[TMP1]], i32 1
430; AVX512-NEXT:    [[R1:%.*]] = insertelement <8 x float> [[R0]], float [[TMP4]], i32 1
431; AVX512-NEXT:    [[TMP5:%.*]] = extractelement <4 x float> [[TMP2]], i32 2
432; AVX512-NEXT:    [[R2:%.*]] = insertelement <8 x float> [[R1]], float [[TMP5]], i32 2
433; AVX512-NEXT:    [[TMP6:%.*]] = extractelement <4 x float> [[TMP2]], i32 3
434; AVX512-NEXT:    [[R3:%.*]] = insertelement <8 x float> [[R2]], float [[TMP6]], i32 3
435; AVX512-NEXT:    [[R4:%.*]] = insertelement <8 x float> [[R3]], float [[AB4]], i32 4
436; AVX512-NEXT:    [[R5:%.*]] = insertelement <8 x float> [[R4]], float [[AB5]], i32 5
437; AVX512-NEXT:    [[R6:%.*]] = insertelement <8 x float> [[R5]], float [[AB6]], i32 6
438; AVX512-NEXT:    [[R7:%.*]] = insertelement <8 x float> [[R6]], float [[AB7]], i32 7
439; AVX512-NEXT:    ret <8 x float> [[R7]]
440;
441  %a0 = extractelement <4 x i32> %a, i32 0
442  %a1 = extractelement <4 x i32> %a, i32 1
443  %a2 = extractelement <4 x i32> %a, i32 2
444  %a3 = extractelement <4 x i32> %a, i32 3
445  %b0 = extractelement <8 x i16> %b, i32 0
446  %b1 = extractelement <8 x i16> %b, i32 1
447  %c0 = extractelement <16 x i8> %c, i32 0
448  %c1 = extractelement <16 x i8> %c, i32 1
449  %ab0 = sitofp i32 %a0 to float
450  %ab1 = sitofp i32 %a1 to float
451  %ab2 = uitofp i32 %a2 to float
452  %ab3 = uitofp i32 %a3 to float
453  %ab4 = sitofp i16 %b0 to float
454  %ab5 = uitofp i16 %b1 to float
455  %ab6 = sitofp  i8 %c0 to float
456  %ab7 = uitofp  i8 %c1 to float
457  %r0 = insertelement <8 x float> undef, float %ab0, i32 0
458  %r1 = insertelement <8 x float>   %r0, float %ab1, i32 1
459  %r2 = insertelement <8 x float>   %r1, float %ab2, i32 2
460  %r3 = insertelement <8 x float>   %r2, float %ab3, i32 3
461  %r4 = insertelement <8 x float>   %r3, float %ab4, i32 4
462  %r5 = insertelement <8 x float>   %r4, float %ab5, i32 5
463  %r6 = insertelement <8 x float>   %r5, float %ab6, i32 6
464  %r7 = insertelement <8 x float>   %r6, float %ab7, i32 7
465  ret <8 x float> %r7
466}
467