530 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> zeroinitializer, 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> zeroinitializer, 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> zeroinitializer, 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> zeroinitializer, 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> zeroinitializer, 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> zeroinitializer, 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; SSE-LABEL: @test_v4f64_partial_swizzle(217; SSE-NEXT: [[B2:%.*]] = extractelement <4 x double> [[B:%.*]], i32 2218; SSE-NEXT: [[B3:%.*]] = extractelement <4 x double> [[B]], i32 3219; 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> poison, <4 x i32> <i32 0, i32 poison, i32 1, i32 poison>224; SSE-NEXT: [[R021:%.*]] = shufflevector <4 x double> zeroinitializer, <4 x double> [[TMP4]], <4 x i32> <i32 4, i32 1, i32 6, i32 3>225; SSE-NEXT: [[R03:%.*]] = insertelement <4 x double> [[R021]], double [[R3]], i32 3226; SSE-NEXT: ret <4 x double> [[R03]]227;228; SLM-LABEL: @test_v4f64_partial_swizzle(229; SLM-NEXT: [[A0:%.*]] = extractelement <4 x double> [[A:%.*]], i64 0230; SLM-NEXT: [[A1:%.*]] = extractelement <4 x double> [[A]], i64 1231; SLM-NEXT: [[R0:%.*]] = fadd double [[A0]], [[A1]]232; SLM-NEXT: [[TMP1:%.*]] = shufflevector <4 x double> [[B:%.*]], <4 x double> poison, <2 x i32> <i32 1, i32 2>233; SLM-NEXT: [[TMP2:%.*]] = shufflevector <4 x double> [[B]], <4 x double> poison, <2 x i32> <i32 0, i32 3>234; SLM-NEXT: [[TMP3:%.*]] = fadd <2 x double> [[TMP1]], [[TMP2]]235; SLM-NEXT: [[R00:%.*]] = insertelement <4 x double> zeroinitializer, double [[R0]], i32 0236; SLM-NEXT: [[TMP4:%.*]] = shufflevector <2 x double> [[TMP3]], <2 x double> poison, <4 x i32> <i32 0, i32 1, i32 poison, i32 poison>237; SLM-NEXT: [[R031:%.*]] = shufflevector <4 x double> [[R00]], <4 x double> [[TMP4]], <4 x i32> <i32 0, i32 1, i32 4, i32 5>238; SLM-NEXT: ret <4 x double> [[R031]]239;240; AVX-LABEL: @test_v4f64_partial_swizzle(241; AVX-NEXT: [[B2:%.*]] = extractelement <4 x double> [[B:%.*]], i32 2242; AVX-NEXT: [[B3:%.*]] = extractelement <4 x double> [[B]], i32 3243; AVX-NEXT: [[TMP1:%.*]] = shufflevector <4 x double> [[A:%.*]], <4 x double> [[B]], <2 x i32> <i32 0, i32 4>244; AVX-NEXT: [[TMP2:%.*]] = shufflevector <4 x double> [[A]], <4 x double> [[B]], <2 x i32> <i32 1, i32 5>245; AVX-NEXT: [[TMP3:%.*]] = fadd <2 x double> [[TMP1]], [[TMP2]]246; AVX-NEXT: [[R3:%.*]] = fadd double [[B2]], [[B3]]247; AVX-NEXT: [[TMP4:%.*]] = shufflevector <2 x double> [[TMP3]], <2 x double> poison, <4 x i32> <i32 0, i32 poison, i32 1, i32 poison>248; AVX-NEXT: [[R021:%.*]] = shufflevector <4 x double> zeroinitializer, <4 x double> [[TMP4]], <4 x i32> <i32 4, i32 1, i32 6, i32 3>249; AVX-NEXT: [[R03:%.*]] = insertelement <4 x double> [[R021]], double [[R3]], i32 3250; AVX-NEXT: ret <4 x double> [[R03]]251;252 %a0 = extractelement <4 x double> %a, i64 0253 %a1 = extractelement <4 x double> %a, i64 1254 %b0 = extractelement <4 x double> %b, i64 0255 %b1 = extractelement <4 x double> %b, i64 1256 %b2 = extractelement <4 x double> %b, i32 2257 %b3 = extractelement <4 x double> %b, i32 3258 %r0 = fadd double %a0, %a1259 %r2 = fadd double %b0, %b1260 %r3 = fadd double %b2, %b3261 %r00 = insertelement <4 x double> zeroinitializer, double %r0, i32 0262 %r02 = insertelement <4 x double> %r00, double %r2, i32 2263 %r03 = insertelement <4 x double> %r02, double %r3, i32 3264 ret <4 x double> %r03265}266 267define <8 x float> @test_v8f32(<8 x float> %a, <8 x float> %b) {268; SSE-LABEL: @test_v8f32(269; SSE-NEXT: [[TMP1:%.*]] = shufflevector <8 x float> [[A:%.*]], <8 x float> [[B:%.*]], <4 x i32> <i32 0, i32 2, i32 8, i32 10>270; SSE-NEXT: [[TMP2:%.*]] = shufflevector <8 x float> [[A]], <8 x float> [[B]], <4 x i32> <i32 4, i32 6, i32 12, i32 14>271; 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>272; SSE-NEXT: [[TMP3:%.*]] = shufflevector <8 x float> [[A]], <8 x float> [[B]], <4 x i32> <i32 1, i32 3, i32 9, i32 11>273; SSE-NEXT: [[TMP4:%.*]] = shufflevector <8 x float> [[A]], <8 x float> [[B]], <4 x i32> <i32 5, i32 7, i32 13, i32 15>274; 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>275; SSE-NEXT: [[TMP7:%.*]] = fadd <8 x float> [[TMP5]], [[TMP6]]276; SSE-NEXT: ret <8 x float> [[TMP7]]277;278; SLM-LABEL: @test_v8f32(279; SLM-NEXT: [[TMP1:%.*]] = shufflevector <8 x float> [[A:%.*]], <8 x float> [[B:%.*]], <4 x i32> <i32 0, i32 2, i32 8, i32 10>280; SLM-NEXT: [[TMP2:%.*]] = shufflevector <8 x float> [[A]], <8 x float> [[B]], <4 x i32> <i32 4, i32 6, i32 12, i32 14>281; 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>282; SLM-NEXT: [[TMP3:%.*]] = shufflevector <8 x float> [[A]], <8 x float> [[B]], <4 x i32> <i32 1, i32 3, i32 9, i32 11>283; SLM-NEXT: [[TMP4:%.*]] = shufflevector <8 x float> [[A]], <8 x float> [[B]], <4 x i32> <i32 5, i32 7, i32 13, i32 15>284; 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>285; SLM-NEXT: [[TMP7:%.*]] = fadd <8 x float> [[TMP5]], [[TMP6]]286; SLM-NEXT: ret <8 x float> [[TMP7]]287;288; AVX-LABEL: @test_v8f32(289; 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>290; 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>291; AVX-NEXT: [[TMP3:%.*]] = fadd <8 x float> [[TMP1]], [[TMP2]]292; AVX-NEXT: ret <8 x float> [[TMP3]]293;294 %a0 = extractelement <8 x float> %a, i32 0295 %a1 = extractelement <8 x float> %a, i32 1296 %a2 = extractelement <8 x float> %a, i32 2297 %a3 = extractelement <8 x float> %a, i32 3298 %a4 = extractelement <8 x float> %a, i32 4299 %a5 = extractelement <8 x float> %a, i32 5300 %a6 = extractelement <8 x float> %a, i32 6301 %a7 = extractelement <8 x float> %a, i32 7302 %b0 = extractelement <8 x float> %b, i32 0303 %b1 = extractelement <8 x float> %b, i32 1304 %b2 = extractelement <8 x float> %b, i32 2305 %b3 = extractelement <8 x float> %b, i32 3306 %b4 = extractelement <8 x float> %b, i32 4307 %b5 = extractelement <8 x float> %b, i32 5308 %b6 = extractelement <8 x float> %b, i32 6309 %b7 = extractelement <8 x float> %b, i32 7310 %r0 = fadd float %a0, %a1311 %r1 = fadd float %a2, %a3312 %r2 = fadd float %b0, %b1313 %r3 = fadd float %b2, %b3314 %r4 = fadd float %a4, %a5315 %r5 = fadd float %a6, %a7316 %r6 = fadd float %b4, %b5317 %r7 = fadd float %b6, %b7318 %r00 = insertelement <8 x float> zeroinitializer, float %r0, i32 0319 %r01 = insertelement <8 x float> %r00, float %r1, i32 1320 %r02 = insertelement <8 x float> %r01, float %r2, i32 2321 %r03 = insertelement <8 x float> %r02, float %r3, i32 3322 %r04 = insertelement <8 x float> %r03, float %r4, i32 4323 %r05 = insertelement <8 x float> %r04, float %r5, i32 5324 %r06 = insertelement <8 x float> %r05, float %r6, i32 6325 %r07 = insertelement <8 x float> %r06, float %r7, i32 7326 ret <8 x float> %r07327}328 329define <4 x i64> @test_v4i64(<4 x i64> %a, <4 x i64> %b) {330; SSE-LABEL: @test_v4i64(331; SSE-NEXT: [[TMP1:%.*]] = shufflevector <4 x i64> [[A:%.*]], <4 x i64> [[B:%.*]], <2 x i32> <i32 0, i32 4>332; SSE-NEXT: [[TMP2:%.*]] = shufflevector <4 x i64> [[A]], <4 x i64> [[B]], <2 x i32> <i32 2, i32 6>333; SSE-NEXT: [[TMP5:%.*]] = shufflevector <2 x i64> [[TMP1]], <2 x i64> [[TMP2]], <4 x i32> <i32 0, i32 1, i32 2, i32 3>334; SSE-NEXT: [[TMP3:%.*]] = shufflevector <4 x i64> [[A]], <4 x i64> [[B]], <2 x i32> <i32 1, i32 5>335; SSE-NEXT: [[TMP4:%.*]] = shufflevector <4 x i64> [[A]], <4 x i64> [[B]], <2 x i32> <i32 3, i32 7>336; SSE-NEXT: [[TMP6:%.*]] = shufflevector <2 x i64> [[TMP3]], <2 x i64> [[TMP4]], <4 x i32> <i32 0, i32 1, i32 2, i32 3>337; SSE-NEXT: [[TMP7:%.*]] = add <4 x i64> [[TMP5]], [[TMP6]]338; SSE-NEXT: ret <4 x i64> [[TMP7]]339;340; SLM-LABEL: @test_v4i64(341; SLM-NEXT: [[TMP1:%.*]] = shufflevector <4 x i64> [[A:%.*]], <4 x i64> [[B:%.*]], <2 x i32> <i32 0, i32 4>342; SLM-NEXT: [[TMP2:%.*]] = shufflevector <4 x i64> [[A]], <4 x i64> [[B]], <2 x i32> <i32 2, i32 6>343; SLM-NEXT: [[TMP5:%.*]] = shufflevector <2 x i64> [[TMP1]], <2 x i64> [[TMP2]], <4 x i32> <i32 0, i32 1, i32 2, i32 3>344; SLM-NEXT: [[TMP3:%.*]] = shufflevector <4 x i64> [[A]], <4 x i64> [[B]], <2 x i32> <i32 1, i32 5>345; SLM-NEXT: [[TMP4:%.*]] = shufflevector <4 x i64> [[A]], <4 x i64> [[B]], <2 x i32> <i32 3, i32 7>346; SLM-NEXT: [[TMP6:%.*]] = shufflevector <2 x i64> [[TMP3]], <2 x i64> [[TMP4]], <4 x i32> <i32 0, i32 1, i32 2, i32 3>347; SLM-NEXT: [[TMP7:%.*]] = add <4 x i64> [[TMP5]], [[TMP6]]348; SLM-NEXT: ret <4 x i64> [[TMP7]]349;350; AVX-LABEL: @test_v4i64(351; AVX-NEXT: [[TMP1:%.*]] = shufflevector <4 x i64> [[A:%.*]], <4 x i64> [[B:%.*]], <4 x i32> <i32 0, i32 4, i32 2, i32 6>352; AVX-NEXT: [[TMP2:%.*]] = shufflevector <4 x i64> [[A]], <4 x i64> [[B]], <4 x i32> <i32 1, i32 5, i32 3, i32 7>353; AVX-NEXT: [[TMP3:%.*]] = add <4 x i64> [[TMP1]], [[TMP2]]354; AVX-NEXT: ret <4 x i64> [[TMP3]]355;356 %a0 = extractelement <4 x i64> %a, i32 0357 %a1 = extractelement <4 x i64> %a, i32 1358 %a2 = extractelement <4 x i64> %a, i32 2359 %a3 = extractelement <4 x i64> %a, i32 3360 %b0 = extractelement <4 x i64> %b, i32 0361 %b1 = extractelement <4 x i64> %b, i32 1362 %b2 = extractelement <4 x i64> %b, i32 2363 %b3 = extractelement <4 x i64> %b, i32 3364 %r0 = add i64 %a0, %a1365 %r1 = add i64 %b0, %b1366 %r2 = add i64 %a2, %a3367 %r3 = add i64 %b2, %b3368 %r00 = insertelement <4 x i64> zeroinitializer, i64 %r0, i32 0369 %r01 = insertelement <4 x i64> %r00, i64 %r1, i32 1370 %r02 = insertelement <4 x i64> %r01, i64 %r2, i32 2371 %r03 = insertelement <4 x i64> %r02, i64 %r3, i32 3372 ret <4 x i64> %r03373}374 375define <8 x i32> @test_v8i32(<8 x i32> %a, <8 x i32> %b) {376; SSE-LABEL: @test_v8i32(377; SSE-NEXT: [[TMP1:%.*]] = shufflevector <8 x i32> [[A:%.*]], <8 x i32> [[B:%.*]], <4 x i32> <i32 0, i32 2, i32 8, i32 10>378; SSE-NEXT: [[TMP2:%.*]] = shufflevector <8 x i32> [[A]], <8 x i32> [[B]], <4 x i32> <i32 4, i32 6, i32 12, i32 14>379; 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>380; SSE-NEXT: [[TMP3:%.*]] = shufflevector <8 x i32> [[A]], <8 x i32> [[B]], <4 x i32> <i32 1, i32 3, i32 9, i32 11>381; SSE-NEXT: [[TMP4:%.*]] = shufflevector <8 x i32> [[A]], <8 x i32> [[B]], <4 x i32> <i32 5, i32 7, i32 13, i32 15>382; 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>383; SSE-NEXT: [[TMP7:%.*]] = add <8 x i32> [[TMP5]], [[TMP6]]384; SSE-NEXT: ret <8 x i32> [[TMP7]]385;386; SLM-LABEL: @test_v8i32(387; SLM-NEXT: [[TMP1:%.*]] = shufflevector <8 x i32> [[A:%.*]], <8 x i32> [[B:%.*]], <4 x i32> <i32 0, i32 2, i32 8, i32 10>388; SLM-NEXT: [[TMP2:%.*]] = shufflevector <8 x i32> [[A]], <8 x i32> [[B]], <4 x i32> <i32 4, i32 6, i32 12, i32 14>389; 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>390; SLM-NEXT: [[TMP3:%.*]] = shufflevector <8 x i32> [[A]], <8 x i32> [[B]], <4 x i32> <i32 1, i32 3, i32 9, i32 11>391; SLM-NEXT: [[TMP4:%.*]] = shufflevector <8 x i32> [[A]], <8 x i32> [[B]], <4 x i32> <i32 5, i32 7, i32 13, i32 15>392; 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>393; SLM-NEXT: [[TMP7:%.*]] = add <8 x i32> [[TMP5]], [[TMP6]]394; SLM-NEXT: ret <8 x i32> [[TMP7]]395;396; AVX-LABEL: @test_v8i32(397; 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>398; 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>399; AVX-NEXT: [[TMP3:%.*]] = add <8 x i32> [[TMP1]], [[TMP2]]400; AVX-NEXT: ret <8 x i32> [[TMP3]]401;402 %a0 = extractelement <8 x i32> %a, i32 0403 %a1 = extractelement <8 x i32> %a, i32 1404 %a2 = extractelement <8 x i32> %a, i32 2405 %a3 = extractelement <8 x i32> %a, i32 3406 %a4 = extractelement <8 x i32> %a, i32 4407 %a5 = extractelement <8 x i32> %a, i32 5408 %a6 = extractelement <8 x i32> %a, i32 6409 %a7 = extractelement <8 x i32> %a, i32 7410 %b0 = extractelement <8 x i32> %b, i32 0411 %b1 = extractelement <8 x i32> %b, i32 1412 %b2 = extractelement <8 x i32> %b, i32 2413 %b3 = extractelement <8 x i32> %b, i32 3414 %b4 = extractelement <8 x i32> %b, i32 4415 %b5 = extractelement <8 x i32> %b, i32 5416 %b6 = extractelement <8 x i32> %b, i32 6417 %b7 = extractelement <8 x i32> %b, i32 7418 %r0 = add i32 %a0, %a1419 %r1 = add i32 %a2, %a3420 %r2 = add i32 %b0, %b1421 %r3 = add i32 %b2, %b3422 %r4 = add i32 %a4, %a5423 %r5 = add i32 %a6, %a7424 %r6 = add i32 %b4, %b5425 %r7 = add i32 %b6, %b7426 %r00 = insertelement <8 x i32> zeroinitializer, i32 %r0, i32 0427 %r01 = insertelement <8 x i32> %r00, i32 %r1, i32 1428 %r02 = insertelement <8 x i32> %r01, i32 %r2, i32 2429 %r03 = insertelement <8 x i32> %r02, i32 %r3, i32 3430 %r04 = insertelement <8 x i32> %r03, i32 %r4, i32 4431 %r05 = insertelement <8 x i32> %r04, i32 %r5, i32 5432 %r06 = insertelement <8 x i32> %r05, i32 %r6, i32 6433 %r07 = insertelement <8 x i32> %r06, i32 %r7, i32 7434 ret <8 x i32> %r07435}436 437define <16 x i16> @test_v16i16(<16 x i16> %a, <16 x i16> %b) {438; SSE-LABEL: @test_v16i16(439; 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>440; 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>441; 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>442; 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>443; 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>444; 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>445; SSE-NEXT: [[TMP7:%.*]] = add <16 x i16> [[TMP5]], [[TMP6]]446; SSE-NEXT: ret <16 x i16> [[TMP7]]447;448; SLM-LABEL: @test_v16i16(449; 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>450; 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>451; 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>452; 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>453; 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>454; 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>455; SLM-NEXT: [[TMP7:%.*]] = add <16 x i16> [[TMP5]], [[TMP6]]456; SLM-NEXT: ret <16 x i16> [[TMP7]]457;458; AVX-LABEL: @test_v16i16(459; 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>460; 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>461; AVX-NEXT: [[TMP3:%.*]] = add <16 x i16> [[TMP1]], [[TMP2]]462; AVX-NEXT: ret <16 x i16> [[TMP3]]463;464 %a0 = extractelement <16 x i16> %a, i32 0465 %a1 = extractelement <16 x i16> %a, i32 1466 %a2 = extractelement <16 x i16> %a, i32 2467 %a3 = extractelement <16 x i16> %a, i32 3468 %a4 = extractelement <16 x i16> %a, i32 4469 %a5 = extractelement <16 x i16> %a, i32 5470 %a6 = extractelement <16 x i16> %a, i32 6471 %a7 = extractelement <16 x i16> %a, i32 7472 %a8 = extractelement <16 x i16> %a, i32 8473 %a9 = extractelement <16 x i16> %a, i32 9474 %a10 = extractelement <16 x i16> %a, i32 10475 %a11 = extractelement <16 x i16> %a, i32 11476 %a12 = extractelement <16 x i16> %a, i32 12477 %a13 = extractelement <16 x i16> %a, i32 13478 %a14 = extractelement <16 x i16> %a, i32 14479 %a15 = extractelement <16 x i16> %a, i32 15480 %b0 = extractelement <16 x i16> %b, i32 0481 %b1 = extractelement <16 x i16> %b, i32 1482 %b2 = extractelement <16 x i16> %b, i32 2483 %b3 = extractelement <16 x i16> %b, i32 3484 %b4 = extractelement <16 x i16> %b, i32 4485 %b5 = extractelement <16 x i16> %b, i32 5486 %b6 = extractelement <16 x i16> %b, i32 6487 %b7 = extractelement <16 x i16> %b, i32 7488 %b8 = extractelement <16 x i16> %b, i32 8489 %b9 = extractelement <16 x i16> %b, i32 9490 %b10 = extractelement <16 x i16> %b, i32 10491 %b11 = extractelement <16 x i16> %b, i32 11492 %b12 = extractelement <16 x i16> %b, i32 12493 %b13 = extractelement <16 x i16> %b, i32 13494 %b14 = extractelement <16 x i16> %b, i32 14495 %b15 = extractelement <16 x i16> %b, i32 15496 %r0 = add i16 %a0 , %a1497 %r1 = add i16 %a2 , %a3498 %r2 = add i16 %a4 , %a5499 %r3 = add i16 %a6 , %a7500 %r4 = add i16 %b0 , %b1501 %r5 = add i16 %b2 , %b3502 %r6 = add i16 %b4 , %b5503 %r7 = add i16 %b6 , %b7504 %r8 = add i16 %a8 , %a9505 %r9 = add i16 %a10, %a11506 %r10 = add i16 %a12, %a13507 %r11 = add i16 %a14, %a15508 %r12 = add i16 %b8 , %b9509 %r13 = add i16 %b10, %b11510 %r14 = add i16 %b12, %b13511 %r15 = add i16 %b14, %b15512 %rv0 = insertelement <16 x i16> zeroinitializer, i16 %r0 , i32 0513 %rv1 = insertelement <16 x i16> %rv0 , i16 %r1 , i32 1514 %rv2 = insertelement <16 x i16> %rv1 , i16 %r2 , i32 2515 %rv3 = insertelement <16 x i16> %rv2 , i16 %r3 , i32 3516 %rv4 = insertelement <16 x i16> %rv3 , i16 %r4 , i32 4517 %rv5 = insertelement <16 x i16> %rv4 , i16 %r5 , i32 5518 %rv6 = insertelement <16 x i16> %rv5 , i16 %r6 , i32 6519 %rv7 = insertelement <16 x i16> %rv6 , i16 %r7 , i32 7520 %rv8 = insertelement <16 x i16> %rv7 , i16 %r8 , i32 8521 %rv9 = insertelement <16 x i16> %rv8 , i16 %r9 , i32 9522 %rv10 = insertelement <16 x i16> %rv9 , i16 %r10, i32 10523 %rv11 = insertelement <16 x i16> %rv10, i16 %r11, i32 11524 %rv12 = insertelement <16 x i16> %rv11, i16 %r12, i32 12525 %rv13 = insertelement <16 x i16> %rv12, i16 %r13, i32 13526 %rv14 = insertelement <16 x i16> %rv13, i16 %r14, i32 14527 %rv15 = insertelement <16 x i16> %rv14, i16 %r15, i32 15528 ret <16 x i16> %rv15529}530