505 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt < %s -mtriple=x86_64-unknown -passes=slp-vectorizer -S | FileCheck %s --check-prefixes=CHECK,SSE3; RUN: opt < %s -mtriple=x86_64-unknown -mcpu=slm -passes=slp-vectorizer -S | FileCheck %s --check-prefixes=CHECK,SLM4; RUN: opt < %s -mtriple=x86_64-unknown -mcpu=corei7-avx -passes=slp-vectorizer -S | FileCheck %s --check-prefixes=CHECK,AVX5; RUN: opt < %s -mtriple=x86_64-unknown -mcpu=core-avx2 -passes=slp-vectorizer -S | FileCheck %s --check-prefixes=CHECK,AVX6; RUN: opt < %s -mtriple=x86_64-unknown -mcpu=knl -passes=slp-vectorizer -S | FileCheck %s --check-prefixes=CHECK,AVX7; RUN: opt < %s -mtriple=x86_64-unknown -mcpu=skx -passes=slp-vectorizer -S | FileCheck %s --check-prefixes=CHECK,AVX8 9;10; 128-bit vectors11;12 13define <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]]19;20 %a0 = extractelement <2 x double> %a, i32 021 %a1 = extractelement <2 x double> %a, i32 122 %b0 = extractelement <2 x double> %b, i32 023 %b1 = extractelement <2 x double> %b, i32 124 %r0 = fadd double %a0, %a125 %r1 = fadd double %b0, %b126 %r00 = insertelement <2 x double> poison, double %r0, i32 027 %r01 = insertelement <2 x double> %r00, double %r1, i32 128 ret <2 x double> %r0129}30 31define <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]]37;38 %a0 = extractelement <4 x float> %a, i32 039 %a1 = extractelement <4 x float> %a, i32 140 %a2 = extractelement <4 x float> %a, i32 241 %a3 = extractelement <4 x float> %a, i32 342 %b0 = extractelement <4 x float> %b, i32 043 %b1 = extractelement <4 x float> %b, i32 144 %b2 = extractelement <4 x float> %b, i32 245 %b3 = extractelement <4 x float> %b, i32 346 %r0 = fadd float %a0, %a147 %r1 = fadd float %a2, %a348 %r2 = fadd float %b0, %b149 %r3 = fadd float %b2, %b350 %r00 = insertelement <4 x float> poison, float %r0, i32 051 %r01 = insertelement <4 x float> %r00, float %r1, i32 152 %r02 = insertelement <4 x float> %r01, float %r2, i32 253 %r03 = insertelement <4 x float> %r02, float %r3, i32 354 ret <4 x float> %r0355}56 57define <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]]63;64 %a0 = extractelement <2 x i64> %a, i32 065 %a1 = extractelement <2 x i64> %a, i32 166 %b0 = extractelement <2 x i64> %b, i32 067 %b1 = extractelement <2 x i64> %b, i32 168 %r0 = add i64 %a0, %a169 %r1 = add i64 %b0, %b170 %r00 = insertelement <2 x i64> poison, i64 %r0, i32 071 %r01 = insertelement <2 x i64> %r00, i64 %r1, i32 172 ret <2 x i64> %r0173}74 75define <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]]81;82 %a0 = extractelement <4 x i32> %a, i32 083 %a1 = extractelement <4 x i32> %a, i32 184 %a2 = extractelement <4 x i32> %a, i32 285 %a3 = extractelement <4 x i32> %a, i32 386 %b0 = extractelement <4 x i32> %b, i32 087 %b1 = extractelement <4 x i32> %b, i32 188 %b2 = extractelement <4 x i32> %b, i32 289 %b3 = extractelement <4 x i32> %b, i32 390 %r0 = add i32 %a0, %a191 %r1 = add i32 %a2, %a392 %r2 = add i32 %b0, %b193 %r3 = add i32 %b2, %b394 %r00 = insertelement <4 x i32> poison, i32 %r0, i32 095 %r01 = insertelement <4 x i32> %r00, i32 %r1, i32 196 %r02 = insertelement <4 x i32> %r01, i32 %r2, i32 297 %r03 = insertelement <4 x i32> %r02, i32 %r3, i32 398 ret <4 x i32> %r0399}100 101define <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]]107;108 %a0 = extractelement <8 x i16> %a, i32 0109 %a1 = extractelement <8 x i16> %a, i32 1110 %a2 = extractelement <8 x i16> %a, i32 2111 %a3 = extractelement <8 x i16> %a, i32 3112 %a4 = extractelement <8 x i16> %a, i32 4113 %a5 = extractelement <8 x i16> %a, i32 5114 %a6 = extractelement <8 x i16> %a, i32 6115 %a7 = extractelement <8 x i16> %a, i32 7116 %b0 = extractelement <8 x i16> %b, i32 0117 %b1 = extractelement <8 x i16> %b, i32 1118 %b2 = extractelement <8 x i16> %b, i32 2119 %b3 = extractelement <8 x i16> %b, i32 3120 %b4 = extractelement <8 x i16> %b, i32 4121 %b5 = extractelement <8 x i16> %b, i32 5122 %b6 = extractelement <8 x i16> %b, i32 6123 %b7 = extractelement <8 x i16> %b, i32 7124 %r0 = add i16 %a0, %a1125 %r1 = add i16 %a2, %a3126 %r2 = add i16 %a4, %a5127 %r3 = add i16 %a6, %a7128 %r4 = add i16 %b0, %b1129 %r5 = add i16 %b2, %b3130 %r6 = add i16 %b4, %b5131 %r7 = add i16 %b6, %b7132 %r00 = insertelement <8 x i16> poison, i16 %r0, i32 0133 %r01 = insertelement <8 x i16> %r00, i16 %r1, i32 1134 %r02 = insertelement <8 x i16> %r01, i16 %r2, i32 2135 %r03 = insertelement <8 x i16> %r02, i16 %r3, i32 3136 %r04 = insertelement <8 x i16> %r03, i16 %r4, i32 4137 %r05 = insertelement <8 x i16> %r04, i16 %r5, i32 5138 %r06 = insertelement <8 x i16> %r05, i16 %r6, i32 6139 %r07 = insertelement <8 x i16> %r06, i16 %r7, i32 7140 ret <8 x i16> %r07141}142 143; PR41892144define 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 4150; CHECK-NEXT: ret void151;152 %x0 = extractelement <4 x float> %f, i64 0153 %x1 = extractelement <4 x float> %f, i64 1154 %add01 = fadd float %x0, %x1155 store float %add01, ptr %p, align 4156 %x2 = extractelement <4 x float> %f, i64 2157 %x3 = extractelement <4 x float> %f, i64 3158 %add23 = fadd float %x2, %x3159 %p23 = getelementptr inbounds float, ptr %p, i64 1160 store float %add23, ptr %p23, align 4161 ret void162}163 164;165; 256-bit vectors166;167 168define <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: [[TMP5:%.*]] = shufflevector <2 x double> [[TMP1]], <2 x double> [[TMP2]], <4 x i32> <i32 0, i32 1, i32 2, i32 3>173; SSE-NEXT: [[TMP3:%.*]] = shufflevector <4 x double> [[A]], <4 x double> [[B]], <2 x i32> <i32 1, i32 5>174; SSE-NEXT: [[TMP4:%.*]] = shufflevector <4 x double> [[A]], <4 x double> [[B]], <2 x i32> <i32 3, i32 7>175; SSE-NEXT: [[TMP6:%.*]] = shufflevector <2 x double> [[TMP3]], <2 x double> [[TMP4]], <4 x i32> <i32 0, i32 1, i32 2, i32 3>176; SSE-NEXT: [[TMP7:%.*]] = fadd <4 x double> [[TMP5]], [[TMP6]]177; SSE-NEXT: ret <4 x double> [[TMP7]]178;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: [[TMP5:%.*]] = shufflevector <2 x double> [[TMP1]], <2 x double> [[TMP2]], <4 x i32> <i32 0, i32 1, i32 2, i32 3>183; SLM-NEXT: [[TMP3:%.*]] = shufflevector <4 x double> [[A]], <4 x double> [[B]], <2 x i32> <i32 1, i32 5>184; SLM-NEXT: [[TMP4:%.*]] = shufflevector <4 x double> [[A]], <4 x double> [[B]], <2 x i32> <i32 3, i32 7>185; SLM-NEXT: [[TMP6:%.*]] = shufflevector <2 x double> [[TMP3]], <2 x double> [[TMP4]], <4 x i32> <i32 0, i32 1, i32 2, i32 3>186; SLM-NEXT: [[TMP7:%.*]] = fadd <4 x double> [[TMP5]], [[TMP6]]187; SLM-NEXT: ret <4 x double> [[TMP7]]188;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]]194;195 %a0 = extractelement <4 x double> %a, i32 0196 %a1 = extractelement <4 x double> %a, i32 1197 %a2 = extractelement <4 x double> %a, i32 2198 %a3 = extractelement <4 x double> %a, i32 3199 %b0 = extractelement <4 x double> %b, i32 0200 %b1 = extractelement <4 x double> %b, i32 1201 %b2 = extractelement <4 x double> %b, i32 2202 %b3 = extractelement <4 x double> %b, i32 3203 %r0 = fadd double %a0, %a1204 %r1 = fadd double %b0, %b1205 %r2 = fadd double %a2, %a3206 %r3 = fadd double %b2, %b3207 %r00 = insertelement <4 x double> poison, double %r0, i32 0208 %r01 = insertelement <4 x double> %r00, double %r1, i32 1209 %r02 = insertelement <4 x double> %r01, double %r2, i32 2210 %r03 = insertelement <4 x double> %r02, double %r3, i32 3211 ret <4 x double> %r03212}213 214; PR50392215define <4 x double> @test_v4f64_partial_swizzle(<4 x double> %a, <4 x double> %b) {216; CHECK-LABEL: @test_v4f64_partial_swizzle(217; CHECK-NEXT: [[B2:%.*]] = extractelement <4 x double> [[B:%.*]], i32 2218; CHECK-NEXT: [[B3:%.*]] = extractelement <4 x double> [[B]], i32 3219; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <4 x double> [[A:%.*]], <4 x double> [[B]], <2 x i32> <i32 0, i32 4>220; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <4 x double> [[A]], <4 x double> [[B]], <2 x i32> <i32 1, i32 5>221; CHECK-NEXT: [[TMP3:%.*]] = fadd <2 x double> [[TMP1]], [[TMP2]]222; CHECK-NEXT: [[R3:%.*]] = fadd double [[B2]], [[B3]]223; CHECK-NEXT: [[TMP4:%.*]] = shufflevector <2 x double> [[TMP3]], <2 x double> poison, <4 x i32> <i32 0, i32 poison, i32 1, i32 poison>224; CHECK-NEXT: [[R03:%.*]] = insertelement <4 x double> [[TMP4]], double [[R3]], i32 3225; CHECK-NEXT: ret <4 x double> [[R03]]226;227 %a0 = extractelement <4 x double> %a, i64 0228 %a1 = extractelement <4 x double> %a, i64 1229 %b0 = extractelement <4 x double> %b, i64 0230 %b1 = extractelement <4 x double> %b, i64 1231 %b2 = extractelement <4 x double> %b, i32 2232 %b3 = extractelement <4 x double> %b, i32 3233 %r0 = fadd double %a0, %a1234 %r2 = fadd double %b0, %b1235 %r3 = fadd double %b2, %b3236 %r00 = insertelement <4 x double> poison, double %r0, i32 0237 %r02 = insertelement <4 x double> %r00, double %r2, i32 2238 %r03 = insertelement <4 x double> %r02, double %r3, i32 3239 ret <4 x double> %r03240}241 242define <8 x float> @test_v8f32(<8 x float> %a, <8 x float> %b) {243; SSE-LABEL: @test_v8f32(244; SSE-NEXT: [[TMP1:%.*]] = shufflevector <8 x float> [[A:%.*]], <8 x float> [[B:%.*]], <4 x i32> <i32 0, i32 2, i32 8, i32 10>245; SSE-NEXT: [[TMP2:%.*]] = shufflevector <8 x float> [[A]], <8 x float> [[B]], <4 x i32> <i32 4, i32 6, i32 12, i32 14>246; SSE-NEXT: [[TMP5:%.*]] = shufflevector <4 x float> [[TMP1]], <4 x float> [[TMP2]], <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>247; SSE-NEXT: [[TMP3:%.*]] = shufflevector <8 x float> [[A]], <8 x float> [[B]], <4 x i32> <i32 1, i32 3, i32 9, i32 11>248; SSE-NEXT: [[TMP4:%.*]] = shufflevector <8 x float> [[A]], <8 x float> [[B]], <4 x i32> <i32 5, i32 7, i32 13, i32 15>249; SSE-NEXT: [[TMP6:%.*]] = shufflevector <4 x float> [[TMP3]], <4 x float> [[TMP4]], <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>250; SSE-NEXT: [[TMP7:%.*]] = fadd <8 x float> [[TMP5]], [[TMP6]]251; SSE-NEXT: ret <8 x float> [[TMP7]]252;253; SLM-LABEL: @test_v8f32(254; SLM-NEXT: [[TMP1:%.*]] = shufflevector <8 x float> [[A:%.*]], <8 x float> [[B:%.*]], <4 x i32> <i32 0, i32 2, i32 8, i32 10>255; SLM-NEXT: [[TMP2:%.*]] = shufflevector <8 x float> [[A]], <8 x float> [[B]], <4 x i32> <i32 4, i32 6, i32 12, i32 14>256; SLM-NEXT: [[TMP5:%.*]] = shufflevector <4 x float> [[TMP1]], <4 x float> [[TMP2]], <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>257; SLM-NEXT: [[TMP3:%.*]] = shufflevector <8 x float> [[A]], <8 x float> [[B]], <4 x i32> <i32 1, i32 3, i32 9, i32 11>258; SLM-NEXT: [[TMP4:%.*]] = shufflevector <8 x float> [[A]], <8 x float> [[B]], <4 x i32> <i32 5, i32 7, i32 13, i32 15>259; SLM-NEXT: [[TMP6:%.*]] = shufflevector <4 x float> [[TMP3]], <4 x float> [[TMP4]], <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>260; SLM-NEXT: [[TMP7:%.*]] = fadd <8 x float> [[TMP5]], [[TMP6]]261; SLM-NEXT: ret <8 x float> [[TMP7]]262;263; AVX-LABEL: @test_v8f32(264; 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>265; 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>266; AVX-NEXT: [[TMP3:%.*]] = fadd <8 x float> [[TMP1]], [[TMP2]]267; AVX-NEXT: ret <8 x float> [[TMP3]]268;269 %a0 = extractelement <8 x float> %a, i32 0270 %a1 = extractelement <8 x float> %a, i32 1271 %a2 = extractelement <8 x float> %a, i32 2272 %a3 = extractelement <8 x float> %a, i32 3273 %a4 = extractelement <8 x float> %a, i32 4274 %a5 = extractelement <8 x float> %a, i32 5275 %a6 = extractelement <8 x float> %a, i32 6276 %a7 = extractelement <8 x float> %a, i32 7277 %b0 = extractelement <8 x float> %b, i32 0278 %b1 = extractelement <8 x float> %b, i32 1279 %b2 = extractelement <8 x float> %b, i32 2280 %b3 = extractelement <8 x float> %b, i32 3281 %b4 = extractelement <8 x float> %b, i32 4282 %b5 = extractelement <8 x float> %b, i32 5283 %b6 = extractelement <8 x float> %b, i32 6284 %b7 = extractelement <8 x float> %b, i32 7285 %r0 = fadd float %a0, %a1286 %r1 = fadd float %a2, %a3287 %r2 = fadd float %b0, %b1288 %r3 = fadd float %b2, %b3289 %r4 = fadd float %a4, %a5290 %r5 = fadd float %a6, %a7291 %r6 = fadd float %b4, %b5292 %r7 = fadd float %b6, %b7293 %r00 = insertelement <8 x float> poison, float %r0, i32 0294 %r01 = insertelement <8 x float> %r00, float %r1, i32 1295 %r02 = insertelement <8 x float> %r01, float %r2, i32 2296 %r03 = insertelement <8 x float> %r02, float %r3, i32 3297 %r04 = insertelement <8 x float> %r03, float %r4, i32 4298 %r05 = insertelement <8 x float> %r04, float %r5, i32 5299 %r06 = insertelement <8 x float> %r05, float %r6, i32 6300 %r07 = insertelement <8 x float> %r06, float %r7, i32 7301 ret <8 x float> %r07302}303 304define <4 x i64> @test_v4i64(<4 x i64> %a, <4 x i64> %b) {305; SSE-LABEL: @test_v4i64(306; SSE-NEXT: [[TMP1:%.*]] = shufflevector <4 x i64> [[A:%.*]], <4 x i64> [[B:%.*]], <2 x i32> <i32 0, i32 4>307; SSE-NEXT: [[TMP2:%.*]] = shufflevector <4 x i64> [[A]], <4 x i64> [[B]], <2 x i32> <i32 2, i32 6>308; SSE-NEXT: [[TMP5:%.*]] = shufflevector <2 x i64> [[TMP1]], <2 x i64> [[TMP2]], <4 x i32> <i32 0, i32 1, i32 2, i32 3>309; SSE-NEXT: [[TMP3:%.*]] = shufflevector <4 x i64> [[A]], <4 x i64> [[B]], <2 x i32> <i32 1, i32 5>310; SSE-NEXT: [[TMP4:%.*]] = shufflevector <4 x i64> [[A]], <4 x i64> [[B]], <2 x i32> <i32 3, i32 7>311; SSE-NEXT: [[TMP6:%.*]] = shufflevector <2 x i64> [[TMP3]], <2 x i64> [[TMP4]], <4 x i32> <i32 0, i32 1, i32 2, i32 3>312; SSE-NEXT: [[TMP7:%.*]] = add <4 x i64> [[TMP5]], [[TMP6]]313; SSE-NEXT: ret <4 x i64> [[TMP7]]314;315; SLM-LABEL: @test_v4i64(316; SLM-NEXT: [[TMP1:%.*]] = shufflevector <4 x i64> [[A:%.*]], <4 x i64> [[B:%.*]], <2 x i32> <i32 0, i32 4>317; SLM-NEXT: [[TMP2:%.*]] = shufflevector <4 x i64> [[A]], <4 x i64> [[B]], <2 x i32> <i32 2, i32 6>318; SLM-NEXT: [[TMP5:%.*]] = shufflevector <2 x i64> [[TMP1]], <2 x i64> [[TMP2]], <4 x i32> <i32 0, i32 1, i32 2, i32 3>319; SLM-NEXT: [[TMP3:%.*]] = shufflevector <4 x i64> [[A]], <4 x i64> [[B]], <2 x i32> <i32 1, i32 5>320; SLM-NEXT: [[TMP4:%.*]] = shufflevector <4 x i64> [[A]], <4 x i64> [[B]], <2 x i32> <i32 3, i32 7>321; SLM-NEXT: [[TMP6:%.*]] = shufflevector <2 x i64> [[TMP3]], <2 x i64> [[TMP4]], <4 x i32> <i32 0, i32 1, i32 2, i32 3>322; SLM-NEXT: [[TMP7:%.*]] = add <4 x i64> [[TMP5]], [[TMP6]]323; SLM-NEXT: ret <4 x i64> [[TMP7]]324;325; AVX-LABEL: @test_v4i64(326; AVX-NEXT: [[TMP1:%.*]] = shufflevector <4 x i64> [[A:%.*]], <4 x i64> [[B:%.*]], <4 x i32> <i32 0, i32 4, i32 2, i32 6>327; AVX-NEXT: [[TMP2:%.*]] = shufflevector <4 x i64> [[A]], <4 x i64> [[B]], <4 x i32> <i32 1, i32 5, i32 3, i32 7>328; AVX-NEXT: [[TMP3:%.*]] = add <4 x i64> [[TMP1]], [[TMP2]]329; AVX-NEXT: ret <4 x i64> [[TMP3]]330;331 %a0 = extractelement <4 x i64> %a, i32 0332 %a1 = extractelement <4 x i64> %a, i32 1333 %a2 = extractelement <4 x i64> %a, i32 2334 %a3 = extractelement <4 x i64> %a, i32 3335 %b0 = extractelement <4 x i64> %b, i32 0336 %b1 = extractelement <4 x i64> %b, i32 1337 %b2 = extractelement <4 x i64> %b, i32 2338 %b3 = extractelement <4 x i64> %b, i32 3339 %r0 = add i64 %a0, %a1340 %r1 = add i64 %b0, %b1341 %r2 = add i64 %a2, %a3342 %r3 = add i64 %b2, %b3343 %r00 = insertelement <4 x i64> poison, i64 %r0, i32 0344 %r01 = insertelement <4 x i64> %r00, i64 %r1, i32 1345 %r02 = insertelement <4 x i64> %r01, i64 %r2, i32 2346 %r03 = insertelement <4 x i64> %r02, i64 %r3, i32 3347 ret <4 x i64> %r03348}349 350define <8 x i32> @test_v8i32(<8 x i32> %a, <8 x i32> %b) {351; SSE-LABEL: @test_v8i32(352; SSE-NEXT: [[TMP1:%.*]] = shufflevector <8 x i32> [[A:%.*]], <8 x i32> [[B:%.*]], <4 x i32> <i32 0, i32 2, i32 8, i32 10>353; SSE-NEXT: [[TMP2:%.*]] = shufflevector <8 x i32> [[A]], <8 x i32> [[B]], <4 x i32> <i32 4, i32 6, i32 12, i32 14>354; SSE-NEXT: [[TMP5:%.*]] = shufflevector <4 x i32> [[TMP1]], <4 x i32> [[TMP2]], <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>355; SSE-NEXT: [[TMP3:%.*]] = shufflevector <8 x i32> [[A]], <8 x i32> [[B]], <4 x i32> <i32 1, i32 3, i32 9, i32 11>356; SSE-NEXT: [[TMP4:%.*]] = shufflevector <8 x i32> [[A]], <8 x i32> [[B]], <4 x i32> <i32 5, i32 7, i32 13, i32 15>357; SSE-NEXT: [[TMP6:%.*]] = shufflevector <4 x i32> [[TMP3]], <4 x i32> [[TMP4]], <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>358; SSE-NEXT: [[TMP7:%.*]] = add <8 x i32> [[TMP5]], [[TMP6]]359; SSE-NEXT: ret <8 x i32> [[TMP7]]360;361; SLM-LABEL: @test_v8i32(362; SLM-NEXT: [[TMP1:%.*]] = shufflevector <8 x i32> [[A:%.*]], <8 x i32> [[B:%.*]], <4 x i32> <i32 0, i32 2, i32 8, i32 10>363; SLM-NEXT: [[TMP2:%.*]] = shufflevector <8 x i32> [[A]], <8 x i32> [[B]], <4 x i32> <i32 4, i32 6, i32 12, i32 14>364; SLM-NEXT: [[TMP5:%.*]] = shufflevector <4 x i32> [[TMP1]], <4 x i32> [[TMP2]], <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>365; SLM-NEXT: [[TMP3:%.*]] = shufflevector <8 x i32> [[A]], <8 x i32> [[B]], <4 x i32> <i32 1, i32 3, i32 9, i32 11>366; SLM-NEXT: [[TMP4:%.*]] = shufflevector <8 x i32> [[A]], <8 x i32> [[B]], <4 x i32> <i32 5, i32 7, i32 13, i32 15>367; SLM-NEXT: [[TMP6:%.*]] = shufflevector <4 x i32> [[TMP3]], <4 x i32> [[TMP4]], <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>368; SLM-NEXT: [[TMP7:%.*]] = add <8 x i32> [[TMP5]], [[TMP6]]369; SLM-NEXT: ret <8 x i32> [[TMP7]]370;371; AVX-LABEL: @test_v8i32(372; 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>373; 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>374; AVX-NEXT: [[TMP3:%.*]] = add <8 x i32> [[TMP1]], [[TMP2]]375; AVX-NEXT: ret <8 x i32> [[TMP3]]376;377 %a0 = extractelement <8 x i32> %a, i32 0378 %a1 = extractelement <8 x i32> %a, i32 1379 %a2 = extractelement <8 x i32> %a, i32 2380 %a3 = extractelement <8 x i32> %a, i32 3381 %a4 = extractelement <8 x i32> %a, i32 4382 %a5 = extractelement <8 x i32> %a, i32 5383 %a6 = extractelement <8 x i32> %a, i32 6384 %a7 = extractelement <8 x i32> %a, i32 7385 %b0 = extractelement <8 x i32> %b, i32 0386 %b1 = extractelement <8 x i32> %b, i32 1387 %b2 = extractelement <8 x i32> %b, i32 2388 %b3 = extractelement <8 x i32> %b, i32 3389 %b4 = extractelement <8 x i32> %b, i32 4390 %b5 = extractelement <8 x i32> %b, i32 5391 %b6 = extractelement <8 x i32> %b, i32 6392 %b7 = extractelement <8 x i32> %b, i32 7393 %r0 = add i32 %a0, %a1394 %r1 = add i32 %a2, %a3395 %r2 = add i32 %b0, %b1396 %r3 = add i32 %b2, %b3397 %r4 = add i32 %a4, %a5398 %r5 = add i32 %a6, %a7399 %r6 = add i32 %b4, %b5400 %r7 = add i32 %b6, %b7401 %r00 = insertelement <8 x i32> poison, i32 %r0, i32 0402 %r01 = insertelement <8 x i32> %r00, i32 %r1, i32 1403 %r02 = insertelement <8 x i32> %r01, i32 %r2, i32 2404 %r03 = insertelement <8 x i32> %r02, i32 %r3, i32 3405 %r04 = insertelement <8 x i32> %r03, i32 %r4, i32 4406 %r05 = insertelement <8 x i32> %r04, i32 %r5, i32 5407 %r06 = insertelement <8 x i32> %r05, i32 %r6, i32 6408 %r07 = insertelement <8 x i32> %r06, i32 %r7, i32 7409 ret <8 x i32> %r07410}411 412define <16 x i16> @test_v16i16(<16 x i16> %a, <16 x i16> %b) {413; SSE-LABEL: @test_v16i16(414; 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>415; 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>416; SSE-NEXT: [[TMP5:%.*]] = shufflevector <8 x i16> [[TMP1]], <8 x i16> [[TMP2]], <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>417; 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>418; 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>419; SSE-NEXT: [[TMP6:%.*]] = shufflevector <8 x i16> [[TMP3]], <8 x i16> [[TMP4]], <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>420; SSE-NEXT: [[TMP7:%.*]] = add <16 x i16> [[TMP5]], [[TMP6]]421; SSE-NEXT: ret <16 x i16> [[TMP7]]422;423; SLM-LABEL: @test_v16i16(424; 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>425; 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>426; SLM-NEXT: [[TMP5:%.*]] = shufflevector <8 x i16> [[TMP1]], <8 x i16> [[TMP2]], <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>427; 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>428; 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>429; SLM-NEXT: [[TMP6:%.*]] = shufflevector <8 x i16> [[TMP3]], <8 x i16> [[TMP4]], <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>430; SLM-NEXT: [[TMP7:%.*]] = add <16 x i16> [[TMP5]], [[TMP6]]431; SLM-NEXT: ret <16 x i16> [[TMP7]]432;433; AVX-LABEL: @test_v16i16(434; 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>435; 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>436; AVX-NEXT: [[TMP3:%.*]] = add <16 x i16> [[TMP1]], [[TMP2]]437; AVX-NEXT: ret <16 x i16> [[TMP3]]438;439 %a0 = extractelement <16 x i16> %a, i32 0440 %a1 = extractelement <16 x i16> %a, i32 1441 %a2 = extractelement <16 x i16> %a, i32 2442 %a3 = extractelement <16 x i16> %a, i32 3443 %a4 = extractelement <16 x i16> %a, i32 4444 %a5 = extractelement <16 x i16> %a, i32 5445 %a6 = extractelement <16 x i16> %a, i32 6446 %a7 = extractelement <16 x i16> %a, i32 7447 %a8 = extractelement <16 x i16> %a, i32 8448 %a9 = extractelement <16 x i16> %a, i32 9449 %a10 = extractelement <16 x i16> %a, i32 10450 %a11 = extractelement <16 x i16> %a, i32 11451 %a12 = extractelement <16 x i16> %a, i32 12452 %a13 = extractelement <16 x i16> %a, i32 13453 %a14 = extractelement <16 x i16> %a, i32 14454 %a15 = extractelement <16 x i16> %a, i32 15455 %b0 = extractelement <16 x i16> %b, i32 0456 %b1 = extractelement <16 x i16> %b, i32 1457 %b2 = extractelement <16 x i16> %b, i32 2458 %b3 = extractelement <16 x i16> %b, i32 3459 %b4 = extractelement <16 x i16> %b, i32 4460 %b5 = extractelement <16 x i16> %b, i32 5461 %b6 = extractelement <16 x i16> %b, i32 6462 %b7 = extractelement <16 x i16> %b, i32 7463 %b8 = extractelement <16 x i16> %b, i32 8464 %b9 = extractelement <16 x i16> %b, i32 9465 %b10 = extractelement <16 x i16> %b, i32 10466 %b11 = extractelement <16 x i16> %b, i32 11467 %b12 = extractelement <16 x i16> %b, i32 12468 %b13 = extractelement <16 x i16> %b, i32 13469 %b14 = extractelement <16 x i16> %b, i32 14470 %b15 = extractelement <16 x i16> %b, i32 15471 %r0 = add i16 %a0 , %a1472 %r1 = add i16 %a2 , %a3473 %r2 = add i16 %a4 , %a5474 %r3 = add i16 %a6 , %a7475 %r4 = add i16 %b0 , %b1476 %r5 = add i16 %b2 , %b3477 %r6 = add i16 %b4 , %b5478 %r7 = add i16 %b6 , %b7479 %r8 = add i16 %a8 , %a9480 %r9 = add i16 %a10, %a11481 %r10 = add i16 %a12, %a13482 %r11 = add i16 %a14, %a15483 %r12 = add i16 %b8 , %b9484 %r13 = add i16 %b10, %b11485 %r14 = add i16 %b12, %b13486 %r15 = add i16 %b14, %b15487 %rv0 = insertelement <16 x i16> poison, i16 %r0 , i32 0488 %rv1 = insertelement <16 x i16> %rv0 , i16 %r1 , i32 1489 %rv2 = insertelement <16 x i16> %rv1 , i16 %r2 , i32 2490 %rv3 = insertelement <16 x i16> %rv2 , i16 %r3 , i32 3491 %rv4 = insertelement <16 x i16> %rv3 , i16 %r4 , i32 4492 %rv5 = insertelement <16 x i16> %rv4 , i16 %r5 , i32 5493 %rv6 = insertelement <16 x i16> %rv5 , i16 %r6 , i32 6494 %rv7 = insertelement <16 x i16> %rv6 , i16 %r7 , i32 7495 %rv8 = insertelement <16 x i16> %rv7 , i16 %r8 , i32 8496 %rv9 = insertelement <16 x i16> %rv8 , i16 %r9 , i32 9497 %rv10 = insertelement <16 x i16> %rv9 , i16 %r10, i32 10498 %rv11 = insertelement <16 x i16> %rv10, i16 %r11, i32 11499 %rv12 = insertelement <16 x i16> %rv11, i16 %r12, i32 12500 %rv13 = insertelement <16 x i16> %rv12, i16 %r13, i32 13501 %rv14 = insertelement <16 x i16> %rv13, i16 %r14, i32 14502 %rv15 = insertelement <16 x i16> %rv14, i16 %r15, i32 15503 ret <16 x i16> %rv15504}505