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:    [[I0:%.*]] = load i8, i8* [[P0]], align 1
17; SSE-NEXT:    [[I1:%.*]] = load i8, i8* [[P1]], align 1
18; SSE-NEXT:    [[X0:%.*]] = sext i8 [[I0]] to i64
19; SSE-NEXT:    [[X1:%.*]] = sext i8 [[I1]] to i64
20; SSE-NEXT:    [[V0:%.*]] = insertelement <2 x i64> undef, i64 [[X0]], i32 0
21; SSE-NEXT:    [[V1:%.*]] = insertelement <2 x i64> [[V0]], i64 [[X1]], i32 1
22; SSE-NEXT:    ret <2 x i64> [[V1]]
23;
24; AVX-LABEL: @loadext_2i8_to_2i64(
25; AVX-NEXT:    [[P1:%.*]] = getelementptr inbounds i8, i8* [[P0:%.*]], i64 1
26; AVX-NEXT:    [[TMP1:%.*]] = bitcast i8* [[P0]] to <2 x i8>*
27; AVX-NEXT:    [[TMP2:%.*]] = load <2 x i8>, <2 x i8>* [[TMP1]], align 1
28; AVX-NEXT:    [[TMP3:%.*]] = sext <2 x i8> [[TMP2]] to <2 x i64>
29; AVX-NEXT:    [[TMP4:%.*]] = extractelement <2 x i64> [[TMP3]], i32 0
30; AVX-NEXT:    [[V0:%.*]] = insertelement <2 x i64> undef, i64 [[TMP4]], i32 0
31; AVX-NEXT:    [[TMP5:%.*]] = extractelement <2 x i64> [[TMP3]], i32 1
32; AVX-NEXT:    [[V1:%.*]] = insertelement <2 x i64> [[V0]], i64 [[TMP5]], i32 1
33; AVX-NEXT:    ret <2 x i64> [[V1]]
34;
35  %p1 = getelementptr inbounds i8, i8* %p0, i64 1
36  %i0 = load i8, i8* %p0, align 1
37  %i1 = load i8, i8* %p1, align 1
38  %x0 = sext i8 %i0 to i64
39  %x1 = sext i8 %i1 to i64
40  %v0 = insertelement <2 x i64> undef, i64 %x0, i32 0
41  %v1 = insertelement <2 x i64>   %v0, i64 %x1, i32 1
42  ret <2 x i64> %v1
43}
44
45define <4 x i32> @loadext_4i8_to_4i32(i8* %p0) {
46; SSE2-LABEL: @loadext_4i8_to_4i32(
47; SSE2-NEXT:    [[P1:%.*]] = getelementptr inbounds i8, i8* [[P0:%.*]], i64 1
48; SSE2-NEXT:    [[P2:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 2
49; SSE2-NEXT:    [[P3:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 3
50; SSE2-NEXT:    [[TMP1:%.*]] = bitcast i8* [[P0]] to <4 x i8>*
51; SSE2-NEXT:    [[TMP2:%.*]] = load <4 x i8>, <4 x i8>* [[TMP1]], align 1
52; SSE2-NEXT:    [[TMP3:%.*]] = sext <4 x i8> [[TMP2]] to <4 x i32>
53; SSE2-NEXT:    [[TMP4:%.*]] = extractelement <4 x i32> [[TMP3]], i32 0
54; SSE2-NEXT:    [[V0:%.*]] = insertelement <4 x i32> undef, i32 [[TMP4]], i32 0
55; SSE2-NEXT:    [[TMP5:%.*]] = extractelement <4 x i32> [[TMP3]], i32 1
56; SSE2-NEXT:    [[V1:%.*]] = insertelement <4 x i32> [[V0]], i32 [[TMP5]], i32 1
57; SSE2-NEXT:    [[TMP6:%.*]] = extractelement <4 x i32> [[TMP3]], i32 2
58; SSE2-NEXT:    [[V2:%.*]] = insertelement <4 x i32> [[V1]], i32 [[TMP6]], i32 2
59; SSE2-NEXT:    [[TMP7:%.*]] = extractelement <4 x i32> [[TMP3]], i32 3
60; SSE2-NEXT:    [[V3:%.*]] = insertelement <4 x i32> [[V2]], i32 [[TMP7]], i32 3
61; SSE2-NEXT:    ret <4 x i32> [[V3]]
62;
63; SLM-LABEL: @loadext_4i8_to_4i32(
64; SLM-NEXT:    [[P1:%.*]] = getelementptr inbounds i8, i8* [[P0:%.*]], i64 1
65; SLM-NEXT:    [[P2:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 2
66; SLM-NEXT:    [[P3:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 3
67; SLM-NEXT:    [[I0:%.*]] = load i8, i8* [[P0]], align 1
68; SLM-NEXT:    [[I1:%.*]] = load i8, i8* [[P1]], align 1
69; SLM-NEXT:    [[I2:%.*]] = load i8, i8* [[P2]], align 1
70; SLM-NEXT:    [[I3:%.*]] = load i8, i8* [[P3]], align 1
71; SLM-NEXT:    [[X0:%.*]] = sext i8 [[I0]] to i32
72; SLM-NEXT:    [[X1:%.*]] = sext i8 [[I1]] to i32
73; SLM-NEXT:    [[X2:%.*]] = sext i8 [[I2]] to i32
74; SLM-NEXT:    [[X3:%.*]] = sext i8 [[I3]] to i32
75; SLM-NEXT:    [[V0:%.*]] = insertelement <4 x i32> undef, i32 [[X0]], i32 0
76; SLM-NEXT:    [[V1:%.*]] = insertelement <4 x i32> [[V0]], i32 [[X1]], i32 1
77; SLM-NEXT:    [[V2:%.*]] = insertelement <4 x i32> [[V1]], i32 [[X2]], i32 2
78; SLM-NEXT:    [[V3:%.*]] = insertelement <4 x i32> [[V2]], i32 [[X3]], i32 3
79; SLM-NEXT:    ret <4 x i32> [[V3]]
80;
81; AVX-LABEL: @loadext_4i8_to_4i32(
82; AVX-NEXT:    [[P1:%.*]] = getelementptr inbounds i8, i8* [[P0:%.*]], i64 1
83; AVX-NEXT:    [[P2:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 2
84; AVX-NEXT:    [[P3:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 3
85; AVX-NEXT:    [[TMP1:%.*]] = bitcast i8* [[P0]] to <4 x i8>*
86; AVX-NEXT:    [[TMP2:%.*]] = load <4 x i8>, <4 x i8>* [[TMP1]], align 1
87; AVX-NEXT:    [[TMP3:%.*]] = sext <4 x i8> [[TMP2]] to <4 x i32>
88; AVX-NEXT:    [[TMP4:%.*]] = extractelement <4 x i32> [[TMP3]], i32 0
89; AVX-NEXT:    [[V0:%.*]] = insertelement <4 x i32> undef, i32 [[TMP4]], i32 0
90; AVX-NEXT:    [[TMP5:%.*]] = extractelement <4 x i32> [[TMP3]], i32 1
91; AVX-NEXT:    [[V1:%.*]] = insertelement <4 x i32> [[V0]], i32 [[TMP5]], i32 1
92; AVX-NEXT:    [[TMP6:%.*]] = extractelement <4 x i32> [[TMP3]], i32 2
93; AVX-NEXT:    [[V2:%.*]] = insertelement <4 x i32> [[V1]], i32 [[TMP6]], i32 2
94; AVX-NEXT:    [[TMP7:%.*]] = extractelement <4 x i32> [[TMP3]], i32 3
95; AVX-NEXT:    [[V3:%.*]] = insertelement <4 x i32> [[V2]], i32 [[TMP7]], i32 3
96; AVX-NEXT:    ret <4 x i32> [[V3]]
97;
98  %p1 = getelementptr inbounds i8, i8* %p0, i64 1
99  %p2 = getelementptr inbounds i8, i8* %p0, i64 2
100  %p3 = getelementptr inbounds i8, i8* %p0, i64 3
101  %i0 = load i8, i8* %p0, align 1
102  %i1 = load i8, i8* %p1, align 1
103  %i2 = load i8, i8* %p2, align 1
104  %i3 = load i8, i8* %p3, align 1
105  %x0 = sext i8 %i0 to i32
106  %x1 = sext i8 %i1 to i32
107  %x2 = sext i8 %i2 to i32
108  %x3 = sext i8 %i3 to i32
109  %v0 = insertelement <4 x i32> undef, i32 %x0, i32 0
110  %v1 = insertelement <4 x i32>   %v0, i32 %x1, i32 1
111  %v2 = insertelement <4 x i32>   %v1, i32 %x2, i32 2
112  %v3 = insertelement <4 x i32>   %v2, i32 %x3, i32 3
113  ret <4 x i32> %v3
114}
115
116define <4 x i64> @loadext_4i8_to_4i64(i8* %p0) {
117; SSE-LABEL: @loadext_4i8_to_4i64(
118; SSE-NEXT:    [[P1:%.*]] = getelementptr inbounds i8, i8* [[P0:%.*]], i64 1
119; SSE-NEXT:    [[P2:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 2
120; SSE-NEXT:    [[P3:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 3
121; SSE-NEXT:    [[I0:%.*]] = load i8, i8* [[P0]], align 1
122; SSE-NEXT:    [[I1:%.*]] = load i8, i8* [[P1]], align 1
123; SSE-NEXT:    [[I2:%.*]] = load i8, i8* [[P2]], align 1
124; SSE-NEXT:    [[I3:%.*]] = load i8, i8* [[P3]], align 1
125; SSE-NEXT:    [[X0:%.*]] = sext i8 [[I0]] to i64
126; SSE-NEXT:    [[X1:%.*]] = sext i8 [[I1]] to i64
127; SSE-NEXT:    [[X2:%.*]] = sext i8 [[I2]] to i64
128; SSE-NEXT:    [[X3:%.*]] = sext i8 [[I3]] to i64
129; SSE-NEXT:    [[V0:%.*]] = insertelement <4 x i64> undef, i64 [[X0]], i32 0
130; SSE-NEXT:    [[V1:%.*]] = insertelement <4 x i64> [[V0]], i64 [[X1]], i32 1
131; SSE-NEXT:    [[V2:%.*]] = insertelement <4 x i64> [[V1]], i64 [[X2]], i32 2
132; SSE-NEXT:    [[V3:%.*]] = insertelement <4 x i64> [[V2]], i64 [[X3]], i32 3
133; SSE-NEXT:    ret <4 x i64> [[V3]]
134;
135; AVX-LABEL: @loadext_4i8_to_4i64(
136; AVX-NEXT:    [[P1:%.*]] = getelementptr inbounds i8, i8* [[P0:%.*]], i64 1
137; AVX-NEXT:    [[P2:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 2
138; AVX-NEXT:    [[P3:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 3
139; AVX-NEXT:    [[TMP1:%.*]] = bitcast i8* [[P0]] to <4 x i8>*
140; AVX-NEXT:    [[TMP2:%.*]] = load <4 x i8>, <4 x i8>* [[TMP1]], align 1
141; AVX-NEXT:    [[TMP3:%.*]] = sext <4 x i8> [[TMP2]] to <4 x i64>
142; AVX-NEXT:    [[TMP4:%.*]] = extractelement <4 x i64> [[TMP3]], i32 0
143; AVX-NEXT:    [[V0:%.*]] = insertelement <4 x i64> undef, i64 [[TMP4]], i32 0
144; AVX-NEXT:    [[TMP5:%.*]] = extractelement <4 x i64> [[TMP3]], i32 1
145; AVX-NEXT:    [[V1:%.*]] = insertelement <4 x i64> [[V0]], i64 [[TMP5]], i32 1
146; AVX-NEXT:    [[TMP6:%.*]] = extractelement <4 x i64> [[TMP3]], i32 2
147; AVX-NEXT:    [[V2:%.*]] = insertelement <4 x i64> [[V1]], i64 [[TMP6]], i32 2
148; AVX-NEXT:    [[TMP7:%.*]] = extractelement <4 x i64> [[TMP3]], i32 3
149; AVX-NEXT:    [[V3:%.*]] = insertelement <4 x i64> [[V2]], i64 [[TMP7]], i32 3
150; AVX-NEXT:    ret <4 x i64> [[V3]]
151;
152  %p1 = getelementptr inbounds i8, i8* %p0, i64 1
153  %p2 = getelementptr inbounds i8, i8* %p0, i64 2
154  %p3 = getelementptr inbounds i8, i8* %p0, i64 3
155  %i0 = load i8, i8* %p0, align 1
156  %i1 = load i8, i8* %p1, align 1
157  %i2 = load i8, i8* %p2, align 1
158  %i3 = load i8, i8* %p3, align 1
159  %x0 = sext i8 %i0 to i64
160  %x1 = sext i8 %i1 to i64
161  %x2 = sext i8 %i2 to i64
162  %x3 = sext i8 %i3 to i64
163  %v0 = insertelement <4 x i64> undef, i64 %x0, i32 0
164  %v1 = insertelement <4 x i64>   %v0, i64 %x1, i32 1
165  %v2 = insertelement <4 x i64>   %v1, i64 %x2, i32 2
166  %v3 = insertelement <4 x i64>   %v2, i64 %x3, i32 3
167  ret <4 x i64> %v3
168}
169
170define <8 x i16> @loadext_8i8_to_8i16(i8* %p0) {
171; SSE2-LABEL: @loadext_8i8_to_8i16(
172; SSE2-NEXT:    [[P1:%.*]] = getelementptr inbounds i8, i8* [[P0:%.*]], i64 1
173; SSE2-NEXT:    [[P2:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 2
174; SSE2-NEXT:    [[P3:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 3
175; SSE2-NEXT:    [[P4:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 4
176; SSE2-NEXT:    [[P5:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 5
177; SSE2-NEXT:    [[P6:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 6
178; SSE2-NEXT:    [[P7:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 7
179; SSE2-NEXT:    [[TMP1:%.*]] = bitcast i8* [[P0]] to <8 x i8>*
180; SSE2-NEXT:    [[TMP2:%.*]] = load <8 x i8>, <8 x i8>* [[TMP1]], align 1
181; SSE2-NEXT:    [[TMP3:%.*]] = sext <8 x i8> [[TMP2]] to <8 x i16>
182; SSE2-NEXT:    [[TMP4:%.*]] = extractelement <8 x i16> [[TMP3]], i32 0
183; SSE2-NEXT:    [[V0:%.*]] = insertelement <8 x i16> undef, i16 [[TMP4]], i32 0
184; SSE2-NEXT:    [[TMP5:%.*]] = extractelement <8 x i16> [[TMP3]], i32 1
185; SSE2-NEXT:    [[V1:%.*]] = insertelement <8 x i16> [[V0]], i16 [[TMP5]], i32 1
186; SSE2-NEXT:    [[TMP6:%.*]] = extractelement <8 x i16> [[TMP3]], i32 2
187; SSE2-NEXT:    [[V2:%.*]] = insertelement <8 x i16> [[V1]], i16 [[TMP6]], i32 2
188; SSE2-NEXT:    [[TMP7:%.*]] = extractelement <8 x i16> [[TMP3]], i32 3
189; SSE2-NEXT:    [[V3:%.*]] = insertelement <8 x i16> [[V2]], i16 [[TMP7]], i32 3
190; SSE2-NEXT:    [[TMP8:%.*]] = extractelement <8 x i16> [[TMP3]], i32 4
191; SSE2-NEXT:    [[V4:%.*]] = insertelement <8 x i16> [[V3]], i16 [[TMP8]], i32 4
192; SSE2-NEXT:    [[TMP9:%.*]] = extractelement <8 x i16> [[TMP3]], i32 5
193; SSE2-NEXT:    [[V5:%.*]] = insertelement <8 x i16> [[V4]], i16 [[TMP9]], i32 5
194; SSE2-NEXT:    [[TMP10:%.*]] = extractelement <8 x i16> [[TMP3]], i32 6
195; SSE2-NEXT:    [[V6:%.*]] = insertelement <8 x i16> [[V5]], i16 [[TMP10]], i32 6
196; SSE2-NEXT:    [[TMP11:%.*]] = extractelement <8 x i16> [[TMP3]], i32 7
197; SSE2-NEXT:    [[V7:%.*]] = insertelement <8 x i16> [[V6]], i16 [[TMP11]], i32 7
198; SSE2-NEXT:    ret <8 x i16> [[V7]]
199;
200; SLM-LABEL: @loadext_8i8_to_8i16(
201; SLM-NEXT:    [[P1:%.*]] = getelementptr inbounds i8, i8* [[P0:%.*]], i64 1
202; SLM-NEXT:    [[P2:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 2
203; SLM-NEXT:    [[P3:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 3
204; SLM-NEXT:    [[P4:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 4
205; SLM-NEXT:    [[P5:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 5
206; SLM-NEXT:    [[P6:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 6
207; SLM-NEXT:    [[P7:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 7
208; SLM-NEXT:    [[I0:%.*]] = load i8, i8* [[P0]], align 1
209; SLM-NEXT:    [[I1:%.*]] = load i8, i8* [[P1]], align 1
210; SLM-NEXT:    [[I2:%.*]] = load i8, i8* [[P2]], align 1
211; SLM-NEXT:    [[I3:%.*]] = load i8, i8* [[P3]], align 1
212; SLM-NEXT:    [[I4:%.*]] = load i8, i8* [[P4]], align 1
213; SLM-NEXT:    [[I5:%.*]] = load i8, i8* [[P5]], align 1
214; SLM-NEXT:    [[I6:%.*]] = load i8, i8* [[P6]], align 1
215; SLM-NEXT:    [[I7:%.*]] = load i8, i8* [[P7]], align 1
216; SLM-NEXT:    [[X0:%.*]] = sext i8 [[I0]] to i16
217; SLM-NEXT:    [[X1:%.*]] = sext i8 [[I1]] to i16
218; SLM-NEXT:    [[X2:%.*]] = sext i8 [[I2]] to i16
219; SLM-NEXT:    [[X3:%.*]] = sext i8 [[I3]] to i16
220; SLM-NEXT:    [[X4:%.*]] = sext i8 [[I4]] to i16
221; SLM-NEXT:    [[X5:%.*]] = sext i8 [[I5]] to i16
222; SLM-NEXT:    [[X6:%.*]] = sext i8 [[I6]] to i16
223; SLM-NEXT:    [[X7:%.*]] = sext i8 [[I7]] to i16
224; SLM-NEXT:    [[V0:%.*]] = insertelement <8 x i16> undef, i16 [[X0]], i32 0
225; SLM-NEXT:    [[V1:%.*]] = insertelement <8 x i16> [[V0]], i16 [[X1]], i32 1
226; SLM-NEXT:    [[V2:%.*]] = insertelement <8 x i16> [[V1]], i16 [[X2]], i32 2
227; SLM-NEXT:    [[V3:%.*]] = insertelement <8 x i16> [[V2]], i16 [[X3]], i32 3
228; SLM-NEXT:    [[V4:%.*]] = insertelement <8 x i16> [[V3]], i16 [[X4]], i32 4
229; SLM-NEXT:    [[V5:%.*]] = insertelement <8 x i16> [[V4]], i16 [[X5]], i32 5
230; SLM-NEXT:    [[V6:%.*]] = insertelement <8 x i16> [[V5]], i16 [[X6]], i32 6
231; SLM-NEXT:    [[V7:%.*]] = insertelement <8 x i16> [[V6]], i16 [[X7]], i32 7
232; SLM-NEXT:    ret <8 x i16> [[V7]]
233;
234; AVX-LABEL: @loadext_8i8_to_8i16(
235; AVX-NEXT:    [[P1:%.*]] = getelementptr inbounds i8, i8* [[P0:%.*]], i64 1
236; AVX-NEXT:    [[P2:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 2
237; AVX-NEXT:    [[P3:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 3
238; AVX-NEXT:    [[P4:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 4
239; AVX-NEXT:    [[P5:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 5
240; AVX-NEXT:    [[P6:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 6
241; AVX-NEXT:    [[P7:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 7
242; AVX-NEXT:    [[TMP1:%.*]] = bitcast i8* [[P0]] to <8 x i8>*
243; AVX-NEXT:    [[TMP2:%.*]] = load <8 x i8>, <8 x i8>* [[TMP1]], align 1
244; AVX-NEXT:    [[TMP3:%.*]] = sext <8 x i8> [[TMP2]] to <8 x i16>
245; AVX-NEXT:    [[TMP4:%.*]] = extractelement <8 x i16> [[TMP3]], i32 0
246; AVX-NEXT:    [[V0:%.*]] = insertelement <8 x i16> undef, i16 [[TMP4]], i32 0
247; AVX-NEXT:    [[TMP5:%.*]] = extractelement <8 x i16> [[TMP3]], i32 1
248; AVX-NEXT:    [[V1:%.*]] = insertelement <8 x i16> [[V0]], i16 [[TMP5]], i32 1
249; AVX-NEXT:    [[TMP6:%.*]] = extractelement <8 x i16> [[TMP3]], i32 2
250; AVX-NEXT:    [[V2:%.*]] = insertelement <8 x i16> [[V1]], i16 [[TMP6]], i32 2
251; AVX-NEXT:    [[TMP7:%.*]] = extractelement <8 x i16> [[TMP3]], i32 3
252; AVX-NEXT:    [[V3:%.*]] = insertelement <8 x i16> [[V2]], i16 [[TMP7]], i32 3
253; AVX-NEXT:    [[TMP8:%.*]] = extractelement <8 x i16> [[TMP3]], i32 4
254; AVX-NEXT:    [[V4:%.*]] = insertelement <8 x i16> [[V3]], i16 [[TMP8]], i32 4
255; AVX-NEXT:    [[TMP9:%.*]] = extractelement <8 x i16> [[TMP3]], i32 5
256; AVX-NEXT:    [[V5:%.*]] = insertelement <8 x i16> [[V4]], i16 [[TMP9]], i32 5
257; AVX-NEXT:    [[TMP10:%.*]] = extractelement <8 x i16> [[TMP3]], i32 6
258; AVX-NEXT:    [[V6:%.*]] = insertelement <8 x i16> [[V5]], i16 [[TMP10]], i32 6
259; AVX-NEXT:    [[TMP11:%.*]] = extractelement <8 x i16> [[TMP3]], i32 7
260; AVX-NEXT:    [[V7:%.*]] = insertelement <8 x i16> [[V6]], i16 [[TMP11]], i32 7
261; AVX-NEXT:    ret <8 x i16> [[V7]]
262;
263  %p1 = getelementptr inbounds i8, i8* %p0, i64 1
264  %p2 = getelementptr inbounds i8, i8* %p0, i64 2
265  %p3 = getelementptr inbounds i8, i8* %p0, i64 3
266  %p4 = getelementptr inbounds i8, i8* %p0, i64 4
267  %p5 = getelementptr inbounds i8, i8* %p0, i64 5
268  %p6 = getelementptr inbounds i8, i8* %p0, i64 6
269  %p7 = getelementptr inbounds i8, i8* %p0, i64 7
270  %i0 = load i8, i8* %p0, align 1
271  %i1 = load i8, i8* %p1, align 1
272  %i2 = load i8, i8* %p2, align 1
273  %i3 = load i8, i8* %p3, align 1
274  %i4 = load i8, i8* %p4, align 1
275  %i5 = load i8, i8* %p5, align 1
276  %i6 = load i8, i8* %p6, align 1
277  %i7 = load i8, i8* %p7, align 1
278  %x0 = sext i8 %i0 to i16
279  %x1 = sext i8 %i1 to i16
280  %x2 = sext i8 %i2 to i16
281  %x3 = sext i8 %i3 to i16
282  %x4 = sext i8 %i4 to i16
283  %x5 = sext i8 %i5 to i16
284  %x6 = sext i8 %i6 to i16
285  %x7 = sext i8 %i7 to i16
286  %v0 = insertelement <8 x i16> undef, i16 %x0, i32 0
287  %v1 = insertelement <8 x i16>   %v0, i16 %x1, i32 1
288  %v2 = insertelement <8 x i16>   %v1, i16 %x2, i32 2
289  %v3 = insertelement <8 x i16>   %v2, i16 %x3, i32 3
290  %v4 = insertelement <8 x i16>   %v3, i16 %x4, i32 4
291  %v5 = insertelement <8 x i16>   %v4, i16 %x5, i32 5
292  %v6 = insertelement <8 x i16>   %v5, i16 %x6, i32 6
293  %v7 = insertelement <8 x i16>   %v6, i16 %x7, i32 7
294  ret <8 x i16> %v7
295}
296
297define <8 x i32> @loadext_8i8_to_8i32(i8* %p0) {
298; SSE2-LABEL: @loadext_8i8_to_8i32(
299; SSE2-NEXT:    [[P1:%.*]] = getelementptr inbounds i8, i8* [[P0:%.*]], i64 1
300; SSE2-NEXT:    [[P2:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 2
301; SSE2-NEXT:    [[P3:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 3
302; SSE2-NEXT:    [[P4:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 4
303; SSE2-NEXT:    [[P5:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 5
304; SSE2-NEXT:    [[P6:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 6
305; SSE2-NEXT:    [[P7:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 7
306; SSE2-NEXT:    [[TMP1:%.*]] = bitcast i8* [[P0]] to <8 x i8>*
307; SSE2-NEXT:    [[TMP2:%.*]] = load <8 x i8>, <8 x i8>* [[TMP1]], align 1
308; SSE2-NEXT:    [[TMP3:%.*]] = sext <8 x i8> [[TMP2]] to <8 x i32>
309; SSE2-NEXT:    [[TMP4:%.*]] = extractelement <8 x i32> [[TMP3]], i32 0
310; SSE2-NEXT:    [[V0:%.*]] = insertelement <8 x i32> undef, i32 [[TMP4]], i32 0
311; SSE2-NEXT:    [[TMP5:%.*]] = extractelement <8 x i32> [[TMP3]], i32 1
312; SSE2-NEXT:    [[V1:%.*]] = insertelement <8 x i32> [[V0]], i32 [[TMP5]], i32 1
313; SSE2-NEXT:    [[TMP6:%.*]] = extractelement <8 x i32> [[TMP3]], i32 2
314; SSE2-NEXT:    [[V2:%.*]] = insertelement <8 x i32> [[V1]], i32 [[TMP6]], i32 2
315; SSE2-NEXT:    [[TMP7:%.*]] = extractelement <8 x i32> [[TMP3]], i32 3
316; SSE2-NEXT:    [[V3:%.*]] = insertelement <8 x i32> [[V2]], i32 [[TMP7]], i32 3
317; SSE2-NEXT:    [[TMP8:%.*]] = extractelement <8 x i32> [[TMP3]], i32 4
318; SSE2-NEXT:    [[V4:%.*]] = insertelement <8 x i32> [[V3]], i32 [[TMP8]], i32 4
319; SSE2-NEXT:    [[TMP9:%.*]] = extractelement <8 x i32> [[TMP3]], i32 5
320; SSE2-NEXT:    [[V5:%.*]] = insertelement <8 x i32> [[V4]], i32 [[TMP9]], i32 5
321; SSE2-NEXT:    [[TMP10:%.*]] = extractelement <8 x i32> [[TMP3]], i32 6
322; SSE2-NEXT:    [[V6:%.*]] = insertelement <8 x i32> [[V5]], i32 [[TMP10]], i32 6
323; SSE2-NEXT:    [[TMP11:%.*]] = extractelement <8 x i32> [[TMP3]], i32 7
324; SSE2-NEXT:    [[V7:%.*]] = insertelement <8 x i32> [[V6]], i32 [[TMP11]], i32 7
325; SSE2-NEXT:    ret <8 x i32> [[V7]]
326;
327; SLM-LABEL: @loadext_8i8_to_8i32(
328; SLM-NEXT:    [[P1:%.*]] = getelementptr inbounds i8, i8* [[P0:%.*]], i64 1
329; SLM-NEXT:    [[P2:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 2
330; SLM-NEXT:    [[P3:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 3
331; SLM-NEXT:    [[P4:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 4
332; SLM-NEXT:    [[P5:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 5
333; SLM-NEXT:    [[P6:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 6
334; SLM-NEXT:    [[P7:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 7
335; SLM-NEXT:    [[I0:%.*]] = load i8, i8* [[P0]], align 1
336; SLM-NEXT:    [[I1:%.*]] = load i8, i8* [[P1]], align 1
337; SLM-NEXT:    [[I2:%.*]] = load i8, i8* [[P2]], align 1
338; SLM-NEXT:    [[I3:%.*]] = load i8, i8* [[P3]], align 1
339; SLM-NEXT:    [[I4:%.*]] = load i8, i8* [[P4]], align 1
340; SLM-NEXT:    [[I5:%.*]] = load i8, i8* [[P5]], align 1
341; SLM-NEXT:    [[I6:%.*]] = load i8, i8* [[P6]], align 1
342; SLM-NEXT:    [[I7:%.*]] = load i8, i8* [[P7]], align 1
343; SLM-NEXT:    [[X0:%.*]] = sext i8 [[I0]] to i32
344; SLM-NEXT:    [[X1:%.*]] = sext i8 [[I1]] to i32
345; SLM-NEXT:    [[X2:%.*]] = sext i8 [[I2]] to i32
346; SLM-NEXT:    [[X3:%.*]] = sext i8 [[I3]] to i32
347; SLM-NEXT:    [[X4:%.*]] = sext i8 [[I4]] to i32
348; SLM-NEXT:    [[X5:%.*]] = sext i8 [[I5]] to i32
349; SLM-NEXT:    [[X6:%.*]] = sext i8 [[I6]] to i32
350; SLM-NEXT:    [[X7:%.*]] = sext i8 [[I7]] to i32
351; SLM-NEXT:    [[V0:%.*]] = insertelement <8 x i32> undef, i32 [[X0]], i32 0
352; SLM-NEXT:    [[V1:%.*]] = insertelement <8 x i32> [[V0]], i32 [[X1]], i32 1
353; SLM-NEXT:    [[V2:%.*]] = insertelement <8 x i32> [[V1]], i32 [[X2]], i32 2
354; SLM-NEXT:    [[V3:%.*]] = insertelement <8 x i32> [[V2]], i32 [[X3]], i32 3
355; SLM-NEXT:    [[V4:%.*]] = insertelement <8 x i32> [[V3]], i32 [[X4]], i32 4
356; SLM-NEXT:    [[V5:%.*]] = insertelement <8 x i32> [[V4]], i32 [[X5]], i32 5
357; SLM-NEXT:    [[V6:%.*]] = insertelement <8 x i32> [[V5]], i32 [[X6]], i32 6
358; SLM-NEXT:    [[V7:%.*]] = insertelement <8 x i32> [[V6]], i32 [[X7]], i32 7
359; SLM-NEXT:    ret <8 x i32> [[V7]]
360;
361; AVX-LABEL: @loadext_8i8_to_8i32(
362; AVX-NEXT:    [[P1:%.*]] = getelementptr inbounds i8, i8* [[P0:%.*]], i64 1
363; AVX-NEXT:    [[P2:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 2
364; AVX-NEXT:    [[P3:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 3
365; AVX-NEXT:    [[P4:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 4
366; AVX-NEXT:    [[P5:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 5
367; AVX-NEXT:    [[P6:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 6
368; AVX-NEXT:    [[P7:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 7
369; AVX-NEXT:    [[TMP1:%.*]] = bitcast i8* [[P0]] to <8 x i8>*
370; AVX-NEXT:    [[TMP2:%.*]] = load <8 x i8>, <8 x i8>* [[TMP1]], align 1
371; AVX-NEXT:    [[TMP3:%.*]] = sext <8 x i8> [[TMP2]] to <8 x i32>
372; AVX-NEXT:    [[TMP4:%.*]] = extractelement <8 x i32> [[TMP3]], i32 0
373; AVX-NEXT:    [[V0:%.*]] = insertelement <8 x i32> undef, i32 [[TMP4]], i32 0
374; AVX-NEXT:    [[TMP5:%.*]] = extractelement <8 x i32> [[TMP3]], i32 1
375; AVX-NEXT:    [[V1:%.*]] = insertelement <8 x i32> [[V0]], i32 [[TMP5]], i32 1
376; AVX-NEXT:    [[TMP6:%.*]] = extractelement <8 x i32> [[TMP3]], i32 2
377; AVX-NEXT:    [[V2:%.*]] = insertelement <8 x i32> [[V1]], i32 [[TMP6]], i32 2
378; AVX-NEXT:    [[TMP7:%.*]] = extractelement <8 x i32> [[TMP3]], i32 3
379; AVX-NEXT:    [[V3:%.*]] = insertelement <8 x i32> [[V2]], i32 [[TMP7]], i32 3
380; AVX-NEXT:    [[TMP8:%.*]] = extractelement <8 x i32> [[TMP3]], i32 4
381; AVX-NEXT:    [[V4:%.*]] = insertelement <8 x i32> [[V3]], i32 [[TMP8]], i32 4
382; AVX-NEXT:    [[TMP9:%.*]] = extractelement <8 x i32> [[TMP3]], i32 5
383; AVX-NEXT:    [[V5:%.*]] = insertelement <8 x i32> [[V4]], i32 [[TMP9]], i32 5
384; AVX-NEXT:    [[TMP10:%.*]] = extractelement <8 x i32> [[TMP3]], i32 6
385; AVX-NEXT:    [[V6:%.*]] = insertelement <8 x i32> [[V5]], i32 [[TMP10]], i32 6
386; AVX-NEXT:    [[TMP11:%.*]] = extractelement <8 x i32> [[TMP3]], i32 7
387; AVX-NEXT:    [[V7:%.*]] = insertelement <8 x i32> [[V6]], i32 [[TMP11]], i32 7
388; AVX-NEXT:    ret <8 x i32> [[V7]]
389;
390  %p1 = getelementptr inbounds i8, i8* %p0, i64 1
391  %p2 = getelementptr inbounds i8, i8* %p0, i64 2
392  %p3 = getelementptr inbounds i8, i8* %p0, i64 3
393  %p4 = getelementptr inbounds i8, i8* %p0, i64 4
394  %p5 = getelementptr inbounds i8, i8* %p0, i64 5
395  %p6 = getelementptr inbounds i8, i8* %p0, i64 6
396  %p7 = getelementptr inbounds i8, i8* %p0, i64 7
397  %i0 = load i8, i8* %p0, align 1
398  %i1 = load i8, i8* %p1, align 1
399  %i2 = load i8, i8* %p2, align 1
400  %i3 = load i8, i8* %p3, align 1
401  %i4 = load i8, i8* %p4, align 1
402  %i5 = load i8, i8* %p5, align 1
403  %i6 = load i8, i8* %p6, align 1
404  %i7 = load i8, i8* %p7, align 1
405  %x0 = sext i8 %i0 to i32
406  %x1 = sext i8 %i1 to i32
407  %x2 = sext i8 %i2 to i32
408  %x3 = sext i8 %i3 to i32
409  %x4 = sext i8 %i4 to i32
410  %x5 = sext i8 %i5 to i32
411  %x6 = sext i8 %i6 to i32
412  %x7 = sext i8 %i7 to i32
413  %v0 = insertelement <8 x i32> undef, i32 %x0, i32 0
414  %v1 = insertelement <8 x i32>   %v0, i32 %x1, i32 1
415  %v2 = insertelement <8 x i32>   %v1, i32 %x2, i32 2
416  %v3 = insertelement <8 x i32>   %v2, i32 %x3, i32 3
417  %v4 = insertelement <8 x i32>   %v3, i32 %x4, i32 4
418  %v5 = insertelement <8 x i32>   %v4, i32 %x5, i32 5
419  %v6 = insertelement <8 x i32>   %v5, i32 %x6, i32 6
420  %v7 = insertelement <8 x i32>   %v6, i32 %x7, i32 7
421  ret <8 x i32> %v7
422}
423
424define <16 x i16> @loadext_16i8_to_16i16(i8* %p0) {
425; SSE2-LABEL: @loadext_16i8_to_16i16(
426; SSE2-NEXT:    [[P1:%.*]] = getelementptr inbounds i8, i8* [[P0:%.*]], i64 1
427; SSE2-NEXT:    [[P2:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 2
428; SSE2-NEXT:    [[P3:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 3
429; SSE2-NEXT:    [[P4:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 4
430; SSE2-NEXT:    [[P5:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 5
431; SSE2-NEXT:    [[P6:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 6
432; SSE2-NEXT:    [[P7:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 7
433; SSE2-NEXT:    [[P8:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 8
434; SSE2-NEXT:    [[P9:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 9
435; SSE2-NEXT:    [[P10:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 10
436; SSE2-NEXT:    [[P11:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 11
437; SSE2-NEXT:    [[P12:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 12
438; SSE2-NEXT:    [[P13:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 13
439; SSE2-NEXT:    [[P14:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 14
440; SSE2-NEXT:    [[P15:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 15
441; SSE2-NEXT:    [[TMP1:%.*]] = bitcast i8* [[P0]] to <16 x i8>*
442; SSE2-NEXT:    [[TMP2:%.*]] = load <16 x i8>, <16 x i8>* [[TMP1]], align 1
443; SSE2-NEXT:    [[TMP3:%.*]] = sext <16 x i8> [[TMP2]] to <16 x i16>
444; SSE2-NEXT:    [[TMP4:%.*]] = extractelement <16 x i16> [[TMP3]], i32 0
445; SSE2-NEXT:    [[V0:%.*]] = insertelement <16 x i16> undef, i16 [[TMP4]], i32 0
446; SSE2-NEXT:    [[TMP5:%.*]] = extractelement <16 x i16> [[TMP3]], i32 1
447; SSE2-NEXT:    [[V1:%.*]] = insertelement <16 x i16> [[V0]], i16 [[TMP5]], i32 1
448; SSE2-NEXT:    [[TMP6:%.*]] = extractelement <16 x i16> [[TMP3]], i32 2
449; SSE2-NEXT:    [[V2:%.*]] = insertelement <16 x i16> [[V1]], i16 [[TMP6]], i32 2
450; SSE2-NEXT:    [[TMP7:%.*]] = extractelement <16 x i16> [[TMP3]], i32 3
451; SSE2-NEXT:    [[V3:%.*]] = insertelement <16 x i16> [[V2]], i16 [[TMP7]], i32 3
452; SSE2-NEXT:    [[TMP8:%.*]] = extractelement <16 x i16> [[TMP3]], i32 4
453; SSE2-NEXT:    [[V4:%.*]] = insertelement <16 x i16> [[V3]], i16 [[TMP8]], i32 4
454; SSE2-NEXT:    [[TMP9:%.*]] = extractelement <16 x i16> [[TMP3]], i32 5
455; SSE2-NEXT:    [[V5:%.*]] = insertelement <16 x i16> [[V4]], i16 [[TMP9]], i32 5
456; SSE2-NEXT:    [[TMP10:%.*]] = extractelement <16 x i16> [[TMP3]], i32 6
457; SSE2-NEXT:    [[V6:%.*]] = insertelement <16 x i16> [[V5]], i16 [[TMP10]], i32 6
458; SSE2-NEXT:    [[TMP11:%.*]] = extractelement <16 x i16> [[TMP3]], i32 7
459; SSE2-NEXT:    [[V7:%.*]] = insertelement <16 x i16> [[V6]], i16 [[TMP11]], i32 7
460; SSE2-NEXT:    [[TMP12:%.*]] = extractelement <16 x i16> [[TMP3]], i32 8
461; SSE2-NEXT:    [[V8:%.*]] = insertelement <16 x i16> [[V7]], i16 [[TMP12]], i32 8
462; SSE2-NEXT:    [[TMP13:%.*]] = extractelement <16 x i16> [[TMP3]], i32 9
463; SSE2-NEXT:    [[V9:%.*]] = insertelement <16 x i16> [[V8]], i16 [[TMP13]], i32 9
464; SSE2-NEXT:    [[TMP14:%.*]] = extractelement <16 x i16> [[TMP3]], i32 10
465; SSE2-NEXT:    [[V10:%.*]] = insertelement <16 x i16> [[V9]], i16 [[TMP14]], i32 10
466; SSE2-NEXT:    [[TMP15:%.*]] = extractelement <16 x i16> [[TMP3]], i32 11
467; SSE2-NEXT:    [[V11:%.*]] = insertelement <16 x i16> [[V10]], i16 [[TMP15]], i32 11
468; SSE2-NEXT:    [[TMP16:%.*]] = extractelement <16 x i16> [[TMP3]], i32 12
469; SSE2-NEXT:    [[V12:%.*]] = insertelement <16 x i16> [[V11]], i16 [[TMP16]], i32 12
470; SSE2-NEXT:    [[TMP17:%.*]] = extractelement <16 x i16> [[TMP3]], i32 13
471; SSE2-NEXT:    [[V13:%.*]] = insertelement <16 x i16> [[V12]], i16 [[TMP17]], i32 13
472; SSE2-NEXT:    [[TMP18:%.*]] = extractelement <16 x i16> [[TMP3]], i32 14
473; SSE2-NEXT:    [[V14:%.*]] = insertelement <16 x i16> [[V13]], i16 [[TMP18]], i32 14
474; SSE2-NEXT:    [[TMP19:%.*]] = extractelement <16 x i16> [[TMP3]], i32 15
475; SSE2-NEXT:    [[V15:%.*]] = insertelement <16 x i16> [[V14]], i16 [[TMP19]], i32 15
476; SSE2-NEXT:    ret <16 x i16> [[V15]]
477;
478; SLM-LABEL: @loadext_16i8_to_16i16(
479; SLM-NEXT:    [[P1:%.*]] = getelementptr inbounds i8, i8* [[P0:%.*]], i64 1
480; SLM-NEXT:    [[P2:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 2
481; SLM-NEXT:    [[P3:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 3
482; SLM-NEXT:    [[P4:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 4
483; SLM-NEXT:    [[P5:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 5
484; SLM-NEXT:    [[P6:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 6
485; SLM-NEXT:    [[P7:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 7
486; SLM-NEXT:    [[P8:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 8
487; SLM-NEXT:    [[P9:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 9
488; SLM-NEXT:    [[P10:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 10
489; SLM-NEXT:    [[P11:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 11
490; SLM-NEXT:    [[P12:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 12
491; SLM-NEXT:    [[P13:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 13
492; SLM-NEXT:    [[P14:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 14
493; SLM-NEXT:    [[P15:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 15
494; SLM-NEXT:    [[I0:%.*]] = load i8, i8* [[P0]], align 1
495; SLM-NEXT:    [[I1:%.*]] = load i8, i8* [[P1]], align 1
496; SLM-NEXT:    [[I2:%.*]] = load i8, i8* [[P2]], align 1
497; SLM-NEXT:    [[I3:%.*]] = load i8, i8* [[P3]], align 1
498; SLM-NEXT:    [[I4:%.*]] = load i8, i8* [[P4]], align 1
499; SLM-NEXT:    [[I5:%.*]] = load i8, i8* [[P5]], align 1
500; SLM-NEXT:    [[I6:%.*]] = load i8, i8* [[P6]], align 1
501; SLM-NEXT:    [[I7:%.*]] = load i8, i8* [[P7]], align 1
502; SLM-NEXT:    [[I8:%.*]] = load i8, i8* [[P8]], align 1
503; SLM-NEXT:    [[I9:%.*]] = load i8, i8* [[P9]], align 1
504; SLM-NEXT:    [[I10:%.*]] = load i8, i8* [[P10]], align 1
505; SLM-NEXT:    [[I11:%.*]] = load i8, i8* [[P11]], align 1
506; SLM-NEXT:    [[I12:%.*]] = load i8, i8* [[P12]], align 1
507; SLM-NEXT:    [[I13:%.*]] = load i8, i8* [[P13]], align 1
508; SLM-NEXT:    [[I14:%.*]] = load i8, i8* [[P14]], align 1
509; SLM-NEXT:    [[I15:%.*]] = load i8, i8* [[P15]], align 1
510; SLM-NEXT:    [[X0:%.*]] = sext i8 [[I0]] to i16
511; SLM-NEXT:    [[X1:%.*]] = sext i8 [[I1]] to i16
512; SLM-NEXT:    [[X2:%.*]] = sext i8 [[I2]] to i16
513; SLM-NEXT:    [[X3:%.*]] = sext i8 [[I3]] to i16
514; SLM-NEXT:    [[X4:%.*]] = sext i8 [[I4]] to i16
515; SLM-NEXT:    [[X5:%.*]] = sext i8 [[I5]] to i16
516; SLM-NEXT:    [[X6:%.*]] = sext i8 [[I6]] to i16
517; SLM-NEXT:    [[X7:%.*]] = sext i8 [[I7]] to i16
518; SLM-NEXT:    [[X8:%.*]] = sext i8 [[I8]] to i16
519; SLM-NEXT:    [[X9:%.*]] = sext i8 [[I9]] to i16
520; SLM-NEXT:    [[X10:%.*]] = sext i8 [[I10]] to i16
521; SLM-NEXT:    [[X11:%.*]] = sext i8 [[I11]] to i16
522; SLM-NEXT:    [[X12:%.*]] = sext i8 [[I12]] to i16
523; SLM-NEXT:    [[X13:%.*]] = sext i8 [[I13]] to i16
524; SLM-NEXT:    [[X14:%.*]] = sext i8 [[I14]] to i16
525; SLM-NEXT:    [[X15:%.*]] = sext i8 [[I15]] to i16
526; SLM-NEXT:    [[V0:%.*]] = insertelement <16 x i16> undef, i16 [[X0]], i32 0
527; SLM-NEXT:    [[V1:%.*]] = insertelement <16 x i16> [[V0]], i16 [[X1]], i32 1
528; SLM-NEXT:    [[V2:%.*]] = insertelement <16 x i16> [[V1]], i16 [[X2]], i32 2
529; SLM-NEXT:    [[V3:%.*]] = insertelement <16 x i16> [[V2]], i16 [[X3]], i32 3
530; SLM-NEXT:    [[V4:%.*]] = insertelement <16 x i16> [[V3]], i16 [[X4]], i32 4
531; SLM-NEXT:    [[V5:%.*]] = insertelement <16 x i16> [[V4]], i16 [[X5]], i32 5
532; SLM-NEXT:    [[V6:%.*]] = insertelement <16 x i16> [[V5]], i16 [[X6]], i32 6
533; SLM-NEXT:    [[V7:%.*]] = insertelement <16 x i16> [[V6]], i16 [[X7]], i32 7
534; SLM-NEXT:    [[V8:%.*]] = insertelement <16 x i16> [[V7]], i16 [[X8]], i32 8
535; SLM-NEXT:    [[V9:%.*]] = insertelement <16 x i16> [[V8]], i16 [[X9]], i32 9
536; SLM-NEXT:    [[V10:%.*]] = insertelement <16 x i16> [[V9]], i16 [[X10]], i32 10
537; SLM-NEXT:    [[V11:%.*]] = insertelement <16 x i16> [[V10]], i16 [[X11]], i32 11
538; SLM-NEXT:    [[V12:%.*]] = insertelement <16 x i16> [[V11]], i16 [[X12]], i32 12
539; SLM-NEXT:    [[V13:%.*]] = insertelement <16 x i16> [[V12]], i16 [[X13]], i32 13
540; SLM-NEXT:    [[V14:%.*]] = insertelement <16 x i16> [[V13]], i16 [[X14]], i32 14
541; SLM-NEXT:    [[V15:%.*]] = insertelement <16 x i16> [[V14]], i16 [[X15]], i32 15
542; SLM-NEXT:    ret <16 x i16> [[V15]]
543;
544; AVX-LABEL: @loadext_16i8_to_16i16(
545; AVX-NEXT:    [[P1:%.*]] = getelementptr inbounds i8, i8* [[P0:%.*]], i64 1
546; AVX-NEXT:    [[P2:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 2
547; AVX-NEXT:    [[P3:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 3
548; AVX-NEXT:    [[P4:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 4
549; AVX-NEXT:    [[P5:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 5
550; AVX-NEXT:    [[P6:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 6
551; AVX-NEXT:    [[P7:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 7
552; AVX-NEXT:    [[P8:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 8
553; AVX-NEXT:    [[P9:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 9
554; AVX-NEXT:    [[P10:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 10
555; AVX-NEXT:    [[P11:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 11
556; AVX-NEXT:    [[P12:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 12
557; AVX-NEXT:    [[P13:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 13
558; AVX-NEXT:    [[P14:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 14
559; AVX-NEXT:    [[P15:%.*]] = getelementptr inbounds i8, i8* [[P0]], i64 15
560; AVX-NEXT:    [[TMP1:%.*]] = bitcast i8* [[P0]] to <16 x i8>*
561; AVX-NEXT:    [[TMP2:%.*]] = load <16 x i8>, <16 x i8>* [[TMP1]], align 1
562; AVX-NEXT:    [[TMP3:%.*]] = sext <16 x i8> [[TMP2]] to <16 x i16>
563; AVX-NEXT:    [[TMP4:%.*]] = extractelement <16 x i16> [[TMP3]], i32 0
564; AVX-NEXT:    [[V0:%.*]] = insertelement <16 x i16> undef, i16 [[TMP4]], i32 0
565; AVX-NEXT:    [[TMP5:%.*]] = extractelement <16 x i16> [[TMP3]], i32 1
566; AVX-NEXT:    [[V1:%.*]] = insertelement <16 x i16> [[V0]], i16 [[TMP5]], i32 1
567; AVX-NEXT:    [[TMP6:%.*]] = extractelement <16 x i16> [[TMP3]], i32 2
568; AVX-NEXT:    [[V2:%.*]] = insertelement <16 x i16> [[V1]], i16 [[TMP6]], i32 2
569; AVX-NEXT:    [[TMP7:%.*]] = extractelement <16 x i16> [[TMP3]], i32 3
570; AVX-NEXT:    [[V3:%.*]] = insertelement <16 x i16> [[V2]], i16 [[TMP7]], i32 3
571; AVX-NEXT:    [[TMP8:%.*]] = extractelement <16 x i16> [[TMP3]], i32 4
572; AVX-NEXT:    [[V4:%.*]] = insertelement <16 x i16> [[V3]], i16 [[TMP8]], i32 4
573; AVX-NEXT:    [[TMP9:%.*]] = extractelement <16 x i16> [[TMP3]], i32 5
574; AVX-NEXT:    [[V5:%.*]] = insertelement <16 x i16> [[V4]], i16 [[TMP9]], i32 5
575; AVX-NEXT:    [[TMP10:%.*]] = extractelement <16 x i16> [[TMP3]], i32 6
576; AVX-NEXT:    [[V6:%.*]] = insertelement <16 x i16> [[V5]], i16 [[TMP10]], i32 6
577; AVX-NEXT:    [[TMP11:%.*]] = extractelement <16 x i16> [[TMP3]], i32 7
578; AVX-NEXT:    [[V7:%.*]] = insertelement <16 x i16> [[V6]], i16 [[TMP11]], i32 7
579; AVX-NEXT:    [[TMP12:%.*]] = extractelement <16 x i16> [[TMP3]], i32 8
580; AVX-NEXT:    [[V8:%.*]] = insertelement <16 x i16> [[V7]], i16 [[TMP12]], i32 8
581; AVX-NEXT:    [[TMP13:%.*]] = extractelement <16 x i16> [[TMP3]], i32 9
582; AVX-NEXT:    [[V9:%.*]] = insertelement <16 x i16> [[V8]], i16 [[TMP13]], i32 9
583; AVX-NEXT:    [[TMP14:%.*]] = extractelement <16 x i16> [[TMP3]], i32 10
584; AVX-NEXT:    [[V10:%.*]] = insertelement <16 x i16> [[V9]], i16 [[TMP14]], i32 10
585; AVX-NEXT:    [[TMP15:%.*]] = extractelement <16 x i16> [[TMP3]], i32 11
586; AVX-NEXT:    [[V11:%.*]] = insertelement <16 x i16> [[V10]], i16 [[TMP15]], i32 11
587; AVX-NEXT:    [[TMP16:%.*]] = extractelement <16 x i16> [[TMP3]], i32 12
588; AVX-NEXT:    [[V12:%.*]] = insertelement <16 x i16> [[V11]], i16 [[TMP16]], i32 12
589; AVX-NEXT:    [[TMP17:%.*]] = extractelement <16 x i16> [[TMP3]], i32 13
590; AVX-NEXT:    [[V13:%.*]] = insertelement <16 x i16> [[V12]], i16 [[TMP17]], i32 13
591; AVX-NEXT:    [[TMP18:%.*]] = extractelement <16 x i16> [[TMP3]], i32 14
592; AVX-NEXT:    [[V14:%.*]] = insertelement <16 x i16> [[V13]], i16 [[TMP18]], i32 14
593; AVX-NEXT:    [[TMP19:%.*]] = extractelement <16 x i16> [[TMP3]], i32 15
594; AVX-NEXT:    [[V15:%.*]] = insertelement <16 x i16> [[V14]], i16 [[TMP19]], i32 15
595; AVX-NEXT:    ret <16 x i16> [[V15]]
596;
597  %p1  = getelementptr inbounds i8, i8* %p0, i64 1
598  %p2  = getelementptr inbounds i8, i8* %p0, i64 2
599  %p3  = getelementptr inbounds i8, i8* %p0, i64 3
600  %p4  = getelementptr inbounds i8, i8* %p0, i64 4
601  %p5  = getelementptr inbounds i8, i8* %p0, i64 5
602  %p6  = getelementptr inbounds i8, i8* %p0, i64 6
603  %p7  = getelementptr inbounds i8, i8* %p0, i64 7
604  %p8  = getelementptr inbounds i8, i8* %p0, i64 8
605  %p9  = getelementptr inbounds i8, i8* %p0, i64 9
606  %p10 = getelementptr inbounds i8, i8* %p0, i64 10
607  %p11 = getelementptr inbounds i8, i8* %p0, i64 11
608  %p12 = getelementptr inbounds i8, i8* %p0, i64 12
609  %p13 = getelementptr inbounds i8, i8* %p0, i64 13
610  %p14 = getelementptr inbounds i8, i8* %p0, i64 14
611  %p15 = getelementptr inbounds i8, i8* %p0, i64 15
612  %i0  = load i8, i8* %p0,  align 1
613  %i1  = load i8, i8* %p1,  align 1
614  %i2  = load i8, i8* %p2,  align 1
615  %i3  = load i8, i8* %p3,  align 1
616  %i4  = load i8, i8* %p4,  align 1
617  %i5  = load i8, i8* %p5,  align 1
618  %i6  = load i8, i8* %p6,  align 1
619  %i7  = load i8, i8* %p7,  align 1
620  %i8  = load i8, i8* %p8,  align 1
621  %i9  = load i8, i8* %p9,  align 1
622  %i10 = load i8, i8* %p10, align 1
623  %i11 = load i8, i8* %p11, align 1
624  %i12 = load i8, i8* %p12, align 1
625  %i13 = load i8, i8* %p13, align 1
626  %i14 = load i8, i8* %p14, align 1
627  %i15 = load i8, i8* %p15, align 1
628  %x0  = sext i8 %i0  to i16
629  %x1  = sext i8 %i1  to i16
630  %x2  = sext i8 %i2  to i16
631  %x3  = sext i8 %i3  to i16
632  %x4  = sext i8 %i4  to i16
633  %x5  = sext i8 %i5  to i16
634  %x6  = sext i8 %i6  to i16
635  %x7  = sext i8 %i7  to i16
636  %x8  = sext i8 %i8  to i16
637  %x9  = sext i8 %i9  to i16
638  %x10 = sext i8 %i10 to i16
639  %x11 = sext i8 %i11 to i16
640  %x12 = sext i8 %i12 to i16
641  %x13 = sext i8 %i13 to i16
642  %x14 = sext i8 %i14 to i16
643  %x15 = sext i8 %i15 to i16
644  %v0  = insertelement <16 x i16> undef, i16 %x0,  i32 0
645  %v1  = insertelement <16 x i16>  %v0,  i16 %x1,  i32 1
646  %v2  = insertelement <16 x i16>  %v1,  i16 %x2,  i32 2
647  %v3  = insertelement <16 x i16>  %v2,  i16 %x3,  i32 3
648  %v4  = insertelement <16 x i16>  %v3,  i16 %x4,  i32 4
649  %v5  = insertelement <16 x i16>  %v4,  i16 %x5,  i32 5
650  %v6  = insertelement <16 x i16>  %v5,  i16 %x6,  i32 6
651  %v7  = insertelement <16 x i16>  %v6,  i16 %x7,  i32 7
652  %v8  = insertelement <16 x i16>  %v7,  i16 %x8,  i32 8
653  %v9  = insertelement <16 x i16>  %v8,  i16 %x9,  i32 9
654  %v10 = insertelement <16 x i16>  %v9,  i16 %x10, i32 10
655  %v11 = insertelement <16 x i16>  %v10, i16 %x11, i32 11
656  %v12 = insertelement <16 x i16>  %v11, i16 %x12, i32 12
657  %v13 = insertelement <16 x i16>  %v12, i16 %x13, i32 13
658  %v14 = insertelement <16 x i16>  %v13, i16 %x14, i32 14
659  %v15 = insertelement <16 x i16>  %v14, i16 %x15, i32 15
660  ret <16 x i16> %v15
661}
662
663;
664; vXi16
665;
666
667define <2 x i64> @loadext_2i16_to_2i64(i16* %p0) {
668; SSE-LABEL: @loadext_2i16_to_2i64(
669; SSE-NEXT:    [[P1:%.*]] = getelementptr inbounds i16, i16* [[P0:%.*]], i64 1
670; SSE-NEXT:    [[I0:%.*]] = load i16, i16* [[P0]], align 1
671; SSE-NEXT:    [[I1:%.*]] = load i16, i16* [[P1]], align 1
672; SSE-NEXT:    [[X0:%.*]] = sext i16 [[I0]] to i64
673; SSE-NEXT:    [[X1:%.*]] = sext i16 [[I1]] to i64
674; SSE-NEXT:    [[V0:%.*]] = insertelement <2 x i64> undef, i64 [[X0]], i32 0
675; SSE-NEXT:    [[V1:%.*]] = insertelement <2 x i64> [[V0]], i64 [[X1]], i32 1
676; SSE-NEXT:    ret <2 x i64> [[V1]]
677;
678; AVX-LABEL: @loadext_2i16_to_2i64(
679; AVX-NEXT:    [[P1:%.*]] = getelementptr inbounds i16, i16* [[P0:%.*]], i64 1
680; AVX-NEXT:    [[TMP1:%.*]] = bitcast i16* [[P0]] to <2 x i16>*
681; AVX-NEXT:    [[TMP2:%.*]] = load <2 x i16>, <2 x i16>* [[TMP1]], align 1
682; AVX-NEXT:    [[TMP3:%.*]] = sext <2 x i16> [[TMP2]] to <2 x i64>
683; AVX-NEXT:    [[TMP4:%.*]] = extractelement <2 x i64> [[TMP3]], i32 0
684; AVX-NEXT:    [[V0:%.*]] = insertelement <2 x i64> undef, i64 [[TMP4]], i32 0
685; AVX-NEXT:    [[TMP5:%.*]] = extractelement <2 x i64> [[TMP3]], i32 1
686; AVX-NEXT:    [[V1:%.*]] = insertelement <2 x i64> [[V0]], i64 [[TMP5]], i32 1
687; AVX-NEXT:    ret <2 x i64> [[V1]]
688;
689  %p1 = getelementptr inbounds i16, i16* %p0, i64 1
690  %i0 = load i16, i16* %p0, align 1
691  %i1 = load i16, i16* %p1, align 1
692  %x0 = sext i16 %i0 to i64
693  %x1 = sext i16 %i1 to i64
694  %v0 = insertelement <2 x i64> undef, i64 %x0, i32 0
695  %v1 = insertelement <2 x i64>   %v0, i64 %x1, i32 1
696  ret <2 x i64> %v1
697}
698
699define <4 x i32> @loadext_4i16_to_4i32(i16* %p0) {
700; SSE2-LABEL: @loadext_4i16_to_4i32(
701; SSE2-NEXT:    [[P1:%.*]] = getelementptr inbounds i16, i16* [[P0:%.*]], i64 1
702; SSE2-NEXT:    [[P2:%.*]] = getelementptr inbounds i16, i16* [[P0]], i64 2
703; SSE2-NEXT:    [[P3:%.*]] = getelementptr inbounds i16, i16* [[P0]], i64 3
704; SSE2-NEXT:    [[TMP1:%.*]] = bitcast i16* [[P0]] to <4 x i16>*
705; SSE2-NEXT:    [[TMP2:%.*]] = load <4 x i16>, <4 x i16>* [[TMP1]], align 1
706; SSE2-NEXT:    [[TMP3:%.*]] = sext <4 x i16> [[TMP2]] to <4 x i32>
707; SSE2-NEXT:    [[TMP4:%.*]] = extractelement <4 x i32> [[TMP3]], i32 0
708; SSE2-NEXT:    [[V0:%.*]] = insertelement <4 x i32> undef, i32 [[TMP4]], i32 0
709; SSE2-NEXT:    [[TMP5:%.*]] = extractelement <4 x i32> [[TMP3]], i32 1
710; SSE2-NEXT:    [[V1:%.*]] = insertelement <4 x i32> [[V0]], i32 [[TMP5]], i32 1
711; SSE2-NEXT:    [[TMP6:%.*]] = extractelement <4 x i32> [[TMP3]], i32 2
712; SSE2-NEXT:    [[V2:%.*]] = insertelement <4 x i32> [[V1]], i32 [[TMP6]], i32 2
713; SSE2-NEXT:    [[TMP7:%.*]] = extractelement <4 x i32> [[TMP3]], i32 3
714; SSE2-NEXT:    [[V3:%.*]] = insertelement <4 x i32> [[V2]], i32 [[TMP7]], i32 3
715; SSE2-NEXT:    ret <4 x i32> [[V3]]
716;
717; SLM-LABEL: @loadext_4i16_to_4i32(
718; SLM-NEXT:    [[P1:%.*]] = getelementptr inbounds i16, i16* [[P0:%.*]], i64 1
719; SLM-NEXT:    [[P2:%.*]] = getelementptr inbounds i16, i16* [[P0]], i64 2
720; SLM-NEXT:    [[P3:%.*]] = getelementptr inbounds i16, i16* [[P0]], i64 3
721; SLM-NEXT:    [[I0:%.*]] = load i16, i16* [[P0]], align 1
722; SLM-NEXT:    [[I1:%.*]] = load i16, i16* [[P1]], align 1
723; SLM-NEXT:    [[I2:%.*]] = load i16, i16* [[P2]], align 1
724; SLM-NEXT:    [[I3:%.*]] = load i16, i16* [[P3]], align 1
725; SLM-NEXT:    [[X0:%.*]] = sext i16 [[I0]] to i32
726; SLM-NEXT:    [[X1:%.*]] = sext i16 [[I1]] to i32
727; SLM-NEXT:    [[X2:%.*]] = sext i16 [[I2]] to i32
728; SLM-NEXT:    [[X3:%.*]] = sext i16 [[I3]] to i32
729; SLM-NEXT:    [[V0:%.*]] = insertelement <4 x i32> undef, i32 [[X0]], i32 0
730; SLM-NEXT:    [[V1:%.*]] = insertelement <4 x i32> [[V0]], i32 [[X1]], i32 1
731; SLM-NEXT:    [[V2:%.*]] = insertelement <4 x i32> [[V1]], i32 [[X2]], i32 2
732; SLM-NEXT:    [[V3:%.*]] = insertelement <4 x i32> [[V2]], i32 [[X3]], i32 3
733; SLM-NEXT:    ret <4 x i32> [[V3]]
734;
735; AVX-LABEL: @loadext_4i16_to_4i32(
736; AVX-NEXT:    [[P1:%.*]] = getelementptr inbounds i16, i16* [[P0:%.*]], i64 1
737; AVX-NEXT:    [[P2:%.*]] = getelementptr inbounds i16, i16* [[P0]], i64 2
738; AVX-NEXT:    [[P3:%.*]] = getelementptr inbounds i16, i16* [[P0]], i64 3
739; AVX-NEXT:    [[TMP1:%.*]] = bitcast i16* [[P0]] to <4 x i16>*
740; AVX-NEXT:    [[TMP2:%.*]] = load <4 x i16>, <4 x i16>* [[TMP1]], align 1
741; AVX-NEXT:    [[TMP3:%.*]] = sext <4 x i16> [[TMP2]] to <4 x i32>
742; AVX-NEXT:    [[TMP4:%.*]] = extractelement <4 x i32> [[TMP3]], i32 0
743; AVX-NEXT:    [[V0:%.*]] = insertelement <4 x i32> undef, i32 [[TMP4]], i32 0
744; AVX-NEXT:    [[TMP5:%.*]] = extractelement <4 x i32> [[TMP3]], i32 1
745; AVX-NEXT:    [[V1:%.*]] = insertelement <4 x i32> [[V0]], i32 [[TMP5]], i32 1
746; AVX-NEXT:    [[TMP6:%.*]] = extractelement <4 x i32> [[TMP3]], i32 2
747; AVX-NEXT:    [[V2:%.*]] = insertelement <4 x i32> [[V1]], i32 [[TMP6]], i32 2
748; AVX-NEXT:    [[TMP7:%.*]] = extractelement <4 x i32> [[TMP3]], i32 3
749; AVX-NEXT:    [[V3:%.*]] = insertelement <4 x i32> [[V2]], i32 [[TMP7]], i32 3
750; AVX-NEXT:    ret <4 x i32> [[V3]]
751;
752  %p1 = getelementptr inbounds i16, i16* %p0, i64 1
753  %p2 = getelementptr inbounds i16, i16* %p0, i64 2
754  %p3 = getelementptr inbounds i16, i16* %p0, i64 3
755  %i0 = load i16, i16* %p0, align 1
756  %i1 = load i16, i16* %p1, align 1
757  %i2 = load i16, i16* %p2, align 1
758  %i3 = load i16, i16* %p3, align 1
759  %x0 = sext i16 %i0 to i32
760  %x1 = sext i16 %i1 to i32
761  %x2 = sext i16 %i2 to i32
762  %x3 = sext i16 %i3 to i32
763  %v0 = insertelement <4 x i32> undef, i32 %x0, i32 0
764  %v1 = insertelement <4 x i32>   %v0, i32 %x1, i32 1
765  %v2 = insertelement <4 x i32>   %v1, i32 %x2, i32 2
766  %v3 = insertelement <4 x i32>   %v2, i32 %x3, i32 3
767  ret <4 x i32> %v3
768}
769
770define <4 x i64> @loadext_4i16_to_4i64(i16* %p0) {
771; SSE-LABEL: @loadext_4i16_to_4i64(
772; SSE-NEXT:    [[P1:%.*]] = getelementptr inbounds i16, i16* [[P0:%.*]], i64 1
773; SSE-NEXT:    [[P2:%.*]] = getelementptr inbounds i16, i16* [[P0]], i64 2
774; SSE-NEXT:    [[P3:%.*]] = getelementptr inbounds i16, i16* [[P0]], i64 3
775; SSE-NEXT:    [[I0:%.*]] = load i16, i16* [[P0]], align 1
776; SSE-NEXT:    [[I1:%.*]] = load i16, i16* [[P1]], align 1
777; SSE-NEXT:    [[I2:%.*]] = load i16, i16* [[P2]], align 1
778; SSE-NEXT:    [[I3:%.*]] = load i16, i16* [[P3]], align 1
779; SSE-NEXT:    [[X0:%.*]] = sext i16 [[I0]] to i64
780; SSE-NEXT:    [[X1:%.*]] = sext i16 [[I1]] to i64
781; SSE-NEXT:    [[X2:%.*]] = sext i16 [[I2]] to i64
782; SSE-NEXT:    [[X3:%.*]] = sext i16 [[I3]] to i64
783; SSE-NEXT:    [[V0:%.*]] = insertelement <4 x i64> undef, i64 [[X0]], i32 0
784; SSE-NEXT:    [[V1:%.*]] = insertelement <4 x i64> [[V0]], i64 [[X1]], i32 1
785; SSE-NEXT:    [[V2:%.*]] = insertelement <4 x i64> [[V1]], i64 [[X2]], i32 2
786; SSE-NEXT:    [[V3:%.*]] = insertelement <4 x i64> [[V2]], i64 [[X3]], i32 3
787; SSE-NEXT:    ret <4 x i64> [[V3]]
788;
789; AVX-LABEL: @loadext_4i16_to_4i64(
790; AVX-NEXT:    [[P1:%.*]] = getelementptr inbounds i16, i16* [[P0:%.*]], i64 1
791; AVX-NEXT:    [[P2:%.*]] = getelementptr inbounds i16, i16* [[P0]], i64 2
792; AVX-NEXT:    [[P3:%.*]] = getelementptr inbounds i16, i16* [[P0]], i64 3
793; AVX-NEXT:    [[TMP1:%.*]] = bitcast i16* [[P0]] to <4 x i16>*
794; AVX-NEXT:    [[TMP2:%.*]] = load <4 x i16>, <4 x i16>* [[TMP1]], align 1
795; AVX-NEXT:    [[TMP3:%.*]] = sext <4 x i16> [[TMP2]] to <4 x i64>
796; AVX-NEXT:    [[TMP4:%.*]] = extractelement <4 x i64> [[TMP3]], i32 0
797; AVX-NEXT:    [[V0:%.*]] = insertelement <4 x i64> undef, i64 [[TMP4]], i32 0
798; AVX-NEXT:    [[TMP5:%.*]] = extractelement <4 x i64> [[TMP3]], i32 1
799; AVX-NEXT:    [[V1:%.*]] = insertelement <4 x i64> [[V0]], i64 [[TMP5]], i32 1
800; AVX-NEXT:    [[TMP6:%.*]] = extractelement <4 x i64> [[TMP3]], i32 2
801; AVX-NEXT:    [[V2:%.*]] = insertelement <4 x i64> [[V1]], i64 [[TMP6]], i32 2
802; AVX-NEXT:    [[TMP7:%.*]] = extractelement <4 x i64> [[TMP3]], i32 3
803; AVX-NEXT:    [[V3:%.*]] = insertelement <4 x i64> [[V2]], i64 [[TMP7]], i32 3
804; AVX-NEXT:    ret <4 x i64> [[V3]]
805;
806  %p1 = getelementptr inbounds i16, i16* %p0, i64 1
807  %p2 = getelementptr inbounds i16, i16* %p0, i64 2
808  %p3 = getelementptr inbounds i16, i16* %p0, i64 3
809  %i0 = load i16, i16* %p0, align 1
810  %i1 = load i16, i16* %p1, align 1
811  %i2 = load i16, i16* %p2, align 1
812  %i3 = load i16, i16* %p3, align 1
813  %x0 = sext i16 %i0 to i64
814  %x1 = sext i16 %i1 to i64
815  %x2 = sext i16 %i2 to i64
816  %x3 = sext i16 %i3 to i64
817  %v0 = insertelement <4 x i64> undef, i64 %x0, i32 0
818  %v1 = insertelement <4 x i64>   %v0, i64 %x1, i32 1
819  %v2 = insertelement <4 x i64>   %v1, i64 %x2, i32 2
820  %v3 = insertelement <4 x i64>   %v2, i64 %x3, i32 3
821  ret <4 x i64> %v3
822}
823
824define <8 x i32> @loadext_8i16_to_8i32(i16* %p0) {
825; SSE2-LABEL: @loadext_8i16_to_8i32(
826; SSE2-NEXT:    [[P1:%.*]] = getelementptr inbounds i16, i16* [[P0:%.*]], i64 1
827; SSE2-NEXT:    [[P2:%.*]] = getelementptr inbounds i16, i16* [[P0]], i64 2
828; SSE2-NEXT:    [[P3:%.*]] = getelementptr inbounds i16, i16* [[P0]], i64 3
829; SSE2-NEXT:    [[P4:%.*]] = getelementptr inbounds i16, i16* [[P0]], i64 4
830; SSE2-NEXT:    [[P5:%.*]] = getelementptr inbounds i16, i16* [[P0]], i64 5
831; SSE2-NEXT:    [[P6:%.*]] = getelementptr inbounds i16, i16* [[P0]], i64 6
832; SSE2-NEXT:    [[P7:%.*]] = getelementptr inbounds i16, i16* [[P0]], i64 7
833; SSE2-NEXT:    [[TMP1:%.*]] = bitcast i16* [[P0]] to <8 x i16>*
834; SSE2-NEXT:    [[TMP2:%.*]] = load <8 x i16>, <8 x i16>* [[TMP1]], align 1
835; SSE2-NEXT:    [[TMP3:%.*]] = sext <8 x i16> [[TMP2]] to <8 x i32>
836; SSE2-NEXT:    [[TMP4:%.*]] = extractelement <8 x i32> [[TMP3]], i32 0
837; SSE2-NEXT:    [[V0:%.*]] = insertelement <8 x i32> undef, i32 [[TMP4]], i32 0
838; SSE2-NEXT:    [[TMP5:%.*]] = extractelement <8 x i32> [[TMP3]], i32 1
839; SSE2-NEXT:    [[V1:%.*]] = insertelement <8 x i32> [[V0]], i32 [[TMP5]], i32 1
840; SSE2-NEXT:    [[TMP6:%.*]] = extractelement <8 x i32> [[TMP3]], i32 2
841; SSE2-NEXT:    [[V2:%.*]] = insertelement <8 x i32> [[V1]], i32 [[TMP6]], i32 2
842; SSE2-NEXT:    [[TMP7:%.*]] = extractelement <8 x i32> [[TMP3]], i32 3
843; SSE2-NEXT:    [[V3:%.*]] = insertelement <8 x i32> [[V2]], i32 [[TMP7]], i32 3
844; SSE2-NEXT:    [[TMP8:%.*]] = extractelement <8 x i32> [[TMP3]], i32 4
845; SSE2-NEXT:    [[V4:%.*]] = insertelement <8 x i32> [[V3]], i32 [[TMP8]], i32 4
846; SSE2-NEXT:    [[TMP9:%.*]] = extractelement <8 x i32> [[TMP3]], i32 5
847; SSE2-NEXT:    [[V5:%.*]] = insertelement <8 x i32> [[V4]], i32 [[TMP9]], i32 5
848; SSE2-NEXT:    [[TMP10:%.*]] = extractelement <8 x i32> [[TMP3]], i32 6
849; SSE2-NEXT:    [[V6:%.*]] = insertelement <8 x i32> [[V5]], i32 [[TMP10]], i32 6
850; SSE2-NEXT:    [[TMP11:%.*]] = extractelement <8 x i32> [[TMP3]], i32 7
851; SSE2-NEXT:    [[V7:%.*]] = insertelement <8 x i32> [[V6]], i32 [[TMP11]], i32 7
852; SSE2-NEXT:    ret <8 x i32> [[V7]]
853;
854; SLM-LABEL: @loadext_8i16_to_8i32(
855; SLM-NEXT:    [[P1:%.*]] = getelementptr inbounds i16, i16* [[P0:%.*]], i64 1
856; SLM-NEXT:    [[P2:%.*]] = getelementptr inbounds i16, i16* [[P0]], i64 2
857; SLM-NEXT:    [[P3:%.*]] = getelementptr inbounds i16, i16* [[P0]], i64 3
858; SLM-NEXT:    [[P4:%.*]] = getelementptr inbounds i16, i16* [[P0]], i64 4
859; SLM-NEXT:    [[P5:%.*]] = getelementptr inbounds i16, i16* [[P0]], i64 5
860; SLM-NEXT:    [[P6:%.*]] = getelementptr inbounds i16, i16* [[P0]], i64 6
861; SLM-NEXT:    [[P7:%.*]] = getelementptr inbounds i16, i16* [[P0]], i64 7
862; SLM-NEXT:    [[I0:%.*]] = load i16, i16* [[P0]], align 1
863; SLM-NEXT:    [[I1:%.*]] = load i16, i16* [[P1]], align 1
864; SLM-NEXT:    [[I2:%.*]] = load i16, i16* [[P2]], align 1
865; SLM-NEXT:    [[I3:%.*]] = load i16, i16* [[P3]], align 1
866; SLM-NEXT:    [[I4:%.*]] = load i16, i16* [[P4]], align 1
867; SLM-NEXT:    [[I5:%.*]] = load i16, i16* [[P5]], align 1
868; SLM-NEXT:    [[I6:%.*]] = load i16, i16* [[P6]], align 1
869; SLM-NEXT:    [[I7:%.*]] = load i16, i16* [[P7]], align 1
870; SLM-NEXT:    [[X0:%.*]] = sext i16 [[I0]] to i32
871; SLM-NEXT:    [[X1:%.*]] = sext i16 [[I1]] to i32
872; SLM-NEXT:    [[X2:%.*]] = sext i16 [[I2]] to i32
873; SLM-NEXT:    [[X3:%.*]] = sext i16 [[I3]] to i32
874; SLM-NEXT:    [[X4:%.*]] = sext i16 [[I4]] to i32
875; SLM-NEXT:    [[X5:%.*]] = sext i16 [[I5]] to i32
876; SLM-NEXT:    [[X6:%.*]] = sext i16 [[I6]] to i32
877; SLM-NEXT:    [[X7:%.*]] = sext i16 [[I7]] to i32
878; SLM-NEXT:    [[V0:%.*]] = insertelement <8 x i32> undef, i32 [[X0]], i32 0
879; SLM-NEXT:    [[V1:%.*]] = insertelement <8 x i32> [[V0]], i32 [[X1]], i32 1
880; SLM-NEXT:    [[V2:%.*]] = insertelement <8 x i32> [[V1]], i32 [[X2]], i32 2
881; SLM-NEXT:    [[V3:%.*]] = insertelement <8 x i32> [[V2]], i32 [[X3]], i32 3
882; SLM-NEXT:    [[V4:%.*]] = insertelement <8 x i32> [[V3]], i32 [[X4]], i32 4
883; SLM-NEXT:    [[V5:%.*]] = insertelement <8 x i32> [[V4]], i32 [[X5]], i32 5
884; SLM-NEXT:    [[V6:%.*]] = insertelement <8 x i32> [[V5]], i32 [[X6]], i32 6
885; SLM-NEXT:    [[V7:%.*]] = insertelement <8 x i32> [[V6]], i32 [[X7]], i32 7
886; SLM-NEXT:    ret <8 x i32> [[V7]]
887;
888; AVX-LABEL: @loadext_8i16_to_8i32(
889; AVX-NEXT:    [[P1:%.*]] = getelementptr inbounds i16, i16* [[P0:%.*]], i64 1
890; AVX-NEXT:    [[P2:%.*]] = getelementptr inbounds i16, i16* [[P0]], i64 2
891; AVX-NEXT:    [[P3:%.*]] = getelementptr inbounds i16, i16* [[P0]], i64 3
892; AVX-NEXT:    [[P4:%.*]] = getelementptr inbounds i16, i16* [[P0]], i64 4
893; AVX-NEXT:    [[P5:%.*]] = getelementptr inbounds i16, i16* [[P0]], i64 5
894; AVX-NEXT:    [[P6:%.*]] = getelementptr inbounds i16, i16* [[P0]], i64 6
895; AVX-NEXT:    [[P7:%.*]] = getelementptr inbounds i16, i16* [[P0]], i64 7
896; AVX-NEXT:    [[TMP1:%.*]] = bitcast i16* [[P0]] to <8 x i16>*
897; AVX-NEXT:    [[TMP2:%.*]] = load <8 x i16>, <8 x i16>* [[TMP1]], align 1
898; AVX-NEXT:    [[TMP3:%.*]] = sext <8 x i16> [[TMP2]] to <8 x i32>
899; AVX-NEXT:    [[TMP4:%.*]] = extractelement <8 x i32> [[TMP3]], i32 0
900; AVX-NEXT:    [[V0:%.*]] = insertelement <8 x i32> undef, i32 [[TMP4]], i32 0
901; AVX-NEXT:    [[TMP5:%.*]] = extractelement <8 x i32> [[TMP3]], i32 1
902; AVX-NEXT:    [[V1:%.*]] = insertelement <8 x i32> [[V0]], i32 [[TMP5]], i32 1
903; AVX-NEXT:    [[TMP6:%.*]] = extractelement <8 x i32> [[TMP3]], i32 2
904; AVX-NEXT:    [[V2:%.*]] = insertelement <8 x i32> [[V1]], i32 [[TMP6]], i32 2
905; AVX-NEXT:    [[TMP7:%.*]] = extractelement <8 x i32> [[TMP3]], i32 3
906; AVX-NEXT:    [[V3:%.*]] = insertelement <8 x i32> [[V2]], i32 [[TMP7]], i32 3
907; AVX-NEXT:    [[TMP8:%.*]] = extractelement <8 x i32> [[TMP3]], i32 4
908; AVX-NEXT:    [[V4:%.*]] = insertelement <8 x i32> [[V3]], i32 [[TMP8]], i32 4
909; AVX-NEXT:    [[TMP9:%.*]] = extractelement <8 x i32> [[TMP3]], i32 5
910; AVX-NEXT:    [[V5:%.*]] = insertelement <8 x i32> [[V4]], i32 [[TMP9]], i32 5
911; AVX-NEXT:    [[TMP10:%.*]] = extractelement <8 x i32> [[TMP3]], i32 6
912; AVX-NEXT:    [[V6:%.*]] = insertelement <8 x i32> [[V5]], i32 [[TMP10]], i32 6
913; AVX-NEXT:    [[TMP11:%.*]] = extractelement <8 x i32> [[TMP3]], i32 7
914; AVX-NEXT:    [[V7:%.*]] = insertelement <8 x i32> [[V6]], i32 [[TMP11]], i32 7
915; AVX-NEXT:    ret <8 x i32> [[V7]]
916;
917  %p1 = getelementptr inbounds i16, i16* %p0, i64 1
918  %p2 = getelementptr inbounds i16, i16* %p0, i64 2
919  %p3 = getelementptr inbounds i16, i16* %p0, i64 3
920  %p4 = getelementptr inbounds i16, i16* %p0, i64 4
921  %p5 = getelementptr inbounds i16, i16* %p0, i64 5
922  %p6 = getelementptr inbounds i16, i16* %p0, i64 6
923  %p7 = getelementptr inbounds i16, i16* %p0, i64 7
924  %i0 = load i16, i16* %p0, align 1
925  %i1 = load i16, i16* %p1, align 1
926  %i2 = load i16, i16* %p2, align 1
927  %i3 = load i16, i16* %p3, align 1
928  %i4 = load i16, i16* %p4, align 1
929  %i5 = load i16, i16* %p5, align 1
930  %i6 = load i16, i16* %p6, align 1
931  %i7 = load i16, i16* %p7, align 1
932  %x0 = sext i16 %i0 to i32
933  %x1 = sext i16 %i1 to i32
934  %x2 = sext i16 %i2 to i32
935  %x3 = sext i16 %i3 to i32
936  %x4 = sext i16 %i4 to i32
937  %x5 = sext i16 %i5 to i32
938  %x6 = sext i16 %i6 to i32
939  %x7 = sext i16 %i7 to i32
940  %v0 = insertelement <8 x i32> undef, i32 %x0, i32 0
941  %v1 = insertelement <8 x i32>   %v0, i32 %x1, i32 1
942  %v2 = insertelement <8 x i32>   %v1, i32 %x2, i32 2
943  %v3 = insertelement <8 x i32>   %v2, i32 %x3, i32 3
944  %v4 = insertelement <8 x i32>   %v3, i32 %x4, i32 4
945  %v5 = insertelement <8 x i32>   %v4, i32 %x5, i32 5
946  %v6 = insertelement <8 x i32>   %v5, i32 %x6, i32 6
947  %v7 = insertelement <8 x i32>   %v6, i32 %x7, i32 7
948  ret <8 x i32> %v7
949}
950
951;
952; vXi32
953;
954
955define <2 x i64> @loadext_2i32_to_2i64(i32* %p0) {
956; SSE-LABEL: @loadext_2i32_to_2i64(
957; SSE-NEXT:    [[P1:%.*]] = getelementptr inbounds i32, i32* [[P0:%.*]], i64 1
958; SSE-NEXT:    [[I0:%.*]] = load i32, i32* [[P0]], align 1
959; SSE-NEXT:    [[I1:%.*]] = load i32, i32* [[P1]], align 1
960; SSE-NEXT:    [[X0:%.*]] = sext i32 [[I0]] to i64
961; SSE-NEXT:    [[X1:%.*]] = sext i32 [[I1]] to i64
962; SSE-NEXT:    [[V0:%.*]] = insertelement <2 x i64> undef, i64 [[X0]], i32 0
963; SSE-NEXT:    [[V1:%.*]] = insertelement <2 x i64> [[V0]], i64 [[X1]], i32 1
964; SSE-NEXT:    ret <2 x i64> [[V1]]
965;
966; AVX-LABEL: @loadext_2i32_to_2i64(
967; AVX-NEXT:    [[P1:%.*]] = getelementptr inbounds i32, i32* [[P0:%.*]], i64 1
968; AVX-NEXT:    [[TMP1:%.*]] = bitcast i32* [[P0]] to <2 x i32>*
969; AVX-NEXT:    [[TMP2:%.*]] = load <2 x i32>, <2 x i32>* [[TMP1]], align 1
970; AVX-NEXT:    [[TMP3:%.*]] = sext <2 x i32> [[TMP2]] to <2 x i64>
971; AVX-NEXT:    [[TMP4:%.*]] = extractelement <2 x i64> [[TMP3]], i32 0
972; AVX-NEXT:    [[V0:%.*]] = insertelement <2 x i64> undef, i64 [[TMP4]], i32 0
973; AVX-NEXT:    [[TMP5:%.*]] = extractelement <2 x i64> [[TMP3]], i32 1
974; AVX-NEXT:    [[V1:%.*]] = insertelement <2 x i64> [[V0]], i64 [[TMP5]], i32 1
975; AVX-NEXT:    ret <2 x i64> [[V1]]
976;
977  %p1 = getelementptr inbounds i32, i32* %p0, i64 1
978  %i0 = load i32, i32* %p0, align 1
979  %i1 = load i32, i32* %p1, align 1
980  %x0 = sext i32 %i0 to i64
981  %x1 = sext i32 %i1 to i64
982  %v0 = insertelement <2 x i64> undef, i64 %x0, i32 0
983  %v1 = insertelement <2 x i64>   %v0, i64 %x1, i32 1
984  ret <2 x i64> %v1
985}
986
987define <4 x i64> @loadext_4i32_to_4i64(i32* %p0) {
988; SSE-LABEL: @loadext_4i32_to_4i64(
989; SSE-NEXT:    [[P1:%.*]] = getelementptr inbounds i32, i32* [[P0:%.*]], i64 1
990; SSE-NEXT:    [[P2:%.*]] = getelementptr inbounds i32, i32* [[P0]], i64 2
991; SSE-NEXT:    [[P3:%.*]] = getelementptr inbounds i32, i32* [[P0]], i64 3
992; SSE-NEXT:    [[I0:%.*]] = load i32, i32* [[P0]], align 1
993; SSE-NEXT:    [[I1:%.*]] = load i32, i32* [[P1]], align 1
994; SSE-NEXT:    [[I2:%.*]] = load i32, i32* [[P2]], align 1
995; SSE-NEXT:    [[I3:%.*]] = load i32, i32* [[P3]], align 1
996; SSE-NEXT:    [[X0:%.*]] = sext i32 [[I0]] to i64
997; SSE-NEXT:    [[X1:%.*]] = sext i32 [[I1]] to i64
998; SSE-NEXT:    [[X2:%.*]] = sext i32 [[I2]] to i64
999; SSE-NEXT:    [[X3:%.*]] = sext i32 [[I3]] to i64
1000; SSE-NEXT:    [[V0:%.*]] = insertelement <4 x i64> undef, i64 [[X0]], i32 0
1001; SSE-NEXT:    [[V1:%.*]] = insertelement <4 x i64> [[V0]], i64 [[X1]], i32 1
1002; SSE-NEXT:    [[V2:%.*]] = insertelement <4 x i64> [[V1]], i64 [[X2]], i32 2
1003; SSE-NEXT:    [[V3:%.*]] = insertelement <4 x i64> [[V2]], i64 [[X3]], i32 3
1004; SSE-NEXT:    ret <4 x i64> [[V3]]
1005;
1006; AVX-LABEL: @loadext_4i32_to_4i64(
1007; AVX-NEXT:    [[P1:%.*]] = getelementptr inbounds i32, i32* [[P0:%.*]], i64 1
1008; AVX-NEXT:    [[P2:%.*]] = getelementptr inbounds i32, i32* [[P0]], i64 2
1009; AVX-NEXT:    [[P3:%.*]] = getelementptr inbounds i32, i32* [[P0]], i64 3
1010; AVX-NEXT:    [[TMP1:%.*]] = bitcast i32* [[P0]] to <4 x i32>*
1011; AVX-NEXT:    [[TMP2:%.*]] = load <4 x i32>, <4 x i32>* [[TMP1]], align 1
1012; AVX-NEXT:    [[TMP3:%.*]] = sext <4 x i32> [[TMP2]] to <4 x i64>
1013; AVX-NEXT:    [[TMP4:%.*]] = extractelement <4 x i64> [[TMP3]], i32 0
1014; AVX-NEXT:    [[V0:%.*]] = insertelement <4 x i64> undef, i64 [[TMP4]], i32 0
1015; AVX-NEXT:    [[TMP5:%.*]] = extractelement <4 x i64> [[TMP3]], i32 1
1016; AVX-NEXT:    [[V1:%.*]] = insertelement <4 x i64> [[V0]], i64 [[TMP5]], i32 1
1017; AVX-NEXT:    [[TMP6:%.*]] = extractelement <4 x i64> [[TMP3]], i32 2
1018; AVX-NEXT:    [[V2:%.*]] = insertelement <4 x i64> [[V1]], i64 [[TMP6]], i32 2
1019; AVX-NEXT:    [[TMP7:%.*]] = extractelement <4 x i64> [[TMP3]], i32 3
1020; AVX-NEXT:    [[V3:%.*]] = insertelement <4 x i64> [[V2]], i64 [[TMP7]], i32 3
1021; AVX-NEXT:    ret <4 x i64> [[V3]]
1022;
1023  %p1 = getelementptr inbounds i32, i32* %p0, i64 1
1024  %p2 = getelementptr inbounds i32, i32* %p0, i64 2
1025  %p3 = getelementptr inbounds i32, i32* %p0, i64 3
1026  %i0 = load i32, i32* %p0, align 1
1027  %i1 = load i32, i32* %p1, align 1
1028  %i2 = load i32, i32* %p2, align 1
1029  %i3 = load i32, i32* %p3, align 1
1030  %x0 = sext i32 %i0 to i64
1031  %x1 = sext i32 %i1 to i64
1032  %x2 = sext i32 %i2 to i64
1033  %x3 = sext i32 %i3 to i64
1034  %v0 = insertelement <4 x i64> undef, i64 %x0, i32 0
1035  %v1 = insertelement <4 x i64>   %v0, i64 %x1, i32 1
1036  %v2 = insertelement <4 x i64>   %v1, i64 %x2, i32 2
1037  %v3 = insertelement <4 x i64>   %v2, i64 %x3, i32 3
1038  ret <4 x i64> %v3
1039}
1040