1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -mtriple=x86_64-unknown -passes=slp-vectorizer,instcombine -S | FileCheck %s --check-prefixes=CHECK,SSE
3 ; RUN: opt < %s -mtriple=x86_64-unknown -mcpu=slm -passes=slp-vectorizer,instcombine -S | FileCheck %s --check-prefixes=CHECK,SLM
4 ; RUN: opt < %s -mtriple=x86_64-unknown -mcpu=corei7-avx -passes=slp-vectorizer,instcombine -S | FileCheck %s --check-prefixes=CHECK,AVX,AVX1
5 ; RUN: opt < %s -mtriple=x86_64-unknown -mcpu=core-avx2 -passes=slp-vectorizer,instcombine -S | FileCheck %s --check-prefixes=CHECK,AVX,AVX2
6 ; RUN: opt < %s -mtriple=x86_64-unknown -mcpu=knl -passes=slp-vectorizer,instcombine -S | FileCheck %s --check-prefixes=CHECK,AVX,AVX512
7 ; RUN: opt < %s -mtriple=x86_64-unknown -mcpu=skx -passes=slp-vectorizer,instcombine -S | FileCheck %s --check-prefixes=CHECK,AVX,AVX512
13 define <2 x double> @test_v2f64(<2 x double> %a, <2 x double> %b) {
14 ; CHECK-LABEL: @test_v2f64(
15 ; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <2 x double> [[A:%.*]], <2 x double> [[B:%.*]], <2 x i32> <i32 0, i32 2>
16 ; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <2 x double> [[A]], <2 x double> [[B]], <2 x i32> <i32 1, i32 3>
17 ; CHECK-NEXT: [[TMP3:%.*]] = fadd <2 x double> [[TMP1]], [[TMP2]]
18 ; CHECK-NEXT: ret <2 x double> [[TMP3]]
20 %a0 = extractelement <2 x double> %a, i32 0
21 %a1 = extractelement <2 x double> %a, i32 1
22 %b0 = extractelement <2 x double> %b, i32 0
23 %b1 = extractelement <2 x double> %b, i32 1
24 %r0 = fadd double %a0, %a1
25 %r1 = fadd double %b0, %b1
26 %r00 = insertelement <2 x double> undef, double %r0, i32 0
27 %r01 = insertelement <2 x double> %r00, double %r1, i32 1
31 define <4 x float> @test_v4f32(<4 x float> %a, <4 x float> %b) {
32 ; CHECK-LABEL: @test_v4f32(
33 ; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <4 x float> [[A:%.*]], <4 x float> [[B:%.*]], <4 x i32> <i32 0, i32 2, i32 4, i32 6>
34 ; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <4 x float> [[A]], <4 x float> [[B]], <4 x i32> <i32 1, i32 3, i32 5, i32 7>
35 ; CHECK-NEXT: [[TMP3:%.*]] = fadd <4 x float> [[TMP1]], [[TMP2]]
36 ; CHECK-NEXT: ret <4 x float> [[TMP3]]
38 %a0 = extractelement <4 x float> %a, i32 0
39 %a1 = extractelement <4 x float> %a, i32 1
40 %a2 = extractelement <4 x float> %a, i32 2
41 %a3 = extractelement <4 x float> %a, i32 3
42 %b0 = extractelement <4 x float> %b, i32 0
43 %b1 = extractelement <4 x float> %b, i32 1
44 %b2 = extractelement <4 x float> %b, i32 2
45 %b3 = extractelement <4 x float> %b, i32 3
46 %r0 = fadd float %a0, %a1
47 %r1 = fadd float %a2, %a3
48 %r2 = fadd float %b0, %b1
49 %r3 = fadd float %b2, %b3
50 %r00 = insertelement <4 x float> undef, float %r0, i32 0
51 %r01 = insertelement <4 x float> %r00, float %r1, i32 1
52 %r02 = insertelement <4 x float> %r01, float %r2, i32 2
53 %r03 = insertelement <4 x float> %r02, float %r3, i32 3
57 define <2 x i64> @test_v2i64(<2 x i64> %a, <2 x i64> %b) {
58 ; CHECK-LABEL: @test_v2i64(
59 ; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <2 x i64> [[A:%.*]], <2 x i64> [[B:%.*]], <2 x i32> <i32 0, i32 2>
60 ; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <2 x i64> [[A]], <2 x i64> [[B]], <2 x i32> <i32 1, i32 3>
61 ; CHECK-NEXT: [[TMP3:%.*]] = add <2 x i64> [[TMP1]], [[TMP2]]
62 ; CHECK-NEXT: ret <2 x i64> [[TMP3]]
64 %a0 = extractelement <2 x i64> %a, i32 0
65 %a1 = extractelement <2 x i64> %a, i32 1
66 %b0 = extractelement <2 x i64> %b, i32 0
67 %b1 = extractelement <2 x i64> %b, i32 1
68 %r0 = add i64 %a0, %a1
69 %r1 = add i64 %b0, %b1
70 %r00 = insertelement <2 x i64> undef, i64 %r0, i32 0
71 %r01 = insertelement <2 x i64> %r00, i64 %r1, i32 1
75 define <4 x i32> @test_v4i32(<4 x i32> %a, <4 x i32> %b) {
76 ; CHECK-LABEL: @test_v4i32(
77 ; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <4 x i32> [[A:%.*]], <4 x i32> [[B:%.*]], <4 x i32> <i32 0, i32 2, i32 4, i32 6>
78 ; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <4 x i32> [[A]], <4 x i32> [[B]], <4 x i32> <i32 1, i32 3, i32 5, i32 7>
79 ; CHECK-NEXT: [[TMP3:%.*]] = add <4 x i32> [[TMP1]], [[TMP2]]
80 ; CHECK-NEXT: ret <4 x i32> [[TMP3]]
82 %a0 = extractelement <4 x i32> %a, i32 0
83 %a1 = extractelement <4 x i32> %a, i32 1
84 %a2 = extractelement <4 x i32> %a, i32 2
85 %a3 = extractelement <4 x i32> %a, i32 3
86 %b0 = extractelement <4 x i32> %b, i32 0
87 %b1 = extractelement <4 x i32> %b, i32 1
88 %b2 = extractelement <4 x i32> %b, i32 2
89 %b3 = extractelement <4 x i32> %b, i32 3
90 %r0 = add i32 %a0, %a1
91 %r1 = add i32 %a2, %a3
92 %r2 = add i32 %b0, %b1
93 %r3 = add i32 %b2, %b3
94 %r00 = insertelement <4 x i32> undef, i32 %r0, i32 0
95 %r01 = insertelement <4 x i32> %r00, i32 %r1, i32 1
96 %r02 = insertelement <4 x i32> %r01, i32 %r2, i32 2
97 %r03 = insertelement <4 x i32> %r02, i32 %r3, i32 3
101 define <8 x i16> @test_v8i16(<8 x i16> %a, <8 x i16> %b) {
102 ; CHECK-LABEL: @test_v8i16(
103 ; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <8 x i16> [[A:%.*]], <8 x i16> [[B:%.*]], <8 x i32> <i32 0, i32 2, i32 4, i32 6, i32 8, i32 10, i32 12, i32 14>
104 ; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <8 x i16> [[A]], <8 x i16> [[B]], <8 x i32> <i32 1, i32 3, i32 5, i32 7, i32 9, i32 11, i32 13, i32 15>
105 ; CHECK-NEXT: [[TMP3:%.*]] = add <8 x i16> [[TMP1]], [[TMP2]]
106 ; CHECK-NEXT: ret <8 x i16> [[TMP3]]
108 %a0 = extractelement <8 x i16> %a, i32 0
109 %a1 = extractelement <8 x i16> %a, i32 1
110 %a2 = extractelement <8 x i16> %a, i32 2
111 %a3 = extractelement <8 x i16> %a, i32 3
112 %a4 = extractelement <8 x i16> %a, i32 4
113 %a5 = extractelement <8 x i16> %a, i32 5
114 %a6 = extractelement <8 x i16> %a, i32 6
115 %a7 = extractelement <8 x i16> %a, i32 7
116 %b0 = extractelement <8 x i16> %b, i32 0
117 %b1 = extractelement <8 x i16> %b, i32 1
118 %b2 = extractelement <8 x i16> %b, i32 2
119 %b3 = extractelement <8 x i16> %b, i32 3
120 %b4 = extractelement <8 x i16> %b, i32 4
121 %b5 = extractelement <8 x i16> %b, i32 5
122 %b6 = extractelement <8 x i16> %b, i32 6
123 %b7 = extractelement <8 x i16> %b, i32 7
124 %r0 = add i16 %a0, %a1
125 %r1 = add i16 %a2, %a3
126 %r2 = add i16 %a4, %a5
127 %r3 = add i16 %a6, %a7
128 %r4 = add i16 %b0, %b1
129 %r5 = add i16 %b2, %b3
130 %r6 = add i16 %b4, %b5
131 %r7 = add i16 %b6, %b7
132 %r00 = insertelement <8 x i16> undef, i16 %r0, i32 0
133 %r01 = insertelement <8 x i16> %r00, i16 %r1, i32 1
134 %r02 = insertelement <8 x i16> %r01, i16 %r2, i32 2
135 %r03 = insertelement <8 x i16> %r02, i16 %r3, i32 3
136 %r04 = insertelement <8 x i16> %r03, i16 %r4, i32 4
137 %r05 = insertelement <8 x i16> %r04, i16 %r5, i32 5
138 %r06 = insertelement <8 x i16> %r05, i16 %r6, i32 6
139 %r07 = insertelement <8 x i16> %r06, i16 %r7, i32 7
144 define void @test_v4f32_v2f32_store(<4 x float> %f, ptr %p){
145 ; CHECK-LABEL: @test_v4f32_v2f32_store(
146 ; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <4 x float> [[F:%.*]], <4 x float> poison, <2 x i32> <i32 1, i32 2>
147 ; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <4 x float> [[F]], <4 x float> poison, <2 x i32> <i32 0, i32 3>
148 ; CHECK-NEXT: [[TMP3:%.*]] = fadd <2 x float> [[TMP1]], [[TMP2]]
149 ; CHECK-NEXT: store <2 x float> [[TMP3]], ptr [[P:%.*]], align 4
150 ; CHECK-NEXT: ret void
152 %x0 = extractelement <4 x float> %f, i64 0
153 %x1 = extractelement <4 x float> %f, i64 1
154 %add01 = fadd float %x0, %x1
155 store float %add01, ptr %p, align 4
156 %x2 = extractelement <4 x float> %f, i64 2
157 %x3 = extractelement <4 x float> %f, i64 3
158 %add23 = fadd float %x2, %x3
159 %p23 = getelementptr inbounds float, ptr %p, i64 1
160 store float %add23, ptr %p23, align 4
168 define <4 x double> @test_v4f64(<4 x double> %a, <4 x double> %b) {
169 ; SSE-LABEL: @test_v4f64(
170 ; SSE-NEXT: [[TMP1:%.*]] = shufflevector <4 x double> [[A:%.*]], <4 x double> [[B:%.*]], <2 x i32> <i32 0, i32 4>
171 ; SSE-NEXT: [[TMP2:%.*]] = shufflevector <4 x double> [[A]], <4 x double> [[B]], <2 x i32> <i32 2, i32 6>
172 ; SSE-NEXT: [[TMP3:%.*]] = shufflevector <4 x double> [[A]], <4 x double> [[B]], <2 x i32> <i32 1, i32 5>
173 ; SSE-NEXT: [[TMP4:%.*]] = shufflevector <4 x double> [[A]], <4 x double> [[B]], <2 x i32> <i32 3, i32 7>
174 ; SSE-NEXT: [[TMP5:%.*]] = fadd <2 x double> [[TMP1]], [[TMP3]]
175 ; SSE-NEXT: [[TMP6:%.*]] = fadd <2 x double> [[TMP2]], [[TMP4]]
176 ; SSE-NEXT: [[TMP7:%.*]] = shufflevector <2 x double> [[TMP5]], <2 x double> [[TMP6]], <4 x i32> <i32 0, i32 1, i32 2, i32 3>
177 ; SSE-NEXT: ret <4 x double> [[TMP7]]
179 ; SLM-LABEL: @test_v4f64(
180 ; SLM-NEXT: [[TMP1:%.*]] = shufflevector <4 x double> [[A:%.*]], <4 x double> [[B:%.*]], <2 x i32> <i32 0, i32 4>
181 ; SLM-NEXT: [[TMP2:%.*]] = shufflevector <4 x double> [[A]], <4 x double> [[B]], <2 x i32> <i32 2, i32 6>
182 ; SLM-NEXT: [[TMP3:%.*]] = shufflevector <4 x double> [[A]], <4 x double> [[B]], <2 x i32> <i32 1, i32 5>
183 ; SLM-NEXT: [[TMP4:%.*]] = shufflevector <4 x double> [[A]], <4 x double> [[B]], <2 x i32> <i32 3, i32 7>
184 ; SLM-NEXT: [[TMP5:%.*]] = fadd <2 x double> [[TMP1]], [[TMP3]]
185 ; SLM-NEXT: [[TMP6:%.*]] = fadd <2 x double> [[TMP2]], [[TMP4]]
186 ; SLM-NEXT: [[TMP7:%.*]] = shufflevector <2 x double> [[TMP5]], <2 x double> [[TMP6]], <4 x i32> <i32 0, i32 1, i32 2, i32 3>
187 ; SLM-NEXT: ret <4 x double> [[TMP7]]
189 ; AVX-LABEL: @test_v4f64(
190 ; AVX-NEXT: [[TMP1:%.*]] = shufflevector <4 x double> [[A:%.*]], <4 x double> [[B:%.*]], <4 x i32> <i32 0, i32 4, i32 2, i32 6>
191 ; AVX-NEXT: [[TMP2:%.*]] = shufflevector <4 x double> [[A]], <4 x double> [[B]], <4 x i32> <i32 1, i32 5, i32 3, i32 7>
192 ; AVX-NEXT: [[TMP3:%.*]] = fadd <4 x double> [[TMP1]], [[TMP2]]
193 ; AVX-NEXT: ret <4 x double> [[TMP3]]
195 %a0 = extractelement <4 x double> %a, i32 0
196 %a1 = extractelement <4 x double> %a, i32 1
197 %a2 = extractelement <4 x double> %a, i32 2
198 %a3 = extractelement <4 x double> %a, i32 3
199 %b0 = extractelement <4 x double> %b, i32 0
200 %b1 = extractelement <4 x double> %b, i32 1
201 %b2 = extractelement <4 x double> %b, i32 2
202 %b3 = extractelement <4 x double> %b, i32 3
203 %r0 = fadd double %a0, %a1
204 %r1 = fadd double %b0, %b1
205 %r2 = fadd double %a2, %a3
206 %r3 = fadd double %b2, %b3
207 %r00 = insertelement <4 x double> undef, double %r0, i32 0
208 %r01 = insertelement <4 x double> %r00, double %r1, i32 1
209 %r02 = insertelement <4 x double> %r01, double %r2, i32 2
210 %r03 = insertelement <4 x double> %r02, double %r3, i32 3
211 ret <4 x double> %r03
215 define <4 x double> @test_v4f64_partial_swizzle(<4 x double> %a, <4 x double> %b) {
216 ; SSE-LABEL: @test_v4f64_partial_swizzle(
217 ; SSE-NEXT: [[B2:%.*]] = extractelement <4 x double> [[B:%.*]], i64 2
218 ; SSE-NEXT: [[B3:%.*]] = extractelement <4 x double> [[B]], i64 3
219 ; SSE-NEXT: [[TMP1:%.*]] = shufflevector <4 x double> [[A:%.*]], <4 x double> [[B]], <2 x i32> <i32 0, i32 4>
220 ; SSE-NEXT: [[TMP2:%.*]] = shufflevector <4 x double> [[A]], <4 x double> [[B]], <2 x i32> <i32 1, i32 5>
221 ; SSE-NEXT: [[TMP3:%.*]] = fadd <2 x double> [[TMP1]], [[TMP2]]
222 ; SSE-NEXT: [[R3:%.*]] = fadd double [[B2]], [[B3]]
223 ; SSE-NEXT: [[TMP4:%.*]] = shufflevector <2 x double> [[TMP3]], <2 x double> <double undef, double poison>, <4 x i32> <i32 0, i32 2, i32 1, i32 poison>
224 ; SSE-NEXT: [[R03:%.*]] = insertelement <4 x double> [[TMP4]], double [[R3]], i64 3
225 ; SSE-NEXT: ret <4 x double> [[R03]]
227 ; SLM-LABEL: @test_v4f64_partial_swizzle(
228 ; SLM-NEXT: [[B2:%.*]] = extractelement <4 x double> [[B:%.*]], i64 2
229 ; SLM-NEXT: [[B3:%.*]] = extractelement <4 x double> [[B]], i64 3
230 ; SLM-NEXT: [[TMP1:%.*]] = shufflevector <4 x double> [[A:%.*]], <4 x double> [[B]], <2 x i32> <i32 0, i32 4>
231 ; SLM-NEXT: [[TMP2:%.*]] = shufflevector <4 x double> [[A]], <4 x double> [[B]], <2 x i32> <i32 1, i32 5>
232 ; SLM-NEXT: [[TMP3:%.*]] = fadd <2 x double> [[TMP1]], [[TMP2]]
233 ; SLM-NEXT: [[R3:%.*]] = fadd double [[B2]], [[B3]]
234 ; SLM-NEXT: [[TMP4:%.*]] = shufflevector <2 x double> [[TMP3]], <2 x double> <double undef, double poison>, <4 x i32> <i32 0, i32 2, i32 1, i32 poison>
235 ; SLM-NEXT: [[R03:%.*]] = insertelement <4 x double> [[TMP4]], double [[R3]], i64 3
236 ; SLM-NEXT: ret <4 x double> [[R03]]
238 ; AVX1-LABEL: @test_v4f64_partial_swizzle(
239 ; AVX1-NEXT: [[A0:%.*]] = extractelement <4 x double> [[A:%.*]], i64 0
240 ; AVX1-NEXT: [[A1:%.*]] = extractelement <4 x double> [[A]], i64 1
241 ; AVX1-NEXT: [[R0:%.*]] = fadd double [[A0]], [[A1]]
242 ; AVX1-NEXT: [[TMP1:%.*]] = shufflevector <4 x double> [[B:%.*]], <4 x double> poison, <2 x i32> <i32 1, i32 2>
243 ; AVX1-NEXT: [[TMP2:%.*]] = shufflevector <4 x double> [[B]], <4 x double> poison, <2 x i32> <i32 0, i32 3>
244 ; AVX1-NEXT: [[TMP3:%.*]] = fadd <2 x double> [[TMP1]], [[TMP2]]
245 ; AVX1-NEXT: [[R00:%.*]] = insertelement <4 x double> <double poison, double undef, double poison, double poison>, double [[R0]], i64 0
246 ; AVX1-NEXT: [[TMP4:%.*]] = shufflevector <2 x double> [[TMP3]], <2 x double> poison, <4 x i32> <i32 0, i32 1, i32 poison, i32 poison>
247 ; AVX1-NEXT: [[R031:%.*]] = shufflevector <4 x double> [[R00]], <4 x double> [[TMP4]], <4 x i32> <i32 0, i32 1, i32 4, i32 5>
248 ; AVX1-NEXT: ret <4 x double> [[R031]]
250 ; AVX2-LABEL: @test_v4f64_partial_swizzle(
251 ; AVX2-NEXT: [[A0:%.*]] = extractelement <4 x double> [[A:%.*]], i64 0
252 ; AVX2-NEXT: [[A1:%.*]] = extractelement <4 x double> [[A]], i64 1
253 ; AVX2-NEXT: [[R0:%.*]] = fadd double [[A0]], [[A1]]
254 ; AVX2-NEXT: [[TMP1:%.*]] = shufflevector <4 x double> [[B:%.*]], <4 x double> poison, <2 x i32> <i32 1, i32 2>
255 ; AVX2-NEXT: [[TMP2:%.*]] = shufflevector <4 x double> [[B]], <4 x double> poison, <2 x i32> <i32 0, i32 3>
256 ; AVX2-NEXT: [[TMP3:%.*]] = fadd <2 x double> [[TMP1]], [[TMP2]]
257 ; AVX2-NEXT: [[R00:%.*]] = insertelement <4 x double> <double poison, double undef, double poison, double poison>, double [[R0]], i64 0
258 ; AVX2-NEXT: [[TMP4:%.*]] = shufflevector <2 x double> [[TMP3]], <2 x double> poison, <4 x i32> <i32 0, i32 1, i32 poison, i32 poison>
259 ; AVX2-NEXT: [[R031:%.*]] = shufflevector <4 x double> [[R00]], <4 x double> [[TMP4]], <4 x i32> <i32 0, i32 1, i32 4, i32 5>
260 ; AVX2-NEXT: ret <4 x double> [[R031]]
262 ; AVX512-LABEL: @test_v4f64_partial_swizzle(
263 ; AVX512-NEXT: [[B2:%.*]] = extractelement <4 x double> [[B:%.*]], i64 2
264 ; AVX512-NEXT: [[B3:%.*]] = extractelement <4 x double> [[B]], i64 3
265 ; AVX512-NEXT: [[TMP1:%.*]] = shufflevector <4 x double> [[A:%.*]], <4 x double> [[B]], <2 x i32> <i32 0, i32 4>
266 ; AVX512-NEXT: [[TMP2:%.*]] = shufflevector <4 x double> [[A]], <4 x double> [[B]], <2 x i32> <i32 1, i32 5>
267 ; AVX512-NEXT: [[TMP3:%.*]] = fadd <2 x double> [[TMP1]], [[TMP2]]
268 ; AVX512-NEXT: [[R3:%.*]] = fadd double [[B2]], [[B3]]
269 ; AVX512-NEXT: [[TMP4:%.*]] = shufflevector <2 x double> [[TMP3]], <2 x double> <double undef, double poison>, <4 x i32> <i32 0, i32 2, i32 1, i32 poison>
270 ; AVX512-NEXT: [[R03:%.*]] = insertelement <4 x double> [[TMP4]], double [[R3]], i64 3
271 ; AVX512-NEXT: ret <4 x double> [[R03]]
273 %a0 = extractelement <4 x double> %a, i64 0
274 %a1 = extractelement <4 x double> %a, i64 1
275 %b0 = extractelement <4 x double> %b, i64 0
276 %b1 = extractelement <4 x double> %b, i64 1
277 %b2 = extractelement <4 x double> %b, i32 2
278 %b3 = extractelement <4 x double> %b, i32 3
279 %r0 = fadd double %a0, %a1
280 %r2 = fadd double %b0, %b1
281 %r3 = fadd double %b2, %b3
282 %r00 = insertelement <4 x double> undef, double %r0, i32 0
283 %r02 = insertelement <4 x double> %r00, double %r2, i32 2
284 %r03 = insertelement <4 x double> %r02, double %r3, i32 3
285 ret <4 x double> %r03
288 define <8 x float> @test_v8f32(<8 x float> %a, <8 x float> %b) {
289 ; SSE-LABEL: @test_v8f32(
290 ; SSE-NEXT: [[TMP1:%.*]] = shufflevector <8 x float> [[A:%.*]], <8 x float> [[B:%.*]], <4 x i32> <i32 0, i32 2, i32 8, i32 10>
291 ; SSE-NEXT: [[TMP2:%.*]] = shufflevector <8 x float> [[A]], <8 x float> [[B]], <4 x i32> <i32 4, i32 6, i32 12, i32 14>
292 ; SSE-NEXT: [[TMP3:%.*]] = shufflevector <8 x float> [[A]], <8 x float> [[B]], <4 x i32> <i32 1, i32 3, i32 9, i32 11>
293 ; SSE-NEXT: [[TMP4:%.*]] = shufflevector <8 x float> [[A]], <8 x float> [[B]], <4 x i32> <i32 5, i32 7, i32 13, i32 15>
294 ; SSE-NEXT: [[TMP5:%.*]] = fadd <4 x float> [[TMP1]], [[TMP3]]
295 ; SSE-NEXT: [[TMP6:%.*]] = fadd <4 x float> [[TMP2]], [[TMP4]]
296 ; SSE-NEXT: [[TMP7:%.*]] = shufflevector <4 x float> [[TMP5]], <4 x float> [[TMP6]], <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
297 ; SSE-NEXT: ret <8 x float> [[TMP7]]
299 ; SLM-LABEL: @test_v8f32(
300 ; SLM-NEXT: [[TMP1:%.*]] = shufflevector <8 x float> [[A:%.*]], <8 x float> [[B:%.*]], <4 x i32> <i32 0, i32 2, i32 8, i32 10>
301 ; SLM-NEXT: [[TMP2:%.*]] = shufflevector <8 x float> [[A]], <8 x float> [[B]], <4 x i32> <i32 4, i32 6, i32 12, i32 14>
302 ; SLM-NEXT: [[TMP3:%.*]] = shufflevector <8 x float> [[A]], <8 x float> [[B]], <4 x i32> <i32 1, i32 3, i32 9, i32 11>
303 ; SLM-NEXT: [[TMP4:%.*]] = shufflevector <8 x float> [[A]], <8 x float> [[B]], <4 x i32> <i32 5, i32 7, i32 13, i32 15>
304 ; SLM-NEXT: [[TMP5:%.*]] = fadd <4 x float> [[TMP1]], [[TMP3]]
305 ; SLM-NEXT: [[TMP6:%.*]] = fadd <4 x float> [[TMP2]], [[TMP4]]
306 ; SLM-NEXT: [[TMP7:%.*]] = shufflevector <4 x float> [[TMP5]], <4 x float> [[TMP6]], <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
307 ; SLM-NEXT: ret <8 x float> [[TMP7]]
309 ; AVX-LABEL: @test_v8f32(
310 ; AVX-NEXT: [[TMP1:%.*]] = shufflevector <8 x float> [[A:%.*]], <8 x float> [[B:%.*]], <8 x i32> <i32 0, i32 2, i32 8, i32 10, i32 4, i32 6, i32 12, i32 14>
311 ; AVX-NEXT: [[TMP2:%.*]] = shufflevector <8 x float> [[A]], <8 x float> [[B]], <8 x i32> <i32 1, i32 3, i32 9, i32 11, i32 5, i32 7, i32 13, i32 15>
312 ; AVX-NEXT: [[TMP3:%.*]] = fadd <8 x float> [[TMP1]], [[TMP2]]
313 ; AVX-NEXT: ret <8 x float> [[TMP3]]
315 %a0 = extractelement <8 x float> %a, i32 0
316 %a1 = extractelement <8 x float> %a, i32 1
317 %a2 = extractelement <8 x float> %a, i32 2
318 %a3 = extractelement <8 x float> %a, i32 3
319 %a4 = extractelement <8 x float> %a, i32 4
320 %a5 = extractelement <8 x float> %a, i32 5
321 %a6 = extractelement <8 x float> %a, i32 6
322 %a7 = extractelement <8 x float> %a, i32 7
323 %b0 = extractelement <8 x float> %b, i32 0
324 %b1 = extractelement <8 x float> %b, i32 1
325 %b2 = extractelement <8 x float> %b, i32 2
326 %b3 = extractelement <8 x float> %b, i32 3
327 %b4 = extractelement <8 x float> %b, i32 4
328 %b5 = extractelement <8 x float> %b, i32 5
329 %b6 = extractelement <8 x float> %b, i32 6
330 %b7 = extractelement <8 x float> %b, i32 7
331 %r0 = fadd float %a0, %a1
332 %r1 = fadd float %a2, %a3
333 %r2 = fadd float %b0, %b1
334 %r3 = fadd float %b2, %b3
335 %r4 = fadd float %a4, %a5
336 %r5 = fadd float %a6, %a7
337 %r6 = fadd float %b4, %b5
338 %r7 = fadd float %b6, %b7
339 %r00 = insertelement <8 x float> undef, float %r0, i32 0
340 %r01 = insertelement <8 x float> %r00, float %r1, i32 1
341 %r02 = insertelement <8 x float> %r01, float %r2, i32 2
342 %r03 = insertelement <8 x float> %r02, float %r3, i32 3
343 %r04 = insertelement <8 x float> %r03, float %r4, i32 4
344 %r05 = insertelement <8 x float> %r04, float %r5, i32 5
345 %r06 = insertelement <8 x float> %r05, float %r6, i32 6
346 %r07 = insertelement <8 x float> %r06, float %r7, i32 7
350 define <4 x i64> @test_v4i64(<4 x i64> %a, <4 x i64> %b) {
351 ; SSE-LABEL: @test_v4i64(
352 ; SSE-NEXT: [[TMP1:%.*]] = shufflevector <4 x i64> [[A:%.*]], <4 x i64> [[B:%.*]], <2 x i32> <i32 0, i32 4>
353 ; SSE-NEXT: [[TMP2:%.*]] = shufflevector <4 x i64> [[A]], <4 x i64> [[B]], <2 x i32> <i32 2, i32 6>
354 ; SSE-NEXT: [[TMP3:%.*]] = shufflevector <4 x i64> [[A]], <4 x i64> [[B]], <2 x i32> <i32 1, i32 5>
355 ; SSE-NEXT: [[TMP4:%.*]] = shufflevector <4 x i64> [[A]], <4 x i64> [[B]], <2 x i32> <i32 3, i32 7>
356 ; SSE-NEXT: [[TMP5:%.*]] = add <2 x i64> [[TMP1]], [[TMP3]]
357 ; SSE-NEXT: [[TMP6:%.*]] = add <2 x i64> [[TMP2]], [[TMP4]]
358 ; SSE-NEXT: [[TMP7:%.*]] = shufflevector <2 x i64> [[TMP5]], <2 x i64> [[TMP6]], <4 x i32> <i32 0, i32 1, i32 2, i32 3>
359 ; SSE-NEXT: ret <4 x i64> [[TMP7]]
361 ; SLM-LABEL: @test_v4i64(
362 ; SLM-NEXT: [[TMP1:%.*]] = shufflevector <4 x i64> [[A:%.*]], <4 x i64> [[B:%.*]], <2 x i32> <i32 0, i32 4>
363 ; SLM-NEXT: [[TMP2:%.*]] = shufflevector <4 x i64> [[A]], <4 x i64> [[B]], <2 x i32> <i32 2, i32 6>
364 ; SLM-NEXT: [[TMP3:%.*]] = shufflevector <4 x i64> [[A]], <4 x i64> [[B]], <2 x i32> <i32 1, i32 5>
365 ; SLM-NEXT: [[TMP4:%.*]] = shufflevector <4 x i64> [[A]], <4 x i64> [[B]], <2 x i32> <i32 3, i32 7>
366 ; SLM-NEXT: [[TMP5:%.*]] = add <2 x i64> [[TMP1]], [[TMP3]]
367 ; SLM-NEXT: [[TMP6:%.*]] = add <2 x i64> [[TMP2]], [[TMP4]]
368 ; SLM-NEXT: [[TMP7:%.*]] = shufflevector <2 x i64> [[TMP5]], <2 x i64> [[TMP6]], <4 x i32> <i32 0, i32 1, i32 2, i32 3>
369 ; SLM-NEXT: ret <4 x i64> [[TMP7]]
371 ; AVX-LABEL: @test_v4i64(
372 ; AVX-NEXT: [[TMP1:%.*]] = shufflevector <4 x i64> [[A:%.*]], <4 x i64> [[B:%.*]], <4 x i32> <i32 0, i32 4, i32 2, i32 6>
373 ; AVX-NEXT: [[TMP2:%.*]] = shufflevector <4 x i64> [[A]], <4 x i64> [[B]], <4 x i32> <i32 1, i32 5, i32 3, i32 7>
374 ; AVX-NEXT: [[TMP3:%.*]] = add <4 x i64> [[TMP1]], [[TMP2]]
375 ; AVX-NEXT: ret <4 x i64> [[TMP3]]
377 %a0 = extractelement <4 x i64> %a, i32 0
378 %a1 = extractelement <4 x i64> %a, i32 1
379 %a2 = extractelement <4 x i64> %a, i32 2
380 %a3 = extractelement <4 x i64> %a, i32 3
381 %b0 = extractelement <4 x i64> %b, i32 0
382 %b1 = extractelement <4 x i64> %b, i32 1
383 %b2 = extractelement <4 x i64> %b, i32 2
384 %b3 = extractelement <4 x i64> %b, i32 3
385 %r0 = add i64 %a0, %a1
386 %r1 = add i64 %b0, %b1
387 %r2 = add i64 %a2, %a3
388 %r3 = add i64 %b2, %b3
389 %r00 = insertelement <4 x i64> undef, i64 %r0, i32 0
390 %r01 = insertelement <4 x i64> %r00, i64 %r1, i32 1
391 %r02 = insertelement <4 x i64> %r01, i64 %r2, i32 2
392 %r03 = insertelement <4 x i64> %r02, i64 %r3, i32 3
396 define <8 x i32> @test_v8i32(<8 x i32> %a, <8 x i32> %b) {
397 ; SSE-LABEL: @test_v8i32(
398 ; SSE-NEXT: [[TMP1:%.*]] = shufflevector <8 x i32> [[A:%.*]], <8 x i32> [[B:%.*]], <4 x i32> <i32 0, i32 2, i32 8, i32 10>
399 ; SSE-NEXT: [[TMP2:%.*]] = shufflevector <8 x i32> [[A]], <8 x i32> [[B]], <4 x i32> <i32 4, i32 6, i32 12, i32 14>
400 ; SSE-NEXT: [[TMP3:%.*]] = shufflevector <8 x i32> [[A]], <8 x i32> [[B]], <4 x i32> <i32 1, i32 3, i32 9, i32 11>
401 ; SSE-NEXT: [[TMP4:%.*]] = shufflevector <8 x i32> [[A]], <8 x i32> [[B]], <4 x i32> <i32 5, i32 7, i32 13, i32 15>
402 ; SSE-NEXT: [[TMP5:%.*]] = add <4 x i32> [[TMP1]], [[TMP3]]
403 ; SSE-NEXT: [[TMP6:%.*]] = add <4 x i32> [[TMP2]], [[TMP4]]
404 ; SSE-NEXT: [[TMP7:%.*]] = shufflevector <4 x i32> [[TMP5]], <4 x i32> [[TMP6]], <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
405 ; SSE-NEXT: ret <8 x i32> [[TMP7]]
407 ; SLM-LABEL: @test_v8i32(
408 ; SLM-NEXT: [[TMP1:%.*]] = shufflevector <8 x i32> [[A:%.*]], <8 x i32> [[B:%.*]], <4 x i32> <i32 0, i32 2, i32 8, i32 10>
409 ; SLM-NEXT: [[TMP2:%.*]] = shufflevector <8 x i32> [[A]], <8 x i32> [[B]], <4 x i32> <i32 4, i32 6, i32 12, i32 14>
410 ; SLM-NEXT: [[TMP3:%.*]] = shufflevector <8 x i32> [[A]], <8 x i32> [[B]], <4 x i32> <i32 1, i32 3, i32 9, i32 11>
411 ; SLM-NEXT: [[TMP4:%.*]] = shufflevector <8 x i32> [[A]], <8 x i32> [[B]], <4 x i32> <i32 5, i32 7, i32 13, i32 15>
412 ; SLM-NEXT: [[TMP5:%.*]] = add <4 x i32> [[TMP1]], [[TMP3]]
413 ; SLM-NEXT: [[TMP6:%.*]] = add <4 x i32> [[TMP2]], [[TMP4]]
414 ; SLM-NEXT: [[TMP7:%.*]] = shufflevector <4 x i32> [[TMP5]], <4 x i32> [[TMP6]], <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
415 ; SLM-NEXT: ret <8 x i32> [[TMP7]]
417 ; AVX-LABEL: @test_v8i32(
418 ; AVX-NEXT: [[TMP1:%.*]] = shufflevector <8 x i32> [[A:%.*]], <8 x i32> [[B:%.*]], <8 x i32> <i32 0, i32 2, i32 8, i32 10, i32 4, i32 6, i32 12, i32 14>
419 ; AVX-NEXT: [[TMP2:%.*]] = shufflevector <8 x i32> [[A]], <8 x i32> [[B]], <8 x i32> <i32 1, i32 3, i32 9, i32 11, i32 5, i32 7, i32 13, i32 15>
420 ; AVX-NEXT: [[TMP3:%.*]] = add <8 x i32> [[TMP1]], [[TMP2]]
421 ; AVX-NEXT: ret <8 x i32> [[TMP3]]
423 %a0 = extractelement <8 x i32> %a, i32 0
424 %a1 = extractelement <8 x i32> %a, i32 1
425 %a2 = extractelement <8 x i32> %a, i32 2
426 %a3 = extractelement <8 x i32> %a, i32 3
427 %a4 = extractelement <8 x i32> %a, i32 4
428 %a5 = extractelement <8 x i32> %a, i32 5
429 %a6 = extractelement <8 x i32> %a, i32 6
430 %a7 = extractelement <8 x i32> %a, i32 7
431 %b0 = extractelement <8 x i32> %b, i32 0
432 %b1 = extractelement <8 x i32> %b, i32 1
433 %b2 = extractelement <8 x i32> %b, i32 2
434 %b3 = extractelement <8 x i32> %b, i32 3
435 %b4 = extractelement <8 x i32> %b, i32 4
436 %b5 = extractelement <8 x i32> %b, i32 5
437 %b6 = extractelement <8 x i32> %b, i32 6
438 %b7 = extractelement <8 x i32> %b, i32 7
439 %r0 = add i32 %a0, %a1
440 %r1 = add i32 %a2, %a3
441 %r2 = add i32 %b0, %b1
442 %r3 = add i32 %b2, %b3
443 %r4 = add i32 %a4, %a5
444 %r5 = add i32 %a6, %a7
445 %r6 = add i32 %b4, %b5
446 %r7 = add i32 %b6, %b7
447 %r00 = insertelement <8 x i32> undef, i32 %r0, i32 0
448 %r01 = insertelement <8 x i32> %r00, i32 %r1, i32 1
449 %r02 = insertelement <8 x i32> %r01, i32 %r2, i32 2
450 %r03 = insertelement <8 x i32> %r02, i32 %r3, i32 3
451 %r04 = insertelement <8 x i32> %r03, i32 %r4, i32 4
452 %r05 = insertelement <8 x i32> %r04, i32 %r5, i32 5
453 %r06 = insertelement <8 x i32> %r05, i32 %r6, i32 6
454 %r07 = insertelement <8 x i32> %r06, i32 %r7, i32 7
458 define <16 x i16> @test_v16i16(<16 x i16> %a, <16 x i16> %b) {
459 ; SSE-LABEL: @test_v16i16(
460 ; SSE-NEXT: [[TMP1:%.*]] = shufflevector <16 x i16> [[A:%.*]], <16 x i16> [[B:%.*]], <8 x i32> <i32 0, i32 2, i32 4, i32 6, i32 16, i32 18, i32 20, i32 22>
461 ; SSE-NEXT: [[TMP2:%.*]] = shufflevector <16 x i16> [[A]], <16 x i16> [[B]], <8 x i32> <i32 8, i32 10, i32 12, i32 14, i32 24, i32 26, i32 28, i32 30>
462 ; SSE-NEXT: [[TMP3:%.*]] = shufflevector <16 x i16> [[A]], <16 x i16> [[B]], <8 x i32> <i32 1, i32 3, i32 5, i32 7, i32 17, i32 19, i32 21, i32 23>
463 ; SSE-NEXT: [[TMP4:%.*]] = shufflevector <16 x i16> [[A]], <16 x i16> [[B]], <8 x i32> <i32 9, i32 11, i32 13, i32 15, i32 25, i32 27, i32 29, i32 31>
464 ; SSE-NEXT: [[TMP5:%.*]] = add <8 x i16> [[TMP1]], [[TMP3]]
465 ; SSE-NEXT: [[TMP6:%.*]] = add <8 x i16> [[TMP2]], [[TMP4]]
466 ; SSE-NEXT: [[TMP7:%.*]] = shufflevector <8 x i16> [[TMP5]], <8 x i16> [[TMP6]], <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
467 ; SSE-NEXT: ret <16 x i16> [[TMP7]]
469 ; SLM-LABEL: @test_v16i16(
470 ; SLM-NEXT: [[TMP1:%.*]] = shufflevector <16 x i16> [[A:%.*]], <16 x i16> [[B:%.*]], <8 x i32> <i32 0, i32 2, i32 4, i32 6, i32 16, i32 18, i32 20, i32 22>
471 ; SLM-NEXT: [[TMP2:%.*]] = shufflevector <16 x i16> [[A]], <16 x i16> [[B]], <8 x i32> <i32 8, i32 10, i32 12, i32 14, i32 24, i32 26, i32 28, i32 30>
472 ; SLM-NEXT: [[TMP3:%.*]] = shufflevector <16 x i16> [[A]], <16 x i16> [[B]], <8 x i32> <i32 1, i32 3, i32 5, i32 7, i32 17, i32 19, i32 21, i32 23>
473 ; SLM-NEXT: [[TMP4:%.*]] = shufflevector <16 x i16> [[A]], <16 x i16> [[B]], <8 x i32> <i32 9, i32 11, i32 13, i32 15, i32 25, i32 27, i32 29, i32 31>
474 ; SLM-NEXT: [[TMP5:%.*]] = add <8 x i16> [[TMP1]], [[TMP3]]
475 ; SLM-NEXT: [[TMP6:%.*]] = add <8 x i16> [[TMP2]], [[TMP4]]
476 ; SLM-NEXT: [[TMP7:%.*]] = shufflevector <8 x i16> [[TMP5]], <8 x i16> [[TMP6]], <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
477 ; SLM-NEXT: ret <16 x i16> [[TMP7]]
479 ; AVX-LABEL: @test_v16i16(
480 ; AVX-NEXT: [[TMP1:%.*]] = shufflevector <16 x i16> [[A:%.*]], <16 x i16> [[B:%.*]], <16 x i32> <i32 0, i32 2, i32 4, i32 6, i32 16, i32 18, i32 20, i32 22, i32 8, i32 10, i32 12, i32 14, i32 24, i32 26, i32 28, i32 30>
481 ; AVX-NEXT: [[TMP2:%.*]] = shufflevector <16 x i16> [[A]], <16 x i16> [[B]], <16 x i32> <i32 1, i32 3, i32 5, i32 7, i32 17, i32 19, i32 21, i32 23, i32 9, i32 11, i32 13, i32 15, i32 25, i32 27, i32 29, i32 31>
482 ; AVX-NEXT: [[TMP3:%.*]] = add <16 x i16> [[TMP1]], [[TMP2]]
483 ; AVX-NEXT: ret <16 x i16> [[TMP3]]
485 %a0 = extractelement <16 x i16> %a, i32 0
486 %a1 = extractelement <16 x i16> %a, i32 1
487 %a2 = extractelement <16 x i16> %a, i32 2
488 %a3 = extractelement <16 x i16> %a, i32 3
489 %a4 = extractelement <16 x i16> %a, i32 4
490 %a5 = extractelement <16 x i16> %a, i32 5
491 %a6 = extractelement <16 x i16> %a, i32 6
492 %a7 = extractelement <16 x i16> %a, i32 7
493 %a8 = extractelement <16 x i16> %a, i32 8
494 %a9 = extractelement <16 x i16> %a, i32 9
495 %a10 = extractelement <16 x i16> %a, i32 10
496 %a11 = extractelement <16 x i16> %a, i32 11
497 %a12 = extractelement <16 x i16> %a, i32 12
498 %a13 = extractelement <16 x i16> %a, i32 13
499 %a14 = extractelement <16 x i16> %a, i32 14
500 %a15 = extractelement <16 x i16> %a, i32 15
501 %b0 = extractelement <16 x i16> %b, i32 0
502 %b1 = extractelement <16 x i16> %b, i32 1
503 %b2 = extractelement <16 x i16> %b, i32 2
504 %b3 = extractelement <16 x i16> %b, i32 3
505 %b4 = extractelement <16 x i16> %b, i32 4
506 %b5 = extractelement <16 x i16> %b, i32 5
507 %b6 = extractelement <16 x i16> %b, i32 6
508 %b7 = extractelement <16 x i16> %b, i32 7
509 %b8 = extractelement <16 x i16> %b, i32 8
510 %b9 = extractelement <16 x i16> %b, i32 9
511 %b10 = extractelement <16 x i16> %b, i32 10
512 %b11 = extractelement <16 x i16> %b, i32 11
513 %b12 = extractelement <16 x i16> %b, i32 12
514 %b13 = extractelement <16 x i16> %b, i32 13
515 %b14 = extractelement <16 x i16> %b, i32 14
516 %b15 = extractelement <16 x i16> %b, i32 15
517 %r0 = add i16 %a0 , %a1
518 %r1 = add i16 %a2 , %a3
519 %r2 = add i16 %a4 , %a5
520 %r3 = add i16 %a6 , %a7
521 %r4 = add i16 %b0 , %b1
522 %r5 = add i16 %b2 , %b3
523 %r6 = add i16 %b4 , %b5
524 %r7 = add i16 %b6 , %b7
525 %r8 = add i16 %a8 , %a9
526 %r9 = add i16 %a10, %a11
527 %r10 = add i16 %a12, %a13
528 %r11 = add i16 %a14, %a15
529 %r12 = add i16 %b8 , %b9
530 %r13 = add i16 %b10, %b11
531 %r14 = add i16 %b12, %b13
532 %r15 = add i16 %b14, %b15
533 %rv0 = insertelement <16 x i16> undef, i16 %r0 , i32 0
534 %rv1 = insertelement <16 x i16> %rv0 , i16 %r1 , i32 1
535 %rv2 = insertelement <16 x i16> %rv1 , i16 %r2 , i32 2
536 %rv3 = insertelement <16 x i16> %rv2 , i16 %r3 , i32 3
537 %rv4 = insertelement <16 x i16> %rv3 , i16 %r4 , i32 4
538 %rv5 = insertelement <16 x i16> %rv4 , i16 %r5 , i32 5
539 %rv6 = insertelement <16 x i16> %rv5 , i16 %r6 , i32 6
540 %rv7 = insertelement <16 x i16> %rv6 , i16 %r7 , i32 7
541 %rv8 = insertelement <16 x i16> %rv7 , i16 %r8 , i32 8
542 %rv9 = insertelement <16 x i16> %rv8 , i16 %r9 , i32 9
543 %rv10 = insertelement <16 x i16> %rv9 , i16 %r10, i32 10
544 %rv11 = insertelement <16 x i16> %rv10, i16 %r11, i32 11
545 %rv12 = insertelement <16 x i16> %rv11, i16 %r12, i32 12
546 %rv13 = insertelement <16 x i16> %rv12, i16 %r13, i32 13
547 %rv14 = insertelement <16 x i16> %rv13, i16 %r14, i32 14
548 %rv15 = insertelement <16 x i16> %rv14, i16 %r15, i32 15