1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt < %s -mtriple=x86_64-unknown -basic-aa -slp-vectorizer -S | FileCheck %s --check-prefixes=SSE,SSE2
3; RUN: opt < %s -mtriple=x86_64-unknown -mcpu=slm -basic-aa -slp-vectorizer -S | FileCheck %s --check-prefixes=SSE,SLM
4; RUN: opt < %s -mtriple=x86_64-unknown -mcpu=corei7-avx -basic-aa -slp-vectorizer -S | FileCheck %s --check-prefixes=AVX
5; RUN: opt < %s -mtriple=x86_64-unknown -mcpu=core-avx2 -basic-aa -slp-vectorizer -S | FileCheck %s --check-prefixes=AVX
6; RUN: opt < %s -mtriple=x86_64-unknown -mcpu=knl -basic-aa -slp-vectorizer -S | FileCheck %s --check-prefixes=AVX
7; RUN: opt < %s -mtriple=x86_64-unknown -mcpu=skx -mattr=+avx512bw -basic-aa -slp-vectorizer -S | FileCheck %s --check-prefixes=AVX
8
9;
10; vXi8
11;
12
13define <2 x i64> @loadext_2i8_to_2i64(i8* %p0) {
14; SSE-LABEL: @loadext_2i8_to_2i64(
15; SSE-NEXT:    [[P1:%.*]] = getelementptr inbounds i8, i8* [[P0:%.*]], i64 1
16; SSE-NEXT:    [[TMP1:%.*]] = bitcast i8* [[P0]] to <2 x i8>*
17; SSE-NEXT:    [[TMP2:%.*]] = load <2 x i8>, <2 x i8>* [[TMP1]], align 1
18; SSE-NEXT:    [[TMP3:%.*]] = sext <2 x i8> [[TMP2]] to <2 x i64>
19; SSE-NEXT:    ret <2 x i64> [[TMP3]]
20;
21; AVX-LABEL: @loadext_2i8_to_2i64(
22; AVX-NEXT:    [[P1:%.*]] = getelementptr inbounds i8, i8* [[P0:%.*]], i64 1
23; AVX-NEXT:    [[TMP1:%.*]] = bitcast i8* [[P0]] to <2 x i8>*
24; AVX-NEXT:    [[TMP2:%.*]] = load <2 x i8>, <2 x i8>* [[TMP1]], align 1
25; AVX-NEXT:    [[TMP3:%.*]] = sext <2 x i8> [[TMP2]] to <2 x i64>
26; AVX-NEXT:    ret <2 x i64> [[TMP3]]
27;
28  %p1 = getelementptr inbounds i8, i8* %p0, i64 1
29  %i0 = load i8, i8* %p0, align 1
30  %i1 = load i8, i8* %p1, align 1
31  %x0 = sext i8 %i0 to i64
32  %x1 = sext i8 %i1 to i64
33  %v0 = insertelement <2 x i64> undef, i64 %x0, i32 0
34  %v1 = insertelement <2 x i64>   %v0, i64 %x1, i32 1
35  ret <2 x i64> %v1
36}
37
38define <4 x i32> @loadext_4i8_to_4i32(i8* %p0) {
39; SSE-LABEL: @loadext_4i8_to_4i32(
40; SSE-NEXT:    [[P1:%.*]] = getelementptr inbounds i8, i8* [[P0:%.*]], i64 1
41; SSE-NEXT:    [[P2:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 2
42; SSE-NEXT:    [[P3:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 3
43; SSE-NEXT:    [[TMP1:%.*]] = bitcast i8* [[P0]] to <4 x i8>*
44; SSE-NEXT:    [[TMP2:%.*]] = load <4 x i8>, <4 x i8>* [[TMP1]], align 1
45; SSE-NEXT:    [[TMP3:%.*]] = sext <4 x i8> [[TMP2]] to <4 x i32>
46; SSE-NEXT:    ret <4 x i32> [[TMP3]]
47;
48; AVX-LABEL: @loadext_4i8_to_4i32(
49; AVX-NEXT:    [[P1:%.*]] = getelementptr inbounds i8, i8* [[P0:%.*]], i64 1
50; AVX-NEXT:    [[P2:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 2
51; AVX-NEXT:    [[P3:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 3
52; AVX-NEXT:    [[TMP1:%.*]] = bitcast i8* [[P0]] to <4 x i8>*
53; AVX-NEXT:    [[TMP2:%.*]] = load <4 x i8>, <4 x i8>* [[TMP1]], align 1
54; AVX-NEXT:    [[TMP3:%.*]] = sext <4 x i8> [[TMP2]] to <4 x i32>
55; AVX-NEXT:    ret <4 x i32> [[TMP3]]
56;
57  %p1 = getelementptr inbounds i8, i8* %p0, i64 1
58  %p2 = getelementptr inbounds i8, i8* %p0, i64 2
59  %p3 = getelementptr inbounds i8, i8* %p0, i64 3
60  %i0 = load i8, i8* %p0, align 1
61  %i1 = load i8, i8* %p1, align 1
62  %i2 = load i8, i8* %p2, align 1
63  %i3 = load i8, i8* %p3, align 1
64  %x0 = sext i8 %i0 to i32
65  %x1 = sext i8 %i1 to i32
66  %x2 = sext i8 %i2 to i32
67  %x3 = sext i8 %i3 to i32
68  %v0 = insertelement <4 x i32> undef, i32 %x0, i32 0
69  %v1 = insertelement <4 x i32>   %v0, i32 %x1, i32 1
70  %v2 = insertelement <4 x i32>   %v1, i32 %x2, i32 2
71  %v3 = insertelement <4 x i32>   %v2, i32 %x3, i32 3
72  ret <4 x i32> %v3
73}
74
75define <4 x i64> @loadext_4i8_to_4i64(i8* %p0) {
76; SSE-LABEL: @loadext_4i8_to_4i64(
77; SSE-NEXT:    [[P1:%.*]] = getelementptr inbounds i8, i8* [[P0:%.*]], i64 1
78; SSE-NEXT:    [[P2:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 2
79; SSE-NEXT:    [[P3:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 3
80; SSE-NEXT:    [[TMP1:%.*]] = bitcast i8* [[P0]] to <4 x i8>*
81; SSE-NEXT:    [[TMP2:%.*]] = load <4 x i8>, <4 x i8>* [[TMP1]], align 1
82; SSE-NEXT:    [[TMP3:%.*]] = sext <4 x i8> [[TMP2]] to <4 x i64>
83; SSE-NEXT:    ret <4 x i64> [[TMP3]]
84;
85; AVX-LABEL: @loadext_4i8_to_4i64(
86; AVX-NEXT:    [[P1:%.*]] = getelementptr inbounds i8, i8* [[P0:%.*]], i64 1
87; AVX-NEXT:    [[P2:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 2
88; AVX-NEXT:    [[P3:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 3
89; AVX-NEXT:    [[TMP1:%.*]] = bitcast i8* [[P0]] to <4 x i8>*
90; AVX-NEXT:    [[TMP2:%.*]] = load <4 x i8>, <4 x i8>* [[TMP1]], align 1
91; AVX-NEXT:    [[TMP3:%.*]] = sext <4 x i8> [[TMP2]] to <4 x i64>
92; AVX-NEXT:    ret <4 x i64> [[TMP3]]
93;
94  %p1 = getelementptr inbounds i8, i8* %p0, i64 1
95  %p2 = getelementptr inbounds i8, i8* %p0, i64 2
96  %p3 = getelementptr inbounds i8, i8* %p0, i64 3
97  %i0 = load i8, i8* %p0, align 1
98  %i1 = load i8, i8* %p1, align 1
99  %i2 = load i8, i8* %p2, align 1
100  %i3 = load i8, i8* %p3, align 1
101  %x0 = sext i8 %i0 to i64
102  %x1 = sext i8 %i1 to i64
103  %x2 = sext i8 %i2 to i64
104  %x3 = sext i8 %i3 to i64
105  %v0 = insertelement <4 x i64> undef, i64 %x0, i32 0
106  %v1 = insertelement <4 x i64>   %v0, i64 %x1, i32 1
107  %v2 = insertelement <4 x i64>   %v1, i64 %x2, i32 2
108  %v3 = insertelement <4 x i64>   %v2, i64 %x3, i32 3
109  ret <4 x i64> %v3
110}
111
112define <8 x i16> @loadext_8i8_to_8i16(i8* %p0) {
113; SSE-LABEL: @loadext_8i8_to_8i16(
114; SSE-NEXT:    [[P1:%.*]] = getelementptr inbounds i8, i8* [[P0:%.*]], i64 1
115; SSE-NEXT:    [[P2:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 2
116; SSE-NEXT:    [[P3:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 3
117; SSE-NEXT:    [[P4:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 4
118; SSE-NEXT:    [[P5:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 5
119; SSE-NEXT:    [[P6:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 6
120; SSE-NEXT:    [[P7:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 7
121; SSE-NEXT:    [[TMP1:%.*]] = bitcast i8* [[P0]] to <8 x i8>*
122; SSE-NEXT:    [[TMP2:%.*]] = load <8 x i8>, <8 x i8>* [[TMP1]], align 1
123; SSE-NEXT:    [[TMP3:%.*]] = sext <8 x i8> [[TMP2]] to <8 x i16>
124; SSE-NEXT:    ret <8 x i16> [[TMP3]]
125;
126; AVX-LABEL: @loadext_8i8_to_8i16(
127; AVX-NEXT:    [[P1:%.*]] = getelementptr inbounds i8, i8* [[P0:%.*]], i64 1
128; AVX-NEXT:    [[P2:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 2
129; AVX-NEXT:    [[P3:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 3
130; AVX-NEXT:    [[P4:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 4
131; AVX-NEXT:    [[P5:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 5
132; AVX-NEXT:    [[P6:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 6
133; AVX-NEXT:    [[P7:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 7
134; AVX-NEXT:    [[TMP1:%.*]] = bitcast i8* [[P0]] to <8 x i8>*
135; AVX-NEXT:    [[TMP2:%.*]] = load <8 x i8>, <8 x i8>* [[TMP1]], align 1
136; AVX-NEXT:    [[TMP3:%.*]] = sext <8 x i8> [[TMP2]] to <8 x i16>
137; AVX-NEXT:    ret <8 x i16> [[TMP3]]
138;
139  %p1 = getelementptr inbounds i8, i8* %p0, i64 1
140  %p2 = getelementptr inbounds i8, i8* %p0, i64 2
141  %p3 = getelementptr inbounds i8, i8* %p0, i64 3
142  %p4 = getelementptr inbounds i8, i8* %p0, i64 4
143  %p5 = getelementptr inbounds i8, i8* %p0, i64 5
144  %p6 = getelementptr inbounds i8, i8* %p0, i64 6
145  %p7 = getelementptr inbounds i8, i8* %p0, i64 7
146  %i0 = load i8, i8* %p0, align 1
147  %i1 = load i8, i8* %p1, align 1
148  %i2 = load i8, i8* %p2, align 1
149  %i3 = load i8, i8* %p3, align 1
150  %i4 = load i8, i8* %p4, align 1
151  %i5 = load i8, i8* %p5, align 1
152  %i6 = load i8, i8* %p6, align 1
153  %i7 = load i8, i8* %p7, align 1
154  %x0 = sext i8 %i0 to i16
155  %x1 = sext i8 %i1 to i16
156  %x2 = sext i8 %i2 to i16
157  %x3 = sext i8 %i3 to i16
158  %x4 = sext i8 %i4 to i16
159  %x5 = sext i8 %i5 to i16
160  %x6 = sext i8 %i6 to i16
161  %x7 = sext i8 %i7 to i16
162  %v0 = insertelement <8 x i16> undef, i16 %x0, i32 0
163  %v1 = insertelement <8 x i16>   %v0, i16 %x1, i32 1
164  %v2 = insertelement <8 x i16>   %v1, i16 %x2, i32 2
165  %v3 = insertelement <8 x i16>   %v2, i16 %x3, i32 3
166  %v4 = insertelement <8 x i16>   %v3, i16 %x4, i32 4
167  %v5 = insertelement <8 x i16>   %v4, i16 %x5, i32 5
168  %v6 = insertelement <8 x i16>   %v5, i16 %x6, i32 6
169  %v7 = insertelement <8 x i16>   %v6, i16 %x7, i32 7
170  ret <8 x i16> %v7
171}
172
173define <8 x i32> @loadext_8i8_to_8i32(i8* %p0) {
174; SSE-LABEL: @loadext_8i8_to_8i32(
175; SSE-NEXT:    [[P1:%.*]] = getelementptr inbounds i8, i8* [[P0:%.*]], i64 1
176; SSE-NEXT:    [[P2:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 2
177; SSE-NEXT:    [[P3:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 3
178; SSE-NEXT:    [[P4:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 4
179; SSE-NEXT:    [[P5:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 5
180; SSE-NEXT:    [[P6:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 6
181; SSE-NEXT:    [[P7:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 7
182; SSE-NEXT:    [[TMP1:%.*]] = bitcast i8* [[P0]] to <8 x i8>*
183; SSE-NEXT:    [[TMP2:%.*]] = load <8 x i8>, <8 x i8>* [[TMP1]], align 1
184; SSE-NEXT:    [[TMP3:%.*]] = sext <8 x i8> [[TMP2]] to <8 x i32>
185; SSE-NEXT:    ret <8 x i32> [[TMP3]]
186;
187; AVX-LABEL: @loadext_8i8_to_8i32(
188; AVX-NEXT:    [[P1:%.*]] = getelementptr inbounds i8, i8* [[P0:%.*]], i64 1
189; AVX-NEXT:    [[P2:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 2
190; AVX-NEXT:    [[P3:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 3
191; AVX-NEXT:    [[P4:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 4
192; AVX-NEXT:    [[P5:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 5
193; AVX-NEXT:    [[P6:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 6
194; AVX-NEXT:    [[P7:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 7
195; AVX-NEXT:    [[TMP1:%.*]] = bitcast i8* [[P0]] to <8 x i8>*
196; AVX-NEXT:    [[TMP2:%.*]] = load <8 x i8>, <8 x i8>* [[TMP1]], align 1
197; AVX-NEXT:    [[TMP3:%.*]] = sext <8 x i8> [[TMP2]] to <8 x i32>
198; AVX-NEXT:    ret <8 x i32> [[TMP3]]
199;
200  %p1 = getelementptr inbounds i8, i8* %p0, i64 1
201  %p2 = getelementptr inbounds i8, i8* %p0, i64 2
202  %p3 = getelementptr inbounds i8, i8* %p0, i64 3
203  %p4 = getelementptr inbounds i8, i8* %p0, i64 4
204  %p5 = getelementptr inbounds i8, i8* %p0, i64 5
205  %p6 = getelementptr inbounds i8, i8* %p0, i64 6
206  %p7 = getelementptr inbounds i8, i8* %p0, i64 7
207  %i0 = load i8, i8* %p0, align 1
208  %i1 = load i8, i8* %p1, align 1
209  %i2 = load i8, i8* %p2, align 1
210  %i3 = load i8, i8* %p3, align 1
211  %i4 = load i8, i8* %p4, align 1
212  %i5 = load i8, i8* %p5, align 1
213  %i6 = load i8, i8* %p6, align 1
214  %i7 = load i8, i8* %p7, align 1
215  %x0 = sext i8 %i0 to i32
216  %x1 = sext i8 %i1 to i32
217  %x2 = sext i8 %i2 to i32
218  %x3 = sext i8 %i3 to i32
219  %x4 = sext i8 %i4 to i32
220  %x5 = sext i8 %i5 to i32
221  %x6 = sext i8 %i6 to i32
222  %x7 = sext i8 %i7 to i32
223  %v0 = insertelement <8 x i32> undef, i32 %x0, i32 0
224  %v1 = insertelement <8 x i32>   %v0, i32 %x1, i32 1
225  %v2 = insertelement <8 x i32>   %v1, i32 %x2, i32 2
226  %v3 = insertelement <8 x i32>   %v2, i32 %x3, i32 3
227  %v4 = insertelement <8 x i32>   %v3, i32 %x4, i32 4
228  %v5 = insertelement <8 x i32>   %v4, i32 %x5, i32 5
229  %v6 = insertelement <8 x i32>   %v5, i32 %x6, i32 6
230  %v7 = insertelement <8 x i32>   %v6, i32 %x7, i32 7
231  ret <8 x i32> %v7
232}
233
234define <16 x i16> @loadext_16i8_to_16i16(i8* %p0) {
235; SSE-LABEL: @loadext_16i8_to_16i16(
236; SSE-NEXT:    [[P1:%.*]] = getelementptr inbounds i8, i8* [[P0:%.*]], i64 1
237; SSE-NEXT:    [[P2:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 2
238; SSE-NEXT:    [[P3:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 3
239; SSE-NEXT:    [[P4:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 4
240; SSE-NEXT:    [[P5:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 5
241; SSE-NEXT:    [[P6:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 6
242; SSE-NEXT:    [[P7:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 7
243; SSE-NEXT:    [[P8:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 8
244; SSE-NEXT:    [[P9:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 9
245; SSE-NEXT:    [[P10:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 10
246; SSE-NEXT:    [[P11:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 11
247; SSE-NEXT:    [[P12:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 12
248; SSE-NEXT:    [[P13:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 13
249; SSE-NEXT:    [[P14:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 14
250; SSE-NEXT:    [[P15:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 15
251; SSE-NEXT:    [[TMP1:%.*]] = bitcast i8* [[P0]] to <16 x i8>*
252; SSE-NEXT:    [[TMP2:%.*]] = load <16 x i8>, <16 x i8>* [[TMP1]], align 1
253; SSE-NEXT:    [[TMP3:%.*]] = sext <16 x i8> [[TMP2]] to <16 x i16>
254; SSE-NEXT:    ret <16 x i16> [[TMP3]]
255;
256; AVX-LABEL: @loadext_16i8_to_16i16(
257; AVX-NEXT:    [[P1:%.*]] = getelementptr inbounds i8, i8* [[P0:%.*]], i64 1
258; AVX-NEXT:    [[P2:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 2
259; AVX-NEXT:    [[P3:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 3
260; AVX-NEXT:    [[P4:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 4
261; AVX-NEXT:    [[P5:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 5
262; AVX-NEXT:    [[P6:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 6
263; AVX-NEXT:    [[P7:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 7
264; AVX-NEXT:    [[P8:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 8
265; AVX-NEXT:    [[P9:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 9
266; AVX-NEXT:    [[P10:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 10
267; AVX-NEXT:    [[P11:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 11
268; AVX-NEXT:    [[P12:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 12
269; AVX-NEXT:    [[P13:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 13
270; AVX-NEXT:    [[P14:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 14
271; AVX-NEXT:    [[P15:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 15
272; AVX-NEXT:    [[TMP1:%.*]] = bitcast i8* [[P0]] to <16 x i8>*
273; AVX-NEXT:    [[TMP2:%.*]] = load <16 x i8>, <16 x i8>* [[TMP1]], align 1
274; AVX-NEXT:    [[TMP3:%.*]] = sext <16 x i8> [[TMP2]] to <16 x i16>
275; AVX-NEXT:    ret <16 x i16> [[TMP3]]
276;
277  %p1  = getelementptr inbounds i8, i8* %p0, i64 1
278  %p2  = getelementptr inbounds i8, i8* %p0, i64 2
279  %p3  = getelementptr inbounds i8, i8* %p0, i64 3
280  %p4  = getelementptr inbounds i8, i8* %p0, i64 4
281  %p5  = getelementptr inbounds i8, i8* %p0, i64 5
282  %p6  = getelementptr inbounds i8, i8* %p0, i64 6
283  %p7  = getelementptr inbounds i8, i8* %p0, i64 7
284  %p8  = getelementptr inbounds i8, i8* %p0, i64 8
285  %p9  = getelementptr inbounds i8, i8* %p0, i64 9
286  %p10 = getelementptr inbounds i8, i8* %p0, i64 10
287  %p11 = getelementptr inbounds i8, i8* %p0, i64 11
288  %p12 = getelementptr inbounds i8, i8* %p0, i64 12
289  %p13 = getelementptr inbounds i8, i8* %p0, i64 13
290  %p14 = getelementptr inbounds i8, i8* %p0, i64 14
291  %p15 = getelementptr inbounds i8, i8* %p0, i64 15
292  %i0  = load i8, i8* %p0,  align 1
293  %i1  = load i8, i8* %p1,  align 1
294  %i2  = load i8, i8* %p2,  align 1
295  %i3  = load i8, i8* %p3,  align 1
296  %i4  = load i8, i8* %p4,  align 1
297  %i5  = load i8, i8* %p5,  align 1
298  %i6  = load i8, i8* %p6,  align 1
299  %i7  = load i8, i8* %p7,  align 1
300  %i8  = load i8, i8* %p8,  align 1
301  %i9  = load i8, i8* %p9,  align 1
302  %i10 = load i8, i8* %p10, align 1
303  %i11 = load i8, i8* %p11, align 1
304  %i12 = load i8, i8* %p12, align 1
305  %i13 = load i8, i8* %p13, align 1
306  %i14 = load i8, i8* %p14, align 1
307  %i15 = load i8, i8* %p15, align 1
308  %x0  = sext i8 %i0  to i16
309  %x1  = sext i8 %i1  to i16
310  %x2  = sext i8 %i2  to i16
311  %x3  = sext i8 %i3  to i16
312  %x4  = sext i8 %i4  to i16
313  %x5  = sext i8 %i5  to i16
314  %x6  = sext i8 %i6  to i16
315  %x7  = sext i8 %i7  to i16
316  %x8  = sext i8 %i8  to i16
317  %x9  = sext i8 %i9  to i16
318  %x10 = sext i8 %i10 to i16
319  %x11 = sext i8 %i11 to i16
320  %x12 = sext i8 %i12 to i16
321  %x13 = sext i8 %i13 to i16
322  %x14 = sext i8 %i14 to i16
323  %x15 = sext i8 %i15 to i16
324  %v0  = insertelement <16 x i16> undef, i16 %x0,  i32 0
325  %v1  = insertelement <16 x i16>  %v0,  i16 %x1,  i32 1
326  %v2  = insertelement <16 x i16>  %v1,  i16 %x2,  i32 2
327  %v3  = insertelement <16 x i16>  %v2,  i16 %x3,  i32 3
328  %v4  = insertelement <16 x i16>  %v3,  i16 %x4,  i32 4
329  %v5  = insertelement <16 x i16>  %v4,  i16 %x5,  i32 5
330  %v6  = insertelement <16 x i16>  %v5,  i16 %x6,  i32 6
331  %v7  = insertelement <16 x i16>  %v6,  i16 %x7,  i32 7
332  %v8  = insertelement <16 x i16>  %v7,  i16 %x8,  i32 8
333  %v9  = insertelement <16 x i16>  %v8,  i16 %x9,  i32 9
334  %v10 = insertelement <16 x i16>  %v9,  i16 %x10, i32 10
335  %v11 = insertelement <16 x i16>  %v10, i16 %x11, i32 11
336  %v12 = insertelement <16 x i16>  %v11, i16 %x12, i32 12
337  %v13 = insertelement <16 x i16>  %v12, i16 %x13, i32 13
338  %v14 = insertelement <16 x i16>  %v13, i16 %x14, i32 14
339  %v15 = insertelement <16 x i16>  %v14, i16 %x15, i32 15
340  ret <16 x i16> %v15
341}
342
343;
344; vXi16
345;
346
347define <2 x i64> @loadext_2i16_to_2i64(i16* %p0) {
348; SSE-LABEL: @loadext_2i16_to_2i64(
349; SSE-NEXT:    [[P1:%.*]] = getelementptr inbounds i16, i16* [[P0:%.*]], i64 1
350; SSE-NEXT:    [[TMP1:%.*]] = bitcast i16* [[P0]] to <2 x i16>*
351; SSE-NEXT:    [[TMP2:%.*]] = load <2 x i16>, <2 x i16>* [[TMP1]], align 1
352; SSE-NEXT:    [[TMP3:%.*]] = sext <2 x i16> [[TMP2]] to <2 x i64>
353; SSE-NEXT:    ret <2 x i64> [[TMP3]]
354;
355; AVX-LABEL: @loadext_2i16_to_2i64(
356; AVX-NEXT:    [[P1:%.*]] = getelementptr inbounds i16, i16* [[P0:%.*]], i64 1
357; AVX-NEXT:    [[TMP1:%.*]] = bitcast i16* [[P0]] to <2 x i16>*
358; AVX-NEXT:    [[TMP2:%.*]] = load <2 x i16>, <2 x i16>* [[TMP1]], align 1
359; AVX-NEXT:    [[TMP3:%.*]] = sext <2 x i16> [[TMP2]] to <2 x i64>
360; AVX-NEXT:    ret <2 x i64> [[TMP3]]
361;
362  %p1 = getelementptr inbounds i16, i16* %p0, i64 1
363  %i0 = load i16, i16* %p0, align 1
364  %i1 = load i16, i16* %p1, align 1
365  %x0 = sext i16 %i0 to i64
366  %x1 = sext i16 %i1 to i64
367  %v0 = insertelement <2 x i64> undef, i64 %x0, i32 0
368  %v1 = insertelement <2 x i64>   %v0, i64 %x1, i32 1
369  ret <2 x i64> %v1
370}
371
372define <4 x i32> @loadext_4i16_to_4i32(i16* %p0) {
373; SSE-LABEL: @loadext_4i16_to_4i32(
374; SSE-NEXT:    [[P1:%.*]] = getelementptr inbounds i16, i16* [[P0:%.*]], i64 1
375; SSE-NEXT:    [[P2:%.*]] = getelementptr inbounds i16, i16* [[P0]], i64 2
376; SSE-NEXT:    [[P3:%.*]] = getelementptr inbounds i16, i16* [[P0]], i64 3
377; SSE-NEXT:    [[TMP1:%.*]] = bitcast i16* [[P0]] to <4 x i16>*
378; SSE-NEXT:    [[TMP2:%.*]] = load <4 x i16>, <4 x i16>* [[TMP1]], align 1
379; SSE-NEXT:    [[TMP3:%.*]] = sext <4 x i16> [[TMP2]] to <4 x i32>
380; SSE-NEXT:    ret <4 x i32> [[TMP3]]
381;
382; AVX-LABEL: @loadext_4i16_to_4i32(
383; AVX-NEXT:    [[P1:%.*]] = getelementptr inbounds i16, i16* [[P0:%.*]], i64 1
384; AVX-NEXT:    [[P2:%.*]] = getelementptr inbounds i16, i16* [[P0]], i64 2
385; AVX-NEXT:    [[P3:%.*]] = getelementptr inbounds i16, i16* [[P0]], i64 3
386; AVX-NEXT:    [[TMP1:%.*]] = bitcast i16* [[P0]] to <4 x i16>*
387; AVX-NEXT:    [[TMP2:%.*]] = load <4 x i16>, <4 x i16>* [[TMP1]], align 1
388; AVX-NEXT:    [[TMP3:%.*]] = sext <4 x i16> [[TMP2]] to <4 x i32>
389; AVX-NEXT:    ret <4 x i32> [[TMP3]]
390;
391  %p1 = getelementptr inbounds i16, i16* %p0, i64 1
392  %p2 = getelementptr inbounds i16, i16* %p0, i64 2
393  %p3 = getelementptr inbounds i16, i16* %p0, i64 3
394  %i0 = load i16, i16* %p0, align 1
395  %i1 = load i16, i16* %p1, align 1
396  %i2 = load i16, i16* %p2, align 1
397  %i3 = load i16, i16* %p3, align 1
398  %x0 = sext i16 %i0 to i32
399  %x1 = sext i16 %i1 to i32
400  %x2 = sext i16 %i2 to i32
401  %x3 = sext i16 %i3 to i32
402  %v0 = insertelement <4 x i32> undef, i32 %x0, i32 0
403  %v1 = insertelement <4 x i32>   %v0, i32 %x1, i32 1
404  %v2 = insertelement <4 x i32>   %v1, i32 %x2, i32 2
405  %v3 = insertelement <4 x i32>   %v2, i32 %x3, i32 3
406  ret <4 x i32> %v3
407}
408
409define <4 x i64> @loadext_4i16_to_4i64(i16* %p0) {
410; SSE2-LABEL: @loadext_4i16_to_4i64(
411; SSE2-NEXT:    [[P1:%.*]] = getelementptr inbounds i16, i16* [[P0:%.*]], i64 1
412; SSE2-NEXT:    [[P2:%.*]] = getelementptr inbounds i16, i16* [[P0]], i64 2
413; SSE2-NEXT:    [[P3:%.*]] = getelementptr inbounds i16, i16* [[P0]], i64 3
414; SSE2-NEXT:    [[TMP1:%.*]] = bitcast i16* [[P0]] to <2 x i16>*
415; SSE2-NEXT:    [[TMP2:%.*]] = load <2 x i16>, <2 x i16>* [[TMP1]], align 1
416; SSE2-NEXT:    [[TMP3:%.*]] = bitcast i16* [[P2]] to <2 x i16>*
417; SSE2-NEXT:    [[TMP4:%.*]] = load <2 x i16>, <2 x i16>* [[TMP3]], align 1
418; SSE2-NEXT:    [[TMP5:%.*]] = sext <2 x i16> [[TMP2]] to <2 x i64>
419; SSE2-NEXT:    [[TMP6:%.*]] = sext <2 x i16> [[TMP4]] to <2 x i64>
420; SSE2-NEXT:    [[TMP7:%.*]] = shufflevector <2 x i64> [[TMP5]], <2 x i64> poison, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
421; SSE2-NEXT:    [[V12:%.*]] = shufflevector <4 x i64> undef, <4 x i64> [[TMP7]], <4 x i32> <i32 4, i32 5, i32 2, i32 3>
422; SSE2-NEXT:    [[TMP8:%.*]] = shufflevector <2 x i64> [[TMP6]], <2 x i64> poison, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
423; SSE2-NEXT:    [[V31:%.*]] = shufflevector <4 x i64> [[V12]], <4 x i64> [[TMP8]], <4 x i32> <i32 0, i32 1, i32 4, i32 5>
424; SSE2-NEXT:    ret <4 x i64> [[V31]]
425;
426; SLM-LABEL: @loadext_4i16_to_4i64(
427; SLM-NEXT:    [[P1:%.*]] = getelementptr inbounds i16, i16* [[P0:%.*]], i64 1
428; SLM-NEXT:    [[P2:%.*]] = getelementptr inbounds i16, i16* [[P0]], i64 2
429; SLM-NEXT:    [[P3:%.*]] = getelementptr inbounds i16, i16* [[P0]], i64 3
430; SLM-NEXT:    [[TMP1:%.*]] = bitcast i16* [[P0]] to <4 x i16>*
431; SLM-NEXT:    [[TMP2:%.*]] = load <4 x i16>, <4 x i16>* [[TMP1]], align 1
432; SLM-NEXT:    [[TMP3:%.*]] = sext <4 x i16> [[TMP2]] to <4 x i64>
433; SLM-NEXT:    ret <4 x i64> [[TMP3]]
434;
435; AVX-LABEL: @loadext_4i16_to_4i64(
436; AVX-NEXT:    [[P1:%.*]] = getelementptr inbounds i16, i16* [[P0:%.*]], i64 1
437; AVX-NEXT:    [[P2:%.*]] = getelementptr inbounds i16, i16* [[P0]], i64 2
438; AVX-NEXT:    [[P3:%.*]] = getelementptr inbounds i16, i16* [[P0]], i64 3
439; AVX-NEXT:    [[TMP1:%.*]] = bitcast i16* [[P0]] to <4 x i16>*
440; AVX-NEXT:    [[TMP2:%.*]] = load <4 x i16>, <4 x i16>* [[TMP1]], align 1
441; AVX-NEXT:    [[TMP3:%.*]] = sext <4 x i16> [[TMP2]] to <4 x i64>
442; AVX-NEXT:    ret <4 x i64> [[TMP3]]
443;
444  %p1 = getelementptr inbounds i16, i16* %p0, i64 1
445  %p2 = getelementptr inbounds i16, i16* %p0, i64 2
446  %p3 = getelementptr inbounds i16, i16* %p0, i64 3
447  %i0 = load i16, i16* %p0, align 1
448  %i1 = load i16, i16* %p1, align 1
449  %i2 = load i16, i16* %p2, align 1
450  %i3 = load i16, i16* %p3, align 1
451  %x0 = sext i16 %i0 to i64
452  %x1 = sext i16 %i1 to i64
453  %x2 = sext i16 %i2 to i64
454  %x3 = sext i16 %i3 to i64
455  %v0 = insertelement <4 x i64> undef, i64 %x0, i32 0
456  %v1 = insertelement <4 x i64>   %v0, i64 %x1, i32 1
457  %v2 = insertelement <4 x i64>   %v1, i64 %x2, i32 2
458  %v3 = insertelement <4 x i64>   %v2, i64 %x3, i32 3
459  ret <4 x i64> %v3
460}
461
462define <8 x i32> @loadext_8i16_to_8i32(i16* %p0) {
463; SSE-LABEL: @loadext_8i16_to_8i32(
464; SSE-NEXT:    [[P1:%.*]] = getelementptr inbounds i16, i16* [[P0:%.*]], i64 1
465; SSE-NEXT:    [[P2:%.*]] = getelementptr inbounds i16, i16* [[P0]], i64 2
466; SSE-NEXT:    [[P3:%.*]] = getelementptr inbounds i16, i16* [[P0]], i64 3
467; SSE-NEXT:    [[P4:%.*]] = getelementptr inbounds i16, i16* [[P0]], i64 4
468; SSE-NEXT:    [[P5:%.*]] = getelementptr inbounds i16, i16* [[P0]], i64 5
469; SSE-NEXT:    [[P6:%.*]] = getelementptr inbounds i16, i16* [[P0]], i64 6
470; SSE-NEXT:    [[P7:%.*]] = getelementptr inbounds i16, i16* [[P0]], i64 7
471; SSE-NEXT:    [[TMP1:%.*]] = bitcast i16* [[P0]] to <8 x i16>*
472; SSE-NEXT:    [[TMP2:%.*]] = load <8 x i16>, <8 x i16>* [[TMP1]], align 1
473; SSE-NEXT:    [[TMP3:%.*]] = sext <8 x i16> [[TMP2]] to <8 x i32>
474; SSE-NEXT:    ret <8 x i32> [[TMP3]]
475;
476; AVX-LABEL: @loadext_8i16_to_8i32(
477; AVX-NEXT:    [[P1:%.*]] = getelementptr inbounds i16, i16* [[P0:%.*]], i64 1
478; AVX-NEXT:    [[P2:%.*]] = getelementptr inbounds i16, i16* [[P0]], i64 2
479; AVX-NEXT:    [[P3:%.*]] = getelementptr inbounds i16, i16* [[P0]], i64 3
480; AVX-NEXT:    [[P4:%.*]] = getelementptr inbounds i16, i16* [[P0]], i64 4
481; AVX-NEXT:    [[P5:%.*]] = getelementptr inbounds i16, i16* [[P0]], i64 5
482; AVX-NEXT:    [[P6:%.*]] = getelementptr inbounds i16, i16* [[P0]], i64 6
483; AVX-NEXT:    [[P7:%.*]] = getelementptr inbounds i16, i16* [[P0]], i64 7
484; AVX-NEXT:    [[TMP1:%.*]] = bitcast i16* [[P0]] to <8 x i16>*
485; AVX-NEXT:    [[TMP2:%.*]] = load <8 x i16>, <8 x i16>* [[TMP1]], align 1
486; AVX-NEXT:    [[TMP3:%.*]] = sext <8 x i16> [[TMP2]] to <8 x i32>
487; AVX-NEXT:    ret <8 x i32> [[TMP3]]
488;
489  %p1 = getelementptr inbounds i16, i16* %p0, i64 1
490  %p2 = getelementptr inbounds i16, i16* %p0, i64 2
491  %p3 = getelementptr inbounds i16, i16* %p0, i64 3
492  %p4 = getelementptr inbounds i16, i16* %p0, i64 4
493  %p5 = getelementptr inbounds i16, i16* %p0, i64 5
494  %p6 = getelementptr inbounds i16, i16* %p0, i64 6
495  %p7 = getelementptr inbounds i16, i16* %p0, i64 7
496  %i0 = load i16, i16* %p0, align 1
497  %i1 = load i16, i16* %p1, align 1
498  %i2 = load i16, i16* %p2, align 1
499  %i3 = load i16, i16* %p3, align 1
500  %i4 = load i16, i16* %p4, align 1
501  %i5 = load i16, i16* %p5, align 1
502  %i6 = load i16, i16* %p6, align 1
503  %i7 = load i16, i16* %p7, align 1
504  %x0 = sext i16 %i0 to i32
505  %x1 = sext i16 %i1 to i32
506  %x2 = sext i16 %i2 to i32
507  %x3 = sext i16 %i3 to i32
508  %x4 = sext i16 %i4 to i32
509  %x5 = sext i16 %i5 to i32
510  %x6 = sext i16 %i6 to i32
511  %x7 = sext i16 %i7 to i32
512  %v0 = insertelement <8 x i32> undef, i32 %x0, i32 0
513  %v1 = insertelement <8 x i32>   %v0, i32 %x1, i32 1
514  %v2 = insertelement <8 x i32>   %v1, i32 %x2, i32 2
515  %v3 = insertelement <8 x i32>   %v2, i32 %x3, i32 3
516  %v4 = insertelement <8 x i32>   %v3, i32 %x4, i32 4
517  %v5 = insertelement <8 x i32>   %v4, i32 %x5, i32 5
518  %v6 = insertelement <8 x i32>   %v5, i32 %x6, i32 6
519  %v7 = insertelement <8 x i32>   %v6, i32 %x7, i32 7
520  ret <8 x i32> %v7
521}
522
523;
524; vXi32
525;
526
527define <2 x i64> @loadext_2i32_to_2i64(i32* %p0) {
528; SSE-LABEL: @loadext_2i32_to_2i64(
529; SSE-NEXT:    [[P1:%.*]] = getelementptr inbounds i32, i32* [[P0:%.*]], i64 1
530; SSE-NEXT:    [[TMP1:%.*]] = bitcast i32* [[P0]] to <2 x i32>*
531; SSE-NEXT:    [[TMP2:%.*]] = load <2 x i32>, <2 x i32>* [[TMP1]], align 1
532; SSE-NEXT:    [[TMP3:%.*]] = sext <2 x i32> [[TMP2]] to <2 x i64>
533; SSE-NEXT:    ret <2 x i64> [[TMP3]]
534;
535; AVX-LABEL: @loadext_2i32_to_2i64(
536; AVX-NEXT:    [[P1:%.*]] = getelementptr inbounds i32, i32* [[P0:%.*]], i64 1
537; AVX-NEXT:    [[TMP1:%.*]] = bitcast i32* [[P0]] to <2 x i32>*
538; AVX-NEXT:    [[TMP2:%.*]] = load <2 x i32>, <2 x i32>* [[TMP1]], align 1
539; AVX-NEXT:    [[TMP3:%.*]] = sext <2 x i32> [[TMP2]] to <2 x i64>
540; AVX-NEXT:    ret <2 x i64> [[TMP3]]
541;
542  %p1 = getelementptr inbounds i32, i32* %p0, i64 1
543  %i0 = load i32, i32* %p0, align 1
544  %i1 = load i32, i32* %p1, align 1
545  %x0 = sext i32 %i0 to i64
546  %x1 = sext i32 %i1 to i64
547  %v0 = insertelement <2 x i64> undef, i64 %x0, i32 0
548  %v1 = insertelement <2 x i64>   %v0, i64 %x1, i32 1
549  ret <2 x i64> %v1
550}
551
552define <4 x i64> @loadext_4i32_to_4i64(i32* %p0) {
553; SSE-LABEL: @loadext_4i32_to_4i64(
554; SSE-NEXT:    [[P1:%.*]] = getelementptr inbounds i32, i32* [[P0:%.*]], i64 1
555; SSE-NEXT:    [[P2:%.*]] = getelementptr inbounds i32, i32* [[P0]], i64 2
556; SSE-NEXT:    [[P3:%.*]] = getelementptr inbounds i32, i32* [[P0]], i64 3
557; SSE-NEXT:    [[TMP1:%.*]] = bitcast i32* [[P0]] to <4 x i32>*
558; SSE-NEXT:    [[TMP2:%.*]] = load <4 x i32>, <4 x i32>* [[TMP1]], align 1
559; SSE-NEXT:    [[TMP3:%.*]] = sext <4 x i32> [[TMP2]] to <4 x i64>
560; SSE-NEXT:    ret <4 x i64> [[TMP3]]
561;
562; AVX-LABEL: @loadext_4i32_to_4i64(
563; AVX-NEXT:    [[P1:%.*]] = getelementptr inbounds i32, i32* [[P0:%.*]], i64 1
564; AVX-NEXT:    [[P2:%.*]] = getelementptr inbounds i32, i32* [[P0]], i64 2
565; AVX-NEXT:    [[P3:%.*]] = getelementptr inbounds i32, i32* [[P0]], i64 3
566; AVX-NEXT:    [[TMP1:%.*]] = bitcast i32* [[P0]] to <4 x i32>*
567; AVX-NEXT:    [[TMP2:%.*]] = load <4 x i32>, <4 x i32>* [[TMP1]], align 1
568; AVX-NEXT:    [[TMP3:%.*]] = sext <4 x i32> [[TMP2]] to <4 x i64>
569; AVX-NEXT:    ret <4 x i64> [[TMP3]]
570;
571  %p1 = getelementptr inbounds i32, i32* %p0, i64 1
572  %p2 = getelementptr inbounds i32, i32* %p0, i64 2
573  %p3 = getelementptr inbounds i32, i32* %p0, i64 3
574  %i0 = load i32, i32* %p0, align 1
575  %i1 = load i32, i32* %p1, align 1
576  %i2 = load i32, i32* %p2, align 1
577  %i3 = load i32, i32* %p3, align 1
578  %x0 = sext i32 %i0 to i64
579  %x1 = sext i32 %i1 to i64
580  %x2 = sext i32 %i2 to i64
581  %x3 = sext i32 %i3 to i64
582  %v0 = insertelement <4 x i64> undef, i64 %x0, i32 0
583  %v1 = insertelement <4 x i64>   %v0, i64 %x1, i32 1
584  %v2 = insertelement <4 x i64>   %v1, i64 %x2, i32 2
585  %v3 = insertelement <4 x i64>   %v2, i64 %x3, i32 3
586  ret <4 x i64> %v3
587}
588