brintos

brintos / llvm-project-archived public Read only

0
0
Text · 77.5 KiB · a077819 Raw
2184 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+sse3               | FileCheck %s --check-prefixes=SSE3,SSE3-SLOW3; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+sse3,fast-hops     | FileCheck %s --check-prefixes=SSE3,SSE3-FAST4; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+avx                | FileCheck %s --check-prefixes=AVX,AVX-SLOW5; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+avx,fast-hops      | FileCheck %s --check-prefixes=AVX,AVX-FAST6; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+avx2               | FileCheck %s --check-prefixes=AVX,AVX-SLOW7; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+avx2,fast-hops     | FileCheck %s --check-prefixes=AVX,AVX-FAST8; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+avx512f            | FileCheck %s --check-prefixes=AVX,AVX-SLOW9; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+avx512f,fast-hops  | FileCheck %s --check-prefixes=AVX,AVX-FAST10 11define <2 x double> @haddpd1(<2 x double> %x, <2 x double> %y) {12; SSE3-LABEL: haddpd1:13; SSE3:       # %bb.0:14; SSE3-NEXT:    haddpd %xmm1, %xmm015; SSE3-NEXT:    retq16;17; AVX-LABEL: haddpd1:18; AVX:       # %bb.0:19; AVX-NEXT:    vhaddpd %xmm1, %xmm0, %xmm020; AVX-NEXT:    retq21  %a = shufflevector <2 x double> %x, <2 x double> %y, <2 x i32> <i32 0, i32 2>22  %b = shufflevector <2 x double> %x, <2 x double> %y, <2 x i32> <i32 1, i32 3>23  %r = fadd <2 x double> %a, %b24  ret <2 x double> %r25}26 27define <2 x double> @haddpd2(<2 x double> %x, <2 x double> %y) {28; SSE3-LABEL: haddpd2:29; SSE3:       # %bb.0:30; SSE3-NEXT:    haddpd %xmm1, %xmm031; SSE3-NEXT:    retq32;33; AVX-LABEL: haddpd2:34; AVX:       # %bb.0:35; AVX-NEXT:    vhaddpd %xmm1, %xmm0, %xmm036; AVX-NEXT:    retq37  %a = shufflevector <2 x double> %x, <2 x double> %y, <2 x i32> <i32 1, i32 2>38  %b = shufflevector <2 x double> %y, <2 x double> %x, <2 x i32> <i32 2, i32 1>39  %r = fadd <2 x double> %a, %b40  ret <2 x double> %r41}42 43define <2 x double> @haddpd3(<2 x double> %x) {44; SSE3-SLOW-LABEL: haddpd3:45; SSE3-SLOW:       # %bb.0:46; SSE3-SLOW-NEXT:    movapd %xmm0, %xmm147; SSE3-SLOW-NEXT:    unpckhpd {{.*#+}} xmm1 = xmm1[1],xmm0[1]48; SSE3-SLOW-NEXT:    addpd %xmm1, %xmm049; SSE3-SLOW-NEXT:    retq50;51; SSE3-FAST-LABEL: haddpd3:52; SSE3-FAST:       # %bb.0:53; SSE3-FAST-NEXT:    haddpd %xmm0, %xmm054; SSE3-FAST-NEXT:    retq55;56; AVX-SLOW-LABEL: haddpd3:57; AVX-SLOW:       # %bb.0:58; AVX-SLOW-NEXT:    vshufpd {{.*#+}} xmm1 = xmm0[1,0]59; AVX-SLOW-NEXT:    vaddpd %xmm1, %xmm0, %xmm060; AVX-SLOW-NEXT:    retq61;62; AVX-FAST-LABEL: haddpd3:63; AVX-FAST:       # %bb.0:64; AVX-FAST-NEXT:    vhaddpd %xmm0, %xmm0, %xmm065; AVX-FAST-NEXT:    retq66  %a = shufflevector <2 x double> %x, <2 x double> undef, <2 x i32> <i32 0, i32 undef>67  %b = shufflevector <2 x double> %x, <2 x double> undef, <2 x i32> <i32 1, i32 undef>68  %r = fadd <2 x double> %a, %b69  ret <2 x double> %r70}71 72define <4 x float> @haddps1(<4 x float> %x, <4 x float> %y) {73; SSE3-LABEL: haddps1:74; SSE3:       # %bb.0:75; SSE3-NEXT:    haddps %xmm1, %xmm076; SSE3-NEXT:    retq77;78; AVX-LABEL: haddps1:79; AVX:       # %bb.0:80; AVX-NEXT:    vhaddps %xmm1, %xmm0, %xmm081; AVX-NEXT:    retq82  %a = shufflevector <4 x float> %x, <4 x float> %y, <4 x i32> <i32 0, i32 2, i32 4, i32 6>83  %b = shufflevector <4 x float> %x, <4 x float> %y, <4 x i32> <i32 1, i32 3, i32 5, i32 7>84  %r = fadd <4 x float> %a, %b85  ret <4 x float> %r86}87 88define <4 x float> @haddps2(<4 x float> %x, <4 x float> %y) {89; SSE3-LABEL: haddps2:90; SSE3:       # %bb.0:91; SSE3-NEXT:    haddps %xmm1, %xmm092; SSE3-NEXT:    retq93;94; AVX-LABEL: haddps2:95; AVX:       # %bb.0:96; AVX-NEXT:    vhaddps %xmm1, %xmm0, %xmm097; AVX-NEXT:    retq98  %a = shufflevector <4 x float> %x, <4 x float> %y, <4 x i32> <i32 1, i32 2, i32 5, i32 6>99  %b = shufflevector <4 x float> %y, <4 x float> %x, <4 x i32> <i32 4, i32 7, i32 0, i32 3>100  %r = fadd <4 x float> %a, %b101  ret <4 x float> %r102}103 104define <4 x float> @haddps3(<4 x float> %x) {105; SSE3-LABEL: haddps3:106; SSE3:       # %bb.0:107; SSE3-NEXT:    haddps %xmm0, %xmm0108; SSE3-NEXT:    retq109;110; AVX-LABEL: haddps3:111; AVX:       # %bb.0:112; AVX-NEXT:    vhaddps %xmm0, %xmm0, %xmm0113; AVX-NEXT:    retq114  %a = shufflevector <4 x float> %x, <4 x float> undef, <4 x i32> <i32 undef, i32 2, i32 4, i32 6>115  %b = shufflevector <4 x float> %x, <4 x float> undef, <4 x i32> <i32 undef, i32 3, i32 5, i32 7>116  %r = fadd <4 x float> %a, %b117  ret <4 x float> %r118}119 120define <4 x float> @haddps4(<4 x float> %x) {121; SSE3-LABEL: haddps4:122; SSE3:       # %bb.0:123; SSE3-NEXT:    haddps %xmm0, %xmm0124; SSE3-NEXT:    retq125;126; AVX-LABEL: haddps4:127; AVX:       # %bb.0:128; AVX-NEXT:    vhaddps %xmm0, %xmm0, %xmm0129; AVX-NEXT:    retq130  %a = shufflevector <4 x float> %x, <4 x float> undef, <4 x i32> <i32 0, i32 2, i32 undef, i32 undef>131  %b = shufflevector <4 x float> %x, <4 x float> undef, <4 x i32> <i32 1, i32 3, i32 undef, i32 undef>132  %r = fadd <4 x float> %a, %b133  ret <4 x float> %r134}135 136define <4 x float> @haddps5(<4 x float> %x) {137; SSE3-LABEL: haddps5:138; SSE3:       # %bb.0:139; SSE3-NEXT:    haddps %xmm0, %xmm0140; SSE3-NEXT:    retq141;142; AVX-LABEL: haddps5:143; AVX:       # %bb.0:144; AVX-NEXT:    vhaddps %xmm0, %xmm0, %xmm0145; AVX-NEXT:    retq146  %a = shufflevector <4 x float> %x, <4 x float> undef, <4 x i32> <i32 0, i32 3, i32 undef, i32 undef>147  %b = shufflevector <4 x float> %x, <4 x float> undef, <4 x i32> <i32 1, i32 2, i32 undef, i32 undef>148  %r = fadd <4 x float> %a, %b149  ret <4 x float> %r150}151 152define <4 x float> @haddps6(<4 x float> %x) {153; SSE3-SLOW-LABEL: haddps6:154; SSE3-SLOW:       # %bb.0:155; SSE3-SLOW-NEXT:    movshdup {{.*#+}} xmm1 = xmm0[1,1,3,3]156; SSE3-SLOW-NEXT:    addps %xmm1, %xmm0157; SSE3-SLOW-NEXT:    retq158;159; SSE3-FAST-LABEL: haddps6:160; SSE3-FAST:       # %bb.0:161; SSE3-FAST-NEXT:    haddps %xmm0, %xmm0162; SSE3-FAST-NEXT:    retq163;164; AVX-SLOW-LABEL: haddps6:165; AVX-SLOW:       # %bb.0:166; AVX-SLOW-NEXT:    vmovshdup {{.*#+}} xmm1 = xmm0[1,1,3,3]167; AVX-SLOW-NEXT:    vaddps %xmm1, %xmm0, %xmm0168; AVX-SLOW-NEXT:    retq169;170; AVX-FAST-LABEL: haddps6:171; AVX-FAST:       # %bb.0:172; AVX-FAST-NEXT:    vhaddps %xmm0, %xmm0, %xmm0173; AVX-FAST-NEXT:    retq174  %a = shufflevector <4 x float> %x, <4 x float> undef, <4 x i32> <i32 0, i32 undef, i32 undef, i32 undef>175  %b = shufflevector <4 x float> %x, <4 x float> undef, <4 x i32> <i32 1, i32 undef, i32 undef, i32 undef>176  %r = fadd <4 x float> %a, %b177  ret <4 x float> %r178}179 180define <4 x float> @haddps7(<4 x float> %x) {181; SSE3-LABEL: haddps7:182; SSE3:       # %bb.0:183; SSE3-NEXT:    haddps %xmm0, %xmm0184; SSE3-NEXT:    retq185;186; AVX-LABEL: haddps7:187; AVX:       # %bb.0:188; AVX-NEXT:    vhaddps %xmm0, %xmm0, %xmm0189; AVX-NEXT:    retq190  %a = shufflevector <4 x float> %x, <4 x float> undef, <4 x i32> <i32 undef, i32 3, i32 undef, i32 undef>191  %b = shufflevector <4 x float> %x, <4 x float> undef, <4 x i32> <i32 undef, i32 2, i32 undef, i32 undef>192  %r = fadd <4 x float> %a, %b193  ret <4 x float> %r194}195 196define <2 x double> @hsubpd1(<2 x double> %x, <2 x double> %y) {197; SSE3-LABEL: hsubpd1:198; SSE3:       # %bb.0:199; SSE3-NEXT:    hsubpd %xmm1, %xmm0200; SSE3-NEXT:    retq201;202; AVX-LABEL: hsubpd1:203; AVX:       # %bb.0:204; AVX-NEXT:    vhsubpd %xmm1, %xmm0, %xmm0205; AVX-NEXT:    retq206  %a = shufflevector <2 x double> %x, <2 x double> %y, <2 x i32> <i32 0, i32 2>207  %b = shufflevector <2 x double> %x, <2 x double> %y, <2 x i32> <i32 1, i32 3>208  %r = fsub <2 x double> %a, %b209  ret <2 x double> %r210}211 212define <2 x double> @hsubpd2(<2 x double> %x) {213; SSE3-SLOW-LABEL: hsubpd2:214; SSE3-SLOW:       # %bb.0:215; SSE3-SLOW-NEXT:    movapd %xmm0, %xmm1216; SSE3-SLOW-NEXT:    unpckhpd {{.*#+}} xmm1 = xmm1[1],xmm0[1]217; SSE3-SLOW-NEXT:    subpd %xmm1, %xmm0218; SSE3-SLOW-NEXT:    retq219;220; SSE3-FAST-LABEL: hsubpd2:221; SSE3-FAST:       # %bb.0:222; SSE3-FAST-NEXT:    hsubpd %xmm0, %xmm0223; SSE3-FAST-NEXT:    retq224;225; AVX-SLOW-LABEL: hsubpd2:226; AVX-SLOW:       # %bb.0:227; AVX-SLOW-NEXT:    vshufpd {{.*#+}} xmm1 = xmm0[1,0]228; AVX-SLOW-NEXT:    vsubpd %xmm1, %xmm0, %xmm0229; AVX-SLOW-NEXT:    retq230;231; AVX-FAST-LABEL: hsubpd2:232; AVX-FAST:       # %bb.0:233; AVX-FAST-NEXT:    vhsubpd %xmm0, %xmm0, %xmm0234; AVX-FAST-NEXT:    retq235  %a = shufflevector <2 x double> %x, <2 x double> undef, <2 x i32> <i32 0, i32 undef>236  %b = shufflevector <2 x double> %x, <2 x double> undef, <2 x i32> <i32 1, i32 undef>237  %r = fsub <2 x double> %a, %b238  ret <2 x double> %r239}240 241define <4 x float> @hsubps1(<4 x float> %x, <4 x float> %y) {242; SSE3-LABEL: hsubps1:243; SSE3:       # %bb.0:244; SSE3-NEXT:    hsubps %xmm1, %xmm0245; SSE3-NEXT:    retq246;247; AVX-LABEL: hsubps1:248; AVX:       # %bb.0:249; AVX-NEXT:    vhsubps %xmm1, %xmm0, %xmm0250; AVX-NEXT:    retq251  %a = shufflevector <4 x float> %x, <4 x float> %y, <4 x i32> <i32 0, i32 2, i32 4, i32 6>252  %b = shufflevector <4 x float> %x, <4 x float> %y, <4 x i32> <i32 1, i32 3, i32 5, i32 7>253  %r = fsub <4 x float> %a, %b254  ret <4 x float> %r255}256 257define <4 x float> @hsubps2(<4 x float> %x) {258; SSE3-LABEL: hsubps2:259; SSE3:       # %bb.0:260; SSE3-NEXT:    hsubps %xmm0, %xmm0261; SSE3-NEXT:    retq262;263; AVX-LABEL: hsubps2:264; AVX:       # %bb.0:265; AVX-NEXT:    vhsubps %xmm0, %xmm0, %xmm0266; AVX-NEXT:    retq267  %a = shufflevector <4 x float> %x, <4 x float> undef, <4 x i32> <i32 undef, i32 2, i32 4, i32 6>268  %b = shufflevector <4 x float> %x, <4 x float> undef, <4 x i32> <i32 undef, i32 3, i32 5, i32 7>269  %r = fsub <4 x float> %a, %b270  ret <4 x float> %r271}272 273define <4 x float> @hsubps3(<4 x float> %x) {274; SSE3-LABEL: hsubps3:275; SSE3:       # %bb.0:276; SSE3-NEXT:    hsubps %xmm0, %xmm0277; SSE3-NEXT:    retq278;279; AVX-LABEL: hsubps3:280; AVX:       # %bb.0:281; AVX-NEXT:    vhsubps %xmm0, %xmm0, %xmm0282; AVX-NEXT:    retq283  %a = shufflevector <4 x float> %x, <4 x float> undef, <4 x i32> <i32 0, i32 2, i32 undef, i32 undef>284  %b = shufflevector <4 x float> %x, <4 x float> undef, <4 x i32> <i32 1, i32 3, i32 undef, i32 undef>285  %r = fsub <4 x float> %a, %b286  ret <4 x float> %r287}288 289define <4 x float> @hsubps4(<4 x float> %x) {290; SSE3-SLOW-LABEL: hsubps4:291; SSE3-SLOW:       # %bb.0:292; SSE3-SLOW-NEXT:    movshdup {{.*#+}} xmm1 = xmm0[1,1,3,3]293; SSE3-SLOW-NEXT:    subps %xmm1, %xmm0294; SSE3-SLOW-NEXT:    retq295;296; SSE3-FAST-LABEL: hsubps4:297; SSE3-FAST:       # %bb.0:298; SSE3-FAST-NEXT:    hsubps %xmm0, %xmm0299; SSE3-FAST-NEXT:    retq300;301; AVX-SLOW-LABEL: hsubps4:302; AVX-SLOW:       # %bb.0:303; AVX-SLOW-NEXT:    vmovshdup {{.*#+}} xmm1 = xmm0[1,1,3,3]304; AVX-SLOW-NEXT:    vsubps %xmm1, %xmm0, %xmm0305; AVX-SLOW-NEXT:    retq306;307; AVX-FAST-LABEL: hsubps4:308; AVX-FAST:       # %bb.0:309; AVX-FAST-NEXT:    vhsubps %xmm0, %xmm0, %xmm0310; AVX-FAST-NEXT:    retq311  %a = shufflevector <4 x float> %x, <4 x float> undef, <4 x i32> <i32 0, i32 undef, i32 undef, i32 undef>312  %b = shufflevector <4 x float> %x, <4 x float> undef, <4 x i32> <i32 1, i32 undef, i32 undef, i32 undef>313  %r = fsub <4 x float> %a, %b314  ret <4 x float> %r315}316 317define <8 x float> @vhaddps1(<8 x float> %x, <8 x float> %y) {318; SSE3-LABEL: vhaddps1:319; SSE3:       # %bb.0:320; SSE3-NEXT:    haddps %xmm2, %xmm0321; SSE3-NEXT:    haddps %xmm3, %xmm1322; SSE3-NEXT:    retq323;324; AVX-LABEL: vhaddps1:325; AVX:       # %bb.0:326; AVX-NEXT:    vhaddps %ymm1, %ymm0, %ymm0327; AVX-NEXT:    retq328  %a = shufflevector <8 x float> %x, <8 x float> %y, <8 x i32> <i32 0, i32 2, i32 8, i32 10, i32 4, i32 6, i32 12, i32 14>329  %b = shufflevector <8 x float> %x, <8 x float> %y, <8 x i32> <i32 1, i32 3, i32 9, i32 11, i32 5, i32 7, i32 13, i32 15>330  %r = fadd <8 x float> %a, %b331  ret <8 x float> %r332}333 334define <8 x float> @vhaddps2(<8 x float> %x, <8 x float> %y) {335; SSE3-LABEL: vhaddps2:336; SSE3:       # %bb.0:337; SSE3-NEXT:    haddps %xmm2, %xmm0338; SSE3-NEXT:    haddps %xmm3, %xmm1339; SSE3-NEXT:    retq340;341; AVX-LABEL: vhaddps2:342; AVX:       # %bb.0:343; AVX-NEXT:    vhaddps %ymm1, %ymm0, %ymm0344; AVX-NEXT:    retq345  %a = shufflevector <8 x float> %x, <8 x float> %y, <8 x i32> <i32 1, i32 2, i32 9, i32 10, i32 5, i32 6, i32 13, i32 14>346  %b = shufflevector <8 x float> %y, <8 x float> %x, <8 x i32> <i32 8, i32 11, i32 0, i32 3, i32 12, i32 15, i32 4, i32 7>347  %r = fadd <8 x float> %a, %b348  ret <8 x float> %r349}350 351define <8 x float> @vhaddps3(<8 x float> %x) {352; SSE3-LABEL: vhaddps3:353; SSE3:       # %bb.0:354; SSE3-NEXT:    haddps %xmm0, %xmm0355; SSE3-NEXT:    haddps %xmm1, %xmm1356; SSE3-NEXT:    retq357;358; AVX-LABEL: vhaddps3:359; AVX:       # %bb.0:360; AVX-NEXT:    vhaddps %ymm0, %ymm0, %ymm0361; AVX-NEXT:    retq362  %a = shufflevector <8 x float> %x, <8 x float> undef, <8 x i32> <i32 undef, i32 2, i32 8, i32 10, i32 4, i32 6, i32 undef, i32 14>363  %b = shufflevector <8 x float> %x, <8 x float> undef, <8 x i32> <i32 1, i32 3, i32 9, i32 undef, i32 5, i32 7, i32 13, i32 15>364  %r = fadd <8 x float> %a, %b365  ret <8 x float> %r366}367 368define <8 x float> @vhsubps1(<8 x float> %x, <8 x float> %y) {369; SSE3-LABEL: vhsubps1:370; SSE3:       # %bb.0:371; SSE3-NEXT:    hsubps %xmm2, %xmm0372; SSE3-NEXT:    hsubps %xmm3, %xmm1373; SSE3-NEXT:    retq374;375; AVX-LABEL: vhsubps1:376; AVX:       # %bb.0:377; AVX-NEXT:    vhsubps %ymm1, %ymm0, %ymm0378; AVX-NEXT:    retq379  %a = shufflevector <8 x float> %x, <8 x float> %y, <8 x i32> <i32 0, i32 2, i32 8, i32 10, i32 4, i32 6, i32 12, i32 14>380  %b = shufflevector <8 x float> %x, <8 x float> %y, <8 x i32> <i32 1, i32 3, i32 9, i32 11, i32 5, i32 7, i32 13, i32 15>381  %r = fsub <8 x float> %a, %b382  ret <8 x float> %r383}384 385define <8 x float> @vhsubps3(<8 x float> %x) {386; SSE3-LABEL: vhsubps3:387; SSE3:       # %bb.0:388; SSE3-NEXT:    hsubps %xmm0, %xmm0389; SSE3-NEXT:    hsubps %xmm1, %xmm1390; SSE3-NEXT:    retq391;392; AVX-LABEL: vhsubps3:393; AVX:       # %bb.0:394; AVX-NEXT:    vhsubps %ymm0, %ymm0, %ymm0395; AVX-NEXT:    retq396  %a = shufflevector <8 x float> %x, <8 x float> undef, <8 x i32> <i32 undef, i32 2, i32 8, i32 10, i32 4, i32 6, i32 undef, i32 14>397  %b = shufflevector <8 x float> %x, <8 x float> undef, <8 x i32> <i32 1, i32 3, i32 9, i32 undef, i32 5, i32 7, i32 13, i32 15>398  %r = fsub <8 x float> %a, %b399  ret <8 x float> %r400}401 402define <4 x double> @vhaddpd1(<4 x double> %x, <4 x double> %y) {403; SSE3-LABEL: vhaddpd1:404; SSE3:       # %bb.0:405; SSE3-NEXT:    haddpd %xmm2, %xmm0406; SSE3-NEXT:    haddpd %xmm3, %xmm1407; SSE3-NEXT:    retq408;409; AVX-LABEL: vhaddpd1:410; AVX:       # %bb.0:411; AVX-NEXT:    vhaddpd %ymm1, %ymm0, %ymm0412; AVX-NEXT:    retq413  %a = shufflevector <4 x double> %x, <4 x double> %y, <4 x i32> <i32 0, i32 4, i32 2, i32 6>414  %b = shufflevector <4 x double> %x, <4 x double> %y, <4 x i32> <i32 1, i32 5, i32 3, i32 7>415  %r = fadd <4 x double> %a, %b416  ret <4 x double> %r417}418 419define <4 x double> @vhsubpd1(<4 x double> %x, <4 x double> %y) {420; SSE3-LABEL: vhsubpd1:421; SSE3:       # %bb.0:422; SSE3-NEXT:    hsubpd %xmm2, %xmm0423; SSE3-NEXT:    hsubpd %xmm3, %xmm1424; SSE3-NEXT:    retq425;426; AVX-LABEL: vhsubpd1:427; AVX:       # %bb.0:428; AVX-NEXT:    vhsubpd %ymm1, %ymm0, %ymm0429; AVX-NEXT:    retq430  %a = shufflevector <4 x double> %x, <4 x double> %y, <4 x i32> <i32 0, i32 4, i32 2, i32 6>431  %b = shufflevector <4 x double> %x, <4 x double> %y, <4 x i32> <i32 1, i32 5, i32 3, i32 7>432  %r = fsub <4 x double> %a, %b433  ret <4 x double> %r434}435 436define <2 x float> @haddps_v2f32(<4 x float> %v0) {437; SSE3-LABEL: haddps_v2f32:438; SSE3:       # %bb.0:439; SSE3-NEXT:    haddps %xmm0, %xmm0440; SSE3-NEXT:    retq441;442; AVX-LABEL: haddps_v2f32:443; AVX:       # %bb.0:444; AVX-NEXT:    vhaddps %xmm0, %xmm0, %xmm0445; AVX-NEXT:    retq446  %v0.0 = extractelement <4 x float> %v0, i32 0447  %v0.1 = extractelement <4 x float> %v0, i32 1448  %v0.2 = extractelement <4 x float> %v0, i32 2449  %v0.3 = extractelement <4 x float> %v0, i32 3450  %op0 = fadd float %v0.0, %v0.1451  %op1 = fadd float %v0.2, %v0.3452  %res0 = insertelement <2 x float> undef, float %op0, i32 0453  %res1 = insertelement <2 x float> %res0, float %op1, i32 1454  ret <2 x float> %res1455}456 457; 128-bit vectors, float/double, fadd/fsub458 459define float @extract_extract01_v4f32_fadd_f32(<4 x float> %x) {460; SSE3-SLOW-LABEL: extract_extract01_v4f32_fadd_f32:461; SSE3-SLOW:       # %bb.0:462; SSE3-SLOW-NEXT:    movshdup {{.*#+}} xmm1 = xmm0[1,1,3,3]463; SSE3-SLOW-NEXT:    addss %xmm1, %xmm0464; SSE3-SLOW-NEXT:    retq465;466; SSE3-FAST-LABEL: extract_extract01_v4f32_fadd_f32:467; SSE3-FAST:       # %bb.0:468; SSE3-FAST-NEXT:    haddps %xmm0, %xmm0469; SSE3-FAST-NEXT:    retq470;471; AVX-SLOW-LABEL: extract_extract01_v4f32_fadd_f32:472; AVX-SLOW:       # %bb.0:473; AVX-SLOW-NEXT:    vmovshdup {{.*#+}} xmm1 = xmm0[1,1,3,3]474; AVX-SLOW-NEXT:    vaddss %xmm1, %xmm0, %xmm0475; AVX-SLOW-NEXT:    retq476;477; AVX-FAST-LABEL: extract_extract01_v4f32_fadd_f32:478; AVX-FAST:       # %bb.0:479; AVX-FAST-NEXT:    vhaddps %xmm0, %xmm0, %xmm0480; AVX-FAST-NEXT:    retq481  %x0 = extractelement <4 x float> %x, i32 0482  %x1 = extractelement <4 x float> %x, i32 1483  %x01 = fadd float %x0, %x1484  ret float %x01485}486 487define float @extract_extract23_v4f32_fadd_f32(<4 x float> %x) {488; SSE3-SLOW-LABEL: extract_extract23_v4f32_fadd_f32:489; SSE3-SLOW:       # %bb.0:490; SSE3-SLOW-NEXT:    movaps %xmm0, %xmm1491; SSE3-SLOW-NEXT:    unpckhpd {{.*#+}} xmm1 = xmm1[1],xmm0[1]492; SSE3-SLOW-NEXT:    shufps {{.*#+}} xmm0 = xmm0[3,3,3,3]493; SSE3-SLOW-NEXT:    addss %xmm1, %xmm0494; SSE3-SLOW-NEXT:    retq495;496; SSE3-FAST-LABEL: extract_extract23_v4f32_fadd_f32:497; SSE3-FAST:       # %bb.0:498; SSE3-FAST-NEXT:    haddps %xmm0, %xmm0499; SSE3-FAST-NEXT:    movshdup {{.*#+}} xmm0 = xmm0[1,1,3,3]500; SSE3-FAST-NEXT:    retq501;502; AVX-SLOW-LABEL: extract_extract23_v4f32_fadd_f32:503; AVX-SLOW:       # %bb.0:504; AVX-SLOW-NEXT:    vshufpd {{.*#+}} xmm1 = xmm0[1,0]505; AVX-SLOW-NEXT:    vshufps {{.*#+}} xmm0 = xmm0[3,3,3,3]506; AVX-SLOW-NEXT:    vaddss %xmm0, %xmm1, %xmm0507; AVX-SLOW-NEXT:    retq508;509; AVX-FAST-LABEL: extract_extract23_v4f32_fadd_f32:510; AVX-FAST:       # %bb.0:511; AVX-FAST-NEXT:    vhaddps %xmm0, %xmm0, %xmm0512; AVX-FAST-NEXT:    vmovshdup {{.*#+}} xmm0 = xmm0[1,1,3,3]513; AVX-FAST-NEXT:    retq514  %x0 = extractelement <4 x float> %x, i32 2515  %x1 = extractelement <4 x float> %x, i32 3516  %x01 = fadd float %x0, %x1517  ret float %x01518}519 520define float @extract_extract01_v4f32_fadd_f32_commute(<4 x float> %x) {521; SSE3-SLOW-LABEL: extract_extract01_v4f32_fadd_f32_commute:522; SSE3-SLOW:       # %bb.0:523; SSE3-SLOW-NEXT:    movshdup {{.*#+}} xmm1 = xmm0[1,1,3,3]524; SSE3-SLOW-NEXT:    addss %xmm1, %xmm0525; SSE3-SLOW-NEXT:    retq526;527; SSE3-FAST-LABEL: extract_extract01_v4f32_fadd_f32_commute:528; SSE3-FAST:       # %bb.0:529; SSE3-FAST-NEXT:    haddps %xmm0, %xmm0530; SSE3-FAST-NEXT:    retq531;532; AVX-SLOW-LABEL: extract_extract01_v4f32_fadd_f32_commute:533; AVX-SLOW:       # %bb.0:534; AVX-SLOW-NEXT:    vmovshdup {{.*#+}} xmm1 = xmm0[1,1,3,3]535; AVX-SLOW-NEXT:    vaddss %xmm0, %xmm1, %xmm0536; AVX-SLOW-NEXT:    retq537;538; AVX-FAST-LABEL: extract_extract01_v4f32_fadd_f32_commute:539; AVX-FAST:       # %bb.0:540; AVX-FAST-NEXT:    vhaddps %xmm0, %xmm0, %xmm0541; AVX-FAST-NEXT:    retq542  %x0 = extractelement <4 x float> %x, i32 0543  %x1 = extractelement <4 x float> %x, i32 1544  %x01 = fadd float %x1, %x0545  ret float %x01546}547 548define float @extract_extract23_v4f32_fadd_f32_commute(<4 x float> %x) {549; SSE3-SLOW-LABEL: extract_extract23_v4f32_fadd_f32_commute:550; SSE3-SLOW:       # %bb.0:551; SSE3-SLOW-NEXT:    movaps %xmm0, %xmm1552; SSE3-SLOW-NEXT:    unpckhpd {{.*#+}} xmm1 = xmm1[1],xmm0[1]553; SSE3-SLOW-NEXT:    shufps {{.*#+}} xmm0 = xmm0[3,3,3,3]554; SSE3-SLOW-NEXT:    addss %xmm1, %xmm0555; SSE3-SLOW-NEXT:    retq556;557; SSE3-FAST-LABEL: extract_extract23_v4f32_fadd_f32_commute:558; SSE3-FAST:       # %bb.0:559; SSE3-FAST-NEXT:    haddps %xmm0, %xmm0560; SSE3-FAST-NEXT:    movshdup {{.*#+}} xmm0 = xmm0[1,1,3,3]561; SSE3-FAST-NEXT:    retq562;563; AVX-SLOW-LABEL: extract_extract23_v4f32_fadd_f32_commute:564; AVX-SLOW:       # %bb.0:565; AVX-SLOW-NEXT:    vshufpd {{.*#+}} xmm1 = xmm0[1,0]566; AVX-SLOW-NEXT:    vshufps {{.*#+}} xmm0 = xmm0[3,3,3,3]567; AVX-SLOW-NEXT:    vaddss %xmm1, %xmm0, %xmm0568; AVX-SLOW-NEXT:    retq569;570; AVX-FAST-LABEL: extract_extract23_v4f32_fadd_f32_commute:571; AVX-FAST:       # %bb.0:572; AVX-FAST-NEXT:    vhaddps %xmm0, %xmm0, %xmm0573; AVX-FAST-NEXT:    vmovshdup {{.*#+}} xmm0 = xmm0[1,1,3,3]574; AVX-FAST-NEXT:    retq575  %x0 = extractelement <4 x float> %x, i32 2576  %x1 = extractelement <4 x float> %x, i32 3577  %x01 = fadd float %x1, %x0578  ret float %x01579}580 581define double @extract_extract01_v2f64_fadd_f64(<2 x double> %x) {582; SSE3-SLOW-LABEL: extract_extract01_v2f64_fadd_f64:583; SSE3-SLOW:       # %bb.0:584; SSE3-SLOW-NEXT:    movapd %xmm0, %xmm1585; SSE3-SLOW-NEXT:    unpckhpd {{.*#+}} xmm1 = xmm1[1],xmm0[1]586; SSE3-SLOW-NEXT:    addsd %xmm1, %xmm0587; SSE3-SLOW-NEXT:    retq588;589; SSE3-FAST-LABEL: extract_extract01_v2f64_fadd_f64:590; SSE3-FAST:       # %bb.0:591; SSE3-FAST-NEXT:    haddpd %xmm0, %xmm0592; SSE3-FAST-NEXT:    retq593;594; AVX-SLOW-LABEL: extract_extract01_v2f64_fadd_f64:595; AVX-SLOW:       # %bb.0:596; AVX-SLOW-NEXT:    vshufpd {{.*#+}} xmm1 = xmm0[1,0]597; AVX-SLOW-NEXT:    vaddsd %xmm1, %xmm0, %xmm0598; AVX-SLOW-NEXT:    retq599;600; AVX-FAST-LABEL: extract_extract01_v2f64_fadd_f64:601; AVX-FAST:       # %bb.0:602; AVX-FAST-NEXT:    vhaddpd %xmm0, %xmm0, %xmm0603; AVX-FAST-NEXT:    retq604  %x0 = extractelement <2 x double> %x, i32 0605  %x1 = extractelement <2 x double> %x, i32 1606  %x01 = fadd double %x0, %x1607  ret double %x01608}609 610define double @extract_extract01_v2f64_fadd_f64_commute(<2 x double> %x) {611; SSE3-SLOW-LABEL: extract_extract01_v2f64_fadd_f64_commute:612; SSE3-SLOW:       # %bb.0:613; SSE3-SLOW-NEXT:    movapd %xmm0, %xmm1614; SSE3-SLOW-NEXT:    unpckhpd {{.*#+}} xmm1 = xmm1[1],xmm0[1]615; SSE3-SLOW-NEXT:    addsd %xmm1, %xmm0616; SSE3-SLOW-NEXT:    retq617;618; SSE3-FAST-LABEL: extract_extract01_v2f64_fadd_f64_commute:619; SSE3-FAST:       # %bb.0:620; SSE3-FAST-NEXT:    haddpd %xmm0, %xmm0621; SSE3-FAST-NEXT:    retq622;623; AVX-SLOW-LABEL: extract_extract01_v2f64_fadd_f64_commute:624; AVX-SLOW:       # %bb.0:625; AVX-SLOW-NEXT:    vshufpd {{.*#+}} xmm1 = xmm0[1,0]626; AVX-SLOW-NEXT:    vaddsd %xmm0, %xmm1, %xmm0627; AVX-SLOW-NEXT:    retq628;629; AVX-FAST-LABEL: extract_extract01_v2f64_fadd_f64_commute:630; AVX-FAST:       # %bb.0:631; AVX-FAST-NEXT:    vhaddpd %xmm0, %xmm0, %xmm0632; AVX-FAST-NEXT:    retq633  %x0 = extractelement <2 x double> %x, i32 0634  %x1 = extractelement <2 x double> %x, i32 1635  %x01 = fadd double %x1, %x0636  ret double %x01637}638 639define float @extract_extract01_v4f32_fsub_f32(<4 x float> %x) {640; SSE3-SLOW-LABEL: extract_extract01_v4f32_fsub_f32:641; SSE3-SLOW:       # %bb.0:642; SSE3-SLOW-NEXT:    movshdup {{.*#+}} xmm1 = xmm0[1,1,3,3]643; SSE3-SLOW-NEXT:    subss %xmm1, %xmm0644; SSE3-SLOW-NEXT:    retq645;646; SSE3-FAST-LABEL: extract_extract01_v4f32_fsub_f32:647; SSE3-FAST:       # %bb.0:648; SSE3-FAST-NEXT:    hsubps %xmm0, %xmm0649; SSE3-FAST-NEXT:    retq650;651; AVX-SLOW-LABEL: extract_extract01_v4f32_fsub_f32:652; AVX-SLOW:       # %bb.0:653; AVX-SLOW-NEXT:    vmovshdup {{.*#+}} xmm1 = xmm0[1,1,3,3]654; AVX-SLOW-NEXT:    vsubss %xmm1, %xmm0, %xmm0655; AVX-SLOW-NEXT:    retq656;657; AVX-FAST-LABEL: extract_extract01_v4f32_fsub_f32:658; AVX-FAST:       # %bb.0:659; AVX-FAST-NEXT:    vhsubps %xmm0, %xmm0, %xmm0660; AVX-FAST-NEXT:    retq661  %x0 = extractelement <4 x float> %x, i32 0662  %x1 = extractelement <4 x float> %x, i32 1663  %x01 = fsub float %x0, %x1664  ret float %x01665}666 667define float @extract_extract23_v4f32_fsub_f32(<4 x float> %x) {668; SSE3-SLOW-LABEL: extract_extract23_v4f32_fsub_f32:669; SSE3-SLOW:       # %bb.0:670; SSE3-SLOW-NEXT:    movaps %xmm0, %xmm1671; SSE3-SLOW-NEXT:    unpckhpd {{.*#+}} xmm1 = xmm1[1],xmm0[1]672; SSE3-SLOW-NEXT:    shufps {{.*#+}} xmm0 = xmm0[3,3,3,3]673; SSE3-SLOW-NEXT:    subss %xmm0, %xmm1674; SSE3-SLOW-NEXT:    movaps %xmm1, %xmm0675; SSE3-SLOW-NEXT:    retq676;677; SSE3-FAST-LABEL: extract_extract23_v4f32_fsub_f32:678; SSE3-FAST:       # %bb.0:679; SSE3-FAST-NEXT:    hsubps %xmm0, %xmm0680; SSE3-FAST-NEXT:    movshdup {{.*#+}} xmm0 = xmm0[1,1,3,3]681; SSE3-FAST-NEXT:    retq682;683; AVX-SLOW-LABEL: extract_extract23_v4f32_fsub_f32:684; AVX-SLOW:       # %bb.0:685; AVX-SLOW-NEXT:    vshufpd {{.*#+}} xmm1 = xmm0[1,0]686; AVX-SLOW-NEXT:    vshufps {{.*#+}} xmm0 = xmm0[3,3,3,3]687; AVX-SLOW-NEXT:    vsubss %xmm0, %xmm1, %xmm0688; AVX-SLOW-NEXT:    retq689;690; AVX-FAST-LABEL: extract_extract23_v4f32_fsub_f32:691; AVX-FAST:       # %bb.0:692; AVX-FAST-NEXT:    vhsubps %xmm0, %xmm0, %xmm0693; AVX-FAST-NEXT:    vmovshdup {{.*#+}} xmm0 = xmm0[1,1,3,3]694; AVX-FAST-NEXT:    retq695  %x0 = extractelement <4 x float> %x, i32 2696  %x1 = extractelement <4 x float> %x, i32 3697  %x01 = fsub float %x0, %x1698  ret float %x01699}700 701define float @extract_extract01_v4f32_fsub_f32_commute(<4 x float> %x) {702; SSE3-LABEL: extract_extract01_v4f32_fsub_f32_commute:703; SSE3:       # %bb.0:704; SSE3-NEXT:    movshdup {{.*#+}} xmm1 = xmm0[1,1,3,3]705; SSE3-NEXT:    subss %xmm0, %xmm1706; SSE3-NEXT:    movaps %xmm1, %xmm0707; SSE3-NEXT:    retq708;709; AVX-LABEL: extract_extract01_v4f32_fsub_f32_commute:710; AVX:       # %bb.0:711; AVX-NEXT:    vmovshdup {{.*#+}} xmm1 = xmm0[1,1,3,3]712; AVX-NEXT:    vsubss %xmm0, %xmm1, %xmm0713; AVX-NEXT:    retq714  %x0 = extractelement <4 x float> %x, i32 0715  %x1 = extractelement <4 x float> %x, i32 1716  %x01 = fsub float %x1, %x0717  ret float %x01718}719 720define float @extract_extract23_v4f32_fsub_f32_commute(<4 x float> %x) {721; SSE3-LABEL: extract_extract23_v4f32_fsub_f32_commute:722; SSE3:       # %bb.0:723; SSE3-NEXT:    movaps %xmm0, %xmm1724; SSE3-NEXT:    unpckhpd {{.*#+}} xmm1 = xmm1[1],xmm0[1]725; SSE3-NEXT:    shufps {{.*#+}} xmm0 = xmm0[3,3,3,3]726; SSE3-NEXT:    subss %xmm1, %xmm0727; SSE3-NEXT:    retq728;729; AVX-LABEL: extract_extract23_v4f32_fsub_f32_commute:730; AVX:       # %bb.0:731; AVX-NEXT:    vshufpd {{.*#+}} xmm1 = xmm0[1,0]732; AVX-NEXT:    vshufps {{.*#+}} xmm0 = xmm0[3,3,3,3]733; AVX-NEXT:    vsubss %xmm1, %xmm0, %xmm0734; AVX-NEXT:    retq735  %x0 = extractelement <4 x float> %x, i32 2736  %x1 = extractelement <4 x float> %x, i32 3737  %x01 = fsub float %x1, %x0738  ret float %x01739}740 741define double @extract_extract01_v2f64_fsub_f64(<2 x double> %x) {742; SSE3-SLOW-LABEL: extract_extract01_v2f64_fsub_f64:743; SSE3-SLOW:       # %bb.0:744; SSE3-SLOW-NEXT:    movapd %xmm0, %xmm1745; SSE3-SLOW-NEXT:    unpckhpd {{.*#+}} xmm1 = xmm1[1],xmm0[1]746; SSE3-SLOW-NEXT:    subsd %xmm1, %xmm0747; SSE3-SLOW-NEXT:    retq748;749; SSE3-FAST-LABEL: extract_extract01_v2f64_fsub_f64:750; SSE3-FAST:       # %bb.0:751; SSE3-FAST-NEXT:    hsubpd %xmm0, %xmm0752; SSE3-FAST-NEXT:    retq753;754; AVX-SLOW-LABEL: extract_extract01_v2f64_fsub_f64:755; AVX-SLOW:       # %bb.0:756; AVX-SLOW-NEXT:    vshufpd {{.*#+}} xmm1 = xmm0[1,0]757; AVX-SLOW-NEXT:    vsubsd %xmm1, %xmm0, %xmm0758; AVX-SLOW-NEXT:    retq759;760; AVX-FAST-LABEL: extract_extract01_v2f64_fsub_f64:761; AVX-FAST:       # %bb.0:762; AVX-FAST-NEXT:    vhsubpd %xmm0, %xmm0, %xmm0763; AVX-FAST-NEXT:    retq764  %x0 = extractelement <2 x double> %x, i32 0765  %x1 = extractelement <2 x double> %x, i32 1766  %x01 = fsub double %x0, %x1767  ret double %x01768}769 770define double @extract_extract01_v2f64_fsub_f64_commute(<2 x double> %x) {771; SSE3-LABEL: extract_extract01_v2f64_fsub_f64_commute:772; SSE3:       # %bb.0:773; SSE3-NEXT:    movapd %xmm0, %xmm1774; SSE3-NEXT:    unpckhpd {{.*#+}} xmm1 = xmm1[1],xmm0[1]775; SSE3-NEXT:    subsd %xmm0, %xmm1776; SSE3-NEXT:    movapd %xmm1, %xmm0777; SSE3-NEXT:    retq778;779; AVX-LABEL: extract_extract01_v2f64_fsub_f64_commute:780; AVX:       # %bb.0:781; AVX-NEXT:    vshufpd {{.*#+}} xmm1 = xmm0[1,0]782; AVX-NEXT:    vsubsd %xmm0, %xmm1, %xmm0783; AVX-NEXT:    retq784  %x0 = extractelement <2 x double> %x, i32 0785  %x1 = extractelement <2 x double> %x, i32 1786  %x01 = fsub double %x1, %x0787  ret double %x01788}789 790; 256-bit vectors, float/double, fadd/fsub791 792define float @extract_extract01_v8f32_fadd_f32(<8 x float> %x) {793; SSE3-SLOW-LABEL: extract_extract01_v8f32_fadd_f32:794; SSE3-SLOW:       # %bb.0:795; SSE3-SLOW-NEXT:    movshdup {{.*#+}} xmm1 = xmm0[1,1,3,3]796; SSE3-SLOW-NEXT:    addss %xmm1, %xmm0797; SSE3-SLOW-NEXT:    retq798;799; SSE3-FAST-LABEL: extract_extract01_v8f32_fadd_f32:800; SSE3-FAST:       # %bb.0:801; SSE3-FAST-NEXT:    haddps %xmm0, %xmm0802; SSE3-FAST-NEXT:    retq803;804; AVX-SLOW-LABEL: extract_extract01_v8f32_fadd_f32:805; AVX-SLOW:       # %bb.0:806; AVX-SLOW-NEXT:    vmovshdup {{.*#+}} xmm1 = xmm0[1,1,3,3]807; AVX-SLOW-NEXT:    vaddss %xmm1, %xmm0, %xmm0808; AVX-SLOW-NEXT:    vzeroupper809; AVX-SLOW-NEXT:    retq810;811; AVX-FAST-LABEL: extract_extract01_v8f32_fadd_f32:812; AVX-FAST:       # %bb.0:813; AVX-FAST-NEXT:    vhaddps %xmm0, %xmm0, %xmm0814; AVX-FAST-NEXT:    vzeroupper815; AVX-FAST-NEXT:    retq816  %x0 = extractelement <8 x float> %x, i32 0817  %x1 = extractelement <8 x float> %x, i32 1818  %x01 = fadd float %x0, %x1819  ret float %x01820}821 822define float @extract_extract23_v8f32_fadd_f32(<8 x float> %x) {823; SSE3-SLOW-LABEL: extract_extract23_v8f32_fadd_f32:824; SSE3-SLOW:       # %bb.0:825; SSE3-SLOW-NEXT:    movaps %xmm0, %xmm1826; SSE3-SLOW-NEXT:    unpckhpd {{.*#+}} xmm1 = xmm1[1],xmm0[1]827; SSE3-SLOW-NEXT:    shufps {{.*#+}} xmm0 = xmm0[3,3,3,3]828; SSE3-SLOW-NEXT:    addss %xmm1, %xmm0829; SSE3-SLOW-NEXT:    retq830;831; SSE3-FAST-LABEL: extract_extract23_v8f32_fadd_f32:832; SSE3-FAST:       # %bb.0:833; SSE3-FAST-NEXT:    haddps %xmm0, %xmm0834; SSE3-FAST-NEXT:    movshdup {{.*#+}} xmm0 = xmm0[1,1,3,3]835; SSE3-FAST-NEXT:    retq836;837; AVX-SLOW-LABEL: extract_extract23_v8f32_fadd_f32:838; AVX-SLOW:       # %bb.0:839; AVX-SLOW-NEXT:    vshufpd {{.*#+}} xmm1 = xmm0[1,0]840; AVX-SLOW-NEXT:    vshufps {{.*#+}} xmm0 = xmm0[3,3,3,3]841; AVX-SLOW-NEXT:    vaddss %xmm0, %xmm1, %xmm0842; AVX-SLOW-NEXT:    vzeroupper843; AVX-SLOW-NEXT:    retq844;845; AVX-FAST-LABEL: extract_extract23_v8f32_fadd_f32:846; AVX-FAST:       # %bb.0:847; AVX-FAST-NEXT:    vhaddps %xmm0, %xmm0, %xmm0848; AVX-FAST-NEXT:    vmovshdup {{.*#+}} xmm0 = xmm0[1,1,3,3]849; AVX-FAST-NEXT:    vzeroupper850; AVX-FAST-NEXT:    retq851  %x0 = extractelement <8 x float> %x, i32 2852  %x1 = extractelement <8 x float> %x, i32 3853  %x01 = fadd float %x0, %x1854  ret float %x01855}856 857define float @extract_extract67_v8f32_fadd_f32(<8 x float> %x) {858; SSE3-SLOW-LABEL: extract_extract67_v8f32_fadd_f32:859; SSE3-SLOW:       # %bb.0:860; SSE3-SLOW-NEXT:    movaps %xmm1, %xmm0861; SSE3-SLOW-NEXT:    unpckhpd {{.*#+}} xmm0 = xmm0[1],xmm1[1]862; SSE3-SLOW-NEXT:    shufps {{.*#+}} xmm1 = xmm1[3,3,3,3]863; SSE3-SLOW-NEXT:    addss %xmm1, %xmm0864; SSE3-SLOW-NEXT:    retq865;866; SSE3-FAST-LABEL: extract_extract67_v8f32_fadd_f32:867; SSE3-FAST:       # %bb.0:868; SSE3-FAST-NEXT:    haddps %xmm1, %xmm1869; SSE3-FAST-NEXT:    movshdup {{.*#+}} xmm0 = xmm1[1,1,3,3]870; SSE3-FAST-NEXT:    retq871;872; AVX-SLOW-LABEL: extract_extract67_v8f32_fadd_f32:873; AVX-SLOW:       # %bb.0:874; AVX-SLOW-NEXT:    vextractf128 $1, %ymm0, %xmm0875; AVX-SLOW-NEXT:    vshufpd {{.*#+}} xmm1 = xmm0[1,0]876; AVX-SLOW-NEXT:    vshufps {{.*#+}} xmm0 = xmm0[3,3,3,3]877; AVX-SLOW-NEXT:    vaddss %xmm0, %xmm1, %xmm0878; AVX-SLOW-NEXT:    vzeroupper879; AVX-SLOW-NEXT:    retq880;881; AVX-FAST-LABEL: extract_extract67_v8f32_fadd_f32:882; AVX-FAST:       # %bb.0:883; AVX-FAST-NEXT:    vextractf128 $1, %ymm0, %xmm0884; AVX-FAST-NEXT:    vhaddps %xmm0, %xmm0, %xmm0885; AVX-FAST-NEXT:    vmovshdup {{.*#+}} xmm0 = xmm0[1,1,3,3]886; AVX-FAST-NEXT:    vzeroupper887; AVX-FAST-NEXT:    retq888  %x0 = extractelement <8 x float> %x, i32 6889  %x1 = extractelement <8 x float> %x, i32 7890  %x01 = fadd float %x0, %x1891  ret float %x01892}893 894define float @extract_extract01_v8f32_fadd_f32_commute(<8 x float> %x) {895; SSE3-SLOW-LABEL: extract_extract01_v8f32_fadd_f32_commute:896; SSE3-SLOW:       # %bb.0:897; SSE3-SLOW-NEXT:    movshdup {{.*#+}} xmm1 = xmm0[1,1,3,3]898; SSE3-SLOW-NEXT:    addss %xmm1, %xmm0899; SSE3-SLOW-NEXT:    retq900;901; SSE3-FAST-LABEL: extract_extract01_v8f32_fadd_f32_commute:902; SSE3-FAST:       # %bb.0:903; SSE3-FAST-NEXT:    haddps %xmm0, %xmm0904; SSE3-FAST-NEXT:    retq905;906; AVX-SLOW-LABEL: extract_extract01_v8f32_fadd_f32_commute:907; AVX-SLOW:       # %bb.0:908; AVX-SLOW-NEXT:    vmovshdup {{.*#+}} xmm1 = xmm0[1,1,3,3]909; AVX-SLOW-NEXT:    vaddss %xmm0, %xmm1, %xmm0910; AVX-SLOW-NEXT:    vzeroupper911; AVX-SLOW-NEXT:    retq912;913; AVX-FAST-LABEL: extract_extract01_v8f32_fadd_f32_commute:914; AVX-FAST:       # %bb.0:915; AVX-FAST-NEXT:    vhaddps %xmm0, %xmm0, %xmm0916; AVX-FAST-NEXT:    vzeroupper917; AVX-FAST-NEXT:    retq918  %x0 = extractelement <8 x float> %x, i32 0919  %x1 = extractelement <8 x float> %x, i32 1920  %x01 = fadd float %x1, %x0921  ret float %x01922}923 924define float @extract_extract23_v8f32_fadd_f32_commute(<8 x float> %x) {925; SSE3-SLOW-LABEL: extract_extract23_v8f32_fadd_f32_commute:926; SSE3-SLOW:       # %bb.0:927; SSE3-SLOW-NEXT:    movaps %xmm0, %xmm1928; SSE3-SLOW-NEXT:    unpckhpd {{.*#+}} xmm1 = xmm1[1],xmm0[1]929; SSE3-SLOW-NEXT:    shufps {{.*#+}} xmm0 = xmm0[3,3,3,3]930; SSE3-SLOW-NEXT:    addss %xmm1, %xmm0931; SSE3-SLOW-NEXT:    retq932;933; SSE3-FAST-LABEL: extract_extract23_v8f32_fadd_f32_commute:934; SSE3-FAST:       # %bb.0:935; SSE3-FAST-NEXT:    haddps %xmm0, %xmm0936; SSE3-FAST-NEXT:    movshdup {{.*#+}} xmm0 = xmm0[1,1,3,3]937; SSE3-FAST-NEXT:    retq938;939; AVX-SLOW-LABEL: extract_extract23_v8f32_fadd_f32_commute:940; AVX-SLOW:       # %bb.0:941; AVX-SLOW-NEXT:    vshufpd {{.*#+}} xmm1 = xmm0[1,0]942; AVX-SLOW-NEXT:    vshufps {{.*#+}} xmm0 = xmm0[3,3,3,3]943; AVX-SLOW-NEXT:    vaddss %xmm1, %xmm0, %xmm0944; AVX-SLOW-NEXT:    vzeroupper945; AVX-SLOW-NEXT:    retq946;947; AVX-FAST-LABEL: extract_extract23_v8f32_fadd_f32_commute:948; AVX-FAST:       # %bb.0:949; AVX-FAST-NEXT:    vhaddps %xmm0, %xmm0, %xmm0950; AVX-FAST-NEXT:    vmovshdup {{.*#+}} xmm0 = xmm0[1,1,3,3]951; AVX-FAST-NEXT:    vzeroupper952; AVX-FAST-NEXT:    retq953  %x0 = extractelement <8 x float> %x, i32 2954  %x1 = extractelement <8 x float> %x, i32 3955  %x01 = fadd float %x1, %x0956  ret float %x01957}958 959define float @extract_extract67_v8f32_fadd_f32_commute(<8 x float> %x) {960; SSE3-SLOW-LABEL: extract_extract67_v8f32_fadd_f32_commute:961; SSE3-SLOW:       # %bb.0:962; SSE3-SLOW-NEXT:    movaps %xmm1, %xmm0963; SSE3-SLOW-NEXT:    unpckhpd {{.*#+}} xmm0 = xmm0[1],xmm1[1]964; SSE3-SLOW-NEXT:    shufps {{.*#+}} xmm1 = xmm1[3,3,3,3]965; SSE3-SLOW-NEXT:    addss %xmm1, %xmm0966; SSE3-SLOW-NEXT:    retq967;968; SSE3-FAST-LABEL: extract_extract67_v8f32_fadd_f32_commute:969; SSE3-FAST:       # %bb.0:970; SSE3-FAST-NEXT:    haddps %xmm1, %xmm1971; SSE3-FAST-NEXT:    movshdup {{.*#+}} xmm0 = xmm1[1,1,3,3]972; SSE3-FAST-NEXT:    retq973;974; AVX-SLOW-LABEL: extract_extract67_v8f32_fadd_f32_commute:975; AVX-SLOW:       # %bb.0:976; AVX-SLOW-NEXT:    vextractf128 $1, %ymm0, %xmm0977; AVX-SLOW-NEXT:    vshufpd {{.*#+}} xmm1 = xmm0[1,0]978; AVX-SLOW-NEXT:    vshufps {{.*#+}} xmm0 = xmm0[3,3,3,3]979; AVX-SLOW-NEXT:    vaddss %xmm1, %xmm0, %xmm0980; AVX-SLOW-NEXT:    vzeroupper981; AVX-SLOW-NEXT:    retq982;983; AVX-FAST-LABEL: extract_extract67_v8f32_fadd_f32_commute:984; AVX-FAST:       # %bb.0:985; AVX-FAST-NEXT:    vextractf128 $1, %ymm0, %xmm0986; AVX-FAST-NEXT:    vhaddps %xmm0, %xmm0, %xmm0987; AVX-FAST-NEXT:    vmovshdup {{.*#+}} xmm0 = xmm0[1,1,3,3]988; AVX-FAST-NEXT:    vzeroupper989; AVX-FAST-NEXT:    retq990  %x0 = extractelement <8 x float> %x, i32 6991  %x1 = extractelement <8 x float> %x, i32 7992  %x01 = fadd float %x1, %x0993  ret float %x01994}995 996define double @extract_extract01_v4f64_fadd_f64(<4 x double> %x) {997; SSE3-SLOW-LABEL: extract_extract01_v4f64_fadd_f64:998; SSE3-SLOW:       # %bb.0:999; SSE3-SLOW-NEXT:    movapd %xmm0, %xmm11000; SSE3-SLOW-NEXT:    unpckhpd {{.*#+}} xmm1 = xmm1[1],xmm0[1]1001; SSE3-SLOW-NEXT:    addsd %xmm1, %xmm01002; SSE3-SLOW-NEXT:    retq1003;1004; SSE3-FAST-LABEL: extract_extract01_v4f64_fadd_f64:1005; SSE3-FAST:       # %bb.0:1006; SSE3-FAST-NEXT:    haddpd %xmm0, %xmm01007; SSE3-FAST-NEXT:    retq1008;1009; AVX-SLOW-LABEL: extract_extract01_v4f64_fadd_f64:1010; AVX-SLOW:       # %bb.0:1011; AVX-SLOW-NEXT:    vshufpd {{.*#+}} xmm1 = xmm0[1,0]1012; AVX-SLOW-NEXT:    vaddsd %xmm1, %xmm0, %xmm01013; AVX-SLOW-NEXT:    vzeroupper1014; AVX-SLOW-NEXT:    retq1015;1016; AVX-FAST-LABEL: extract_extract01_v4f64_fadd_f64:1017; AVX-FAST:       # %bb.0:1018; AVX-FAST-NEXT:    vhaddpd %xmm0, %xmm0, %xmm01019; AVX-FAST-NEXT:    vzeroupper1020; AVX-FAST-NEXT:    retq1021  %x0 = extractelement <4 x double> %x, i32 01022  %x1 = extractelement <4 x double> %x, i32 11023  %x01 = fadd double %x0, %x11024  ret double %x011025}1026 1027define double @extract_extract23_v4f64_fadd_f64(<4 x double> %x) {1028; SSE3-SLOW-LABEL: extract_extract23_v4f64_fadd_f64:1029; SSE3-SLOW:       # %bb.0:1030; SSE3-SLOW-NEXT:    movapd %xmm1, %xmm01031; SSE3-SLOW-NEXT:    unpckhpd {{.*#+}} xmm0 = xmm0[1],xmm1[1]1032; SSE3-SLOW-NEXT:    addsd %xmm1, %xmm01033; SSE3-SLOW-NEXT:    retq1034;1035; SSE3-FAST-LABEL: extract_extract23_v4f64_fadd_f64:1036; SSE3-FAST:       # %bb.0:1037; SSE3-FAST-NEXT:    movapd %xmm1, %xmm01038; SSE3-FAST-NEXT:    haddpd %xmm1, %xmm01039; SSE3-FAST-NEXT:    retq1040;1041; AVX-SLOW-LABEL: extract_extract23_v4f64_fadd_f64:1042; AVX-SLOW:       # %bb.0:1043; AVX-SLOW-NEXT:    vextractf128 $1, %ymm0, %xmm01044; AVX-SLOW-NEXT:    vshufpd {{.*#+}} xmm1 = xmm0[1,0]1045; AVX-SLOW-NEXT:    vaddsd %xmm1, %xmm0, %xmm01046; AVX-SLOW-NEXT:    vzeroupper1047; AVX-SLOW-NEXT:    retq1048;1049; AVX-FAST-LABEL: extract_extract23_v4f64_fadd_f64:1050; AVX-FAST:       # %bb.0:1051; AVX-FAST-NEXT:    vextractf128 $1, %ymm0, %xmm01052; AVX-FAST-NEXT:    vhaddpd %xmm0, %xmm0, %xmm01053; AVX-FAST-NEXT:    vzeroupper1054; AVX-FAST-NEXT:    retq1055  %x0 = extractelement <4 x double> %x, i32 21056  %x1 = extractelement <4 x double> %x, i32 31057  %x01 = fadd double %x0, %x11058  ret double %x011059}1060 1061define double @extract_extract01_v4f64_fadd_f64_commute(<4 x double> %x) {1062; SSE3-SLOW-LABEL: extract_extract01_v4f64_fadd_f64_commute:1063; SSE3-SLOW:       # %bb.0:1064; SSE3-SLOW-NEXT:    movapd %xmm0, %xmm11065; SSE3-SLOW-NEXT:    unpckhpd {{.*#+}} xmm1 = xmm1[1],xmm0[1]1066; SSE3-SLOW-NEXT:    addsd %xmm1, %xmm01067; SSE3-SLOW-NEXT:    retq1068;1069; SSE3-FAST-LABEL: extract_extract01_v4f64_fadd_f64_commute:1070; SSE3-FAST:       # %bb.0:1071; SSE3-FAST-NEXT:    haddpd %xmm0, %xmm01072; SSE3-FAST-NEXT:    retq1073;1074; AVX-SLOW-LABEL: extract_extract01_v4f64_fadd_f64_commute:1075; AVX-SLOW:       # %bb.0:1076; AVX-SLOW-NEXT:    vshufpd {{.*#+}} xmm1 = xmm0[1,0]1077; AVX-SLOW-NEXT:    vaddsd %xmm0, %xmm1, %xmm01078; AVX-SLOW-NEXT:    vzeroupper1079; AVX-SLOW-NEXT:    retq1080;1081; AVX-FAST-LABEL: extract_extract01_v4f64_fadd_f64_commute:1082; AVX-FAST:       # %bb.0:1083; AVX-FAST-NEXT:    vhaddpd %xmm0, %xmm0, %xmm01084; AVX-FAST-NEXT:    vzeroupper1085; AVX-FAST-NEXT:    retq1086  %x0 = extractelement <4 x double> %x, i32 01087  %x1 = extractelement <4 x double> %x, i32 11088  %x01 = fadd double %x1, %x01089  ret double %x011090}1091 1092define double @extract_extract23_v4f64_fadd_f64_commute(<4 x double> %x) {1093; SSE3-SLOW-LABEL: extract_extract23_v4f64_fadd_f64_commute:1094; SSE3-SLOW:       # %bb.0:1095; SSE3-SLOW-NEXT:    movapd %xmm1, %xmm01096; SSE3-SLOW-NEXT:    unpckhpd {{.*#+}} xmm0 = xmm0[1],xmm1[1]1097; SSE3-SLOW-NEXT:    addsd %xmm1, %xmm01098; SSE3-SLOW-NEXT:    retq1099;1100; SSE3-FAST-LABEL: extract_extract23_v4f64_fadd_f64_commute:1101; SSE3-FAST:       # %bb.0:1102; SSE3-FAST-NEXT:    movapd %xmm1, %xmm01103; SSE3-FAST-NEXT:    haddpd %xmm1, %xmm01104; SSE3-FAST-NEXT:    retq1105;1106; AVX-SLOW-LABEL: extract_extract23_v4f64_fadd_f64_commute:1107; AVX-SLOW:       # %bb.0:1108; AVX-SLOW-NEXT:    vextractf128 $1, %ymm0, %xmm01109; AVX-SLOW-NEXT:    vshufpd {{.*#+}} xmm1 = xmm0[1,0]1110; AVX-SLOW-NEXT:    vaddsd %xmm0, %xmm1, %xmm01111; AVX-SLOW-NEXT:    vzeroupper1112; AVX-SLOW-NEXT:    retq1113;1114; AVX-FAST-LABEL: extract_extract23_v4f64_fadd_f64_commute:1115; AVX-FAST:       # %bb.0:1116; AVX-FAST-NEXT:    vextractf128 $1, %ymm0, %xmm01117; AVX-FAST-NEXT:    vhaddpd %xmm0, %xmm0, %xmm01118; AVX-FAST-NEXT:    vzeroupper1119; AVX-FAST-NEXT:    retq1120  %x0 = extractelement <4 x double> %x, i32 21121  %x1 = extractelement <4 x double> %x, i32 31122  %x01 = fadd double %x1, %x01123  ret double %x011124}1125 1126define float @extract_extract01_v8f32_fsub_f32(<8 x float> %x) {1127; SSE3-SLOW-LABEL: extract_extract01_v8f32_fsub_f32:1128; SSE3-SLOW:       # %bb.0:1129; SSE3-SLOW-NEXT:    movshdup {{.*#+}} xmm1 = xmm0[1,1,3,3]1130; SSE3-SLOW-NEXT:    subss %xmm1, %xmm01131; SSE3-SLOW-NEXT:    retq1132;1133; SSE3-FAST-LABEL: extract_extract01_v8f32_fsub_f32:1134; SSE3-FAST:       # %bb.0:1135; SSE3-FAST-NEXT:    hsubps %xmm0, %xmm01136; SSE3-FAST-NEXT:    retq1137;1138; AVX-SLOW-LABEL: extract_extract01_v8f32_fsub_f32:1139; AVX-SLOW:       # %bb.0:1140; AVX-SLOW-NEXT:    vmovshdup {{.*#+}} xmm1 = xmm0[1,1,3,3]1141; AVX-SLOW-NEXT:    vsubss %xmm1, %xmm0, %xmm01142; AVX-SLOW-NEXT:    vzeroupper1143; AVX-SLOW-NEXT:    retq1144;1145; AVX-FAST-LABEL: extract_extract01_v8f32_fsub_f32:1146; AVX-FAST:       # %bb.0:1147; AVX-FAST-NEXT:    vhsubps %xmm0, %xmm0, %xmm01148; AVX-FAST-NEXT:    vzeroupper1149; AVX-FAST-NEXT:    retq1150  %x0 = extractelement <8 x float> %x, i32 01151  %x1 = extractelement <8 x float> %x, i32 11152  %x01 = fsub float %x0, %x11153  ret float %x011154}1155 1156define float @extract_extract23_v8f32_fsub_f32(<8 x float> %x) {1157; SSE3-SLOW-LABEL: extract_extract23_v8f32_fsub_f32:1158; SSE3-SLOW:       # %bb.0:1159; SSE3-SLOW-NEXT:    movaps %xmm0, %xmm11160; SSE3-SLOW-NEXT:    unpckhpd {{.*#+}} xmm1 = xmm1[1],xmm0[1]1161; SSE3-SLOW-NEXT:    shufps {{.*#+}} xmm0 = xmm0[3,3,3,3]1162; SSE3-SLOW-NEXT:    subss %xmm0, %xmm11163; SSE3-SLOW-NEXT:    movaps %xmm1, %xmm01164; SSE3-SLOW-NEXT:    retq1165;1166; SSE3-FAST-LABEL: extract_extract23_v8f32_fsub_f32:1167; SSE3-FAST:       # %bb.0:1168; SSE3-FAST-NEXT:    hsubps %xmm0, %xmm01169; SSE3-FAST-NEXT:    movshdup {{.*#+}} xmm0 = xmm0[1,1,3,3]1170; SSE3-FAST-NEXT:    retq1171;1172; AVX-SLOW-LABEL: extract_extract23_v8f32_fsub_f32:1173; AVX-SLOW:       # %bb.0:1174; AVX-SLOW-NEXT:    vshufpd {{.*#+}} xmm1 = xmm0[1,0]1175; AVX-SLOW-NEXT:    vshufps {{.*#+}} xmm0 = xmm0[3,3,3,3]1176; AVX-SLOW-NEXT:    vsubss %xmm0, %xmm1, %xmm01177; AVX-SLOW-NEXT:    vzeroupper1178; AVX-SLOW-NEXT:    retq1179;1180; AVX-FAST-LABEL: extract_extract23_v8f32_fsub_f32:1181; AVX-FAST:       # %bb.0:1182; AVX-FAST-NEXT:    vhsubps %xmm0, %xmm0, %xmm01183; AVX-FAST-NEXT:    vmovshdup {{.*#+}} xmm0 = xmm0[1,1,3,3]1184; AVX-FAST-NEXT:    vzeroupper1185; AVX-FAST-NEXT:    retq1186  %x0 = extractelement <8 x float> %x, i32 21187  %x1 = extractelement <8 x float> %x, i32 31188  %x01 = fsub float %x0, %x11189  ret float %x011190}1191 1192define float @extract_extract45_v8f32_fsub_f32(<8 x float> %x) {1193; SSE3-SLOW-LABEL: extract_extract45_v8f32_fsub_f32:1194; SSE3-SLOW:       # %bb.0:1195; SSE3-SLOW-NEXT:    movaps %xmm1, %xmm01196; SSE3-SLOW-NEXT:    movshdup {{.*#+}} xmm1 = xmm1[1,1,3,3]1197; SSE3-SLOW-NEXT:    subss %xmm1, %xmm01198; SSE3-SLOW-NEXT:    retq1199;1200; SSE3-FAST-LABEL: extract_extract45_v8f32_fsub_f32:1201; SSE3-FAST:       # %bb.0:1202; SSE3-FAST-NEXT:    movaps %xmm1, %xmm01203; SSE3-FAST-NEXT:    hsubps %xmm1, %xmm01204; SSE3-FAST-NEXT:    retq1205;1206; AVX-SLOW-LABEL: extract_extract45_v8f32_fsub_f32:1207; AVX-SLOW:       # %bb.0:1208; AVX-SLOW-NEXT:    vextractf128 $1, %ymm0, %xmm01209; AVX-SLOW-NEXT:    vmovshdup {{.*#+}} xmm1 = xmm0[1,1,3,3]1210; AVX-SLOW-NEXT:    vsubss %xmm1, %xmm0, %xmm01211; AVX-SLOW-NEXT:    vzeroupper1212; AVX-SLOW-NEXT:    retq1213;1214; AVX-FAST-LABEL: extract_extract45_v8f32_fsub_f32:1215; AVX-FAST:       # %bb.0:1216; AVX-FAST-NEXT:    vextractf128 $1, %ymm0, %xmm01217; AVX-FAST-NEXT:    vhsubps %xmm0, %xmm0, %xmm01218; AVX-FAST-NEXT:    vzeroupper1219; AVX-FAST-NEXT:    retq1220  %x0 = extractelement <8 x float> %x, i32 41221  %x1 = extractelement <8 x float> %x, i32 51222  %x01 = fsub float %x0, %x11223  ret float %x011224}1225 1226; Negative test...or get hoppy and negate?1227 1228define float @extract_extract01_v8f32_fsub_f32_commute(<8 x float> %x) {1229; SSE3-LABEL: extract_extract01_v8f32_fsub_f32_commute:1230; SSE3:       # %bb.0:1231; SSE3-NEXT:    movshdup {{.*#+}} xmm1 = xmm0[1,1,3,3]1232; SSE3-NEXT:    subss %xmm0, %xmm11233; SSE3-NEXT:    movaps %xmm1, %xmm01234; SSE3-NEXT:    retq1235;1236; AVX-LABEL: extract_extract01_v8f32_fsub_f32_commute:1237; AVX:       # %bb.0:1238; AVX-NEXT:    vmovshdup {{.*#+}} xmm1 = xmm0[1,1,3,3]1239; AVX-NEXT:    vsubss %xmm0, %xmm1, %xmm01240; AVX-NEXT:    vzeroupper1241; AVX-NEXT:    retq1242  %x0 = extractelement <8 x float> %x, i32 01243  %x1 = extractelement <8 x float> %x, i32 11244  %x01 = fsub float %x1, %x01245  ret float %x011246}1247 1248define double @extract_extract01_v4f64_fsub_f64(<4 x double> %x) {1249; SSE3-SLOW-LABEL: extract_extract01_v4f64_fsub_f64:1250; SSE3-SLOW:       # %bb.0:1251; SSE3-SLOW-NEXT:    movapd %xmm0, %xmm11252; SSE3-SLOW-NEXT:    unpckhpd {{.*#+}} xmm1 = xmm1[1],xmm0[1]1253; SSE3-SLOW-NEXT:    subsd %xmm1, %xmm01254; SSE3-SLOW-NEXT:    retq1255;1256; SSE3-FAST-LABEL: extract_extract01_v4f64_fsub_f64:1257; SSE3-FAST:       # %bb.0:1258; SSE3-FAST-NEXT:    hsubpd %xmm0, %xmm01259; SSE3-FAST-NEXT:    retq1260;1261; AVX-SLOW-LABEL: extract_extract01_v4f64_fsub_f64:1262; AVX-SLOW:       # %bb.0:1263; AVX-SLOW-NEXT:    vshufpd {{.*#+}} xmm1 = xmm0[1,0]1264; AVX-SLOW-NEXT:    vsubsd %xmm1, %xmm0, %xmm01265; AVX-SLOW-NEXT:    vzeroupper1266; AVX-SLOW-NEXT:    retq1267;1268; AVX-FAST-LABEL: extract_extract01_v4f64_fsub_f64:1269; AVX-FAST:       # %bb.0:1270; AVX-FAST-NEXT:    vhsubpd %xmm0, %xmm0, %xmm01271; AVX-FAST-NEXT:    vzeroupper1272; AVX-FAST-NEXT:    retq1273  %x0 = extractelement <4 x double> %x, i32 01274  %x1 = extractelement <4 x double> %x, i32 11275  %x01 = fsub double %x0, %x11276  ret double %x011277}1278 1279; Negative test...or get hoppy and negate?1280 1281define double @extract_extract01_v4f64_fsub_f64_commute(<4 x double> %x) {1282; SSE3-LABEL: extract_extract01_v4f64_fsub_f64_commute:1283; SSE3:       # %bb.0:1284; SSE3-NEXT:    movapd %xmm0, %xmm11285; SSE3-NEXT:    unpckhpd {{.*#+}} xmm1 = xmm1[1],xmm0[1]1286; SSE3-NEXT:    subsd %xmm0, %xmm11287; SSE3-NEXT:    movapd %xmm1, %xmm01288; SSE3-NEXT:    retq1289;1290; AVX-LABEL: extract_extract01_v4f64_fsub_f64_commute:1291; AVX:       # %bb.0:1292; AVX-NEXT:    vshufpd {{.*#+}} xmm1 = xmm0[1,0]1293; AVX-NEXT:    vsubsd %xmm0, %xmm1, %xmm01294; AVX-NEXT:    vzeroupper1295; AVX-NEXT:    retq1296  %x0 = extractelement <4 x double> %x, i32 01297  %x1 = extractelement <4 x double> %x, i32 11298  %x01 = fsub double %x1, %x01299  ret double %x011300}1301 1302; 512-bit vectors, float/double, fadd/fsub1303 1304define float @extract_extract01_v16f32_fadd_f32(<16 x float> %x) {1305; SSE3-SLOW-LABEL: extract_extract01_v16f32_fadd_f32:1306; SSE3-SLOW:       # %bb.0:1307; SSE3-SLOW-NEXT:    movshdup {{.*#+}} xmm1 = xmm0[1,1,3,3]1308; SSE3-SLOW-NEXT:    addss %xmm1, %xmm01309; SSE3-SLOW-NEXT:    retq1310;1311; SSE3-FAST-LABEL: extract_extract01_v16f32_fadd_f32:1312; SSE3-FAST:       # %bb.0:1313; SSE3-FAST-NEXT:    haddps %xmm0, %xmm01314; SSE3-FAST-NEXT:    retq1315;1316; AVX-SLOW-LABEL: extract_extract01_v16f32_fadd_f32:1317; AVX-SLOW:       # %bb.0:1318; AVX-SLOW-NEXT:    vmovshdup {{.*#+}} xmm1 = xmm0[1,1,3,3]1319; AVX-SLOW-NEXT:    vaddss %xmm1, %xmm0, %xmm01320; AVX-SLOW-NEXT:    vzeroupper1321; AVX-SLOW-NEXT:    retq1322;1323; AVX-FAST-LABEL: extract_extract01_v16f32_fadd_f32:1324; AVX-FAST:       # %bb.0:1325; AVX-FAST-NEXT:    vhaddps %xmm0, %xmm0, %xmm01326; AVX-FAST-NEXT:    vzeroupper1327; AVX-FAST-NEXT:    retq1328  %x0 = extractelement <16 x float> %x, i32 01329  %x1 = extractelement <16 x float> %x, i32 11330  %x01 = fadd float %x0, %x11331  ret float %x011332}1333 1334define float @extract_extract01_v16f32_fadd_f32_commute(<16 x float> %x) {1335; SSE3-SLOW-LABEL: extract_extract01_v16f32_fadd_f32_commute:1336; SSE3-SLOW:       # %bb.0:1337; SSE3-SLOW-NEXT:    movshdup {{.*#+}} xmm1 = xmm0[1,1,3,3]1338; SSE3-SLOW-NEXT:    addss %xmm1, %xmm01339; SSE3-SLOW-NEXT:    retq1340;1341; SSE3-FAST-LABEL: extract_extract01_v16f32_fadd_f32_commute:1342; SSE3-FAST:       # %bb.0:1343; SSE3-FAST-NEXT:    haddps %xmm0, %xmm01344; SSE3-FAST-NEXT:    retq1345;1346; AVX-SLOW-LABEL: extract_extract01_v16f32_fadd_f32_commute:1347; AVX-SLOW:       # %bb.0:1348; AVX-SLOW-NEXT:    vmovshdup {{.*#+}} xmm1 = xmm0[1,1,3,3]1349; AVX-SLOW-NEXT:    vaddss %xmm0, %xmm1, %xmm01350; AVX-SLOW-NEXT:    vzeroupper1351; AVX-SLOW-NEXT:    retq1352;1353; AVX-FAST-LABEL: extract_extract01_v16f32_fadd_f32_commute:1354; AVX-FAST:       # %bb.0:1355; AVX-FAST-NEXT:    vhaddps %xmm0, %xmm0, %xmm01356; AVX-FAST-NEXT:    vzeroupper1357; AVX-FAST-NEXT:    retq1358  %x0 = extractelement <16 x float> %x, i32 01359  %x1 = extractelement <16 x float> %x, i32 11360  %x01 = fadd float %x1, %x01361  ret float %x011362}1363 1364define double @extract_extract01_v8f64_fadd_f64(<8 x double> %x) {1365; SSE3-SLOW-LABEL: extract_extract01_v8f64_fadd_f64:1366; SSE3-SLOW:       # %bb.0:1367; SSE3-SLOW-NEXT:    movapd %xmm0, %xmm11368; SSE3-SLOW-NEXT:    unpckhpd {{.*#+}} xmm1 = xmm1[1],xmm0[1]1369; SSE3-SLOW-NEXT:    addsd %xmm1, %xmm01370; SSE3-SLOW-NEXT:    retq1371;1372; SSE3-FAST-LABEL: extract_extract01_v8f64_fadd_f64:1373; SSE3-FAST:       # %bb.0:1374; SSE3-FAST-NEXT:    haddpd %xmm0, %xmm01375; SSE3-FAST-NEXT:    retq1376;1377; AVX-SLOW-LABEL: extract_extract01_v8f64_fadd_f64:1378; AVX-SLOW:       # %bb.0:1379; AVX-SLOW-NEXT:    vshufpd {{.*#+}} xmm1 = xmm0[1,0]1380; AVX-SLOW-NEXT:    vaddsd %xmm1, %xmm0, %xmm01381; AVX-SLOW-NEXT:    vzeroupper1382; AVX-SLOW-NEXT:    retq1383;1384; AVX-FAST-LABEL: extract_extract01_v8f64_fadd_f64:1385; AVX-FAST:       # %bb.0:1386; AVX-FAST-NEXT:    vhaddpd %xmm0, %xmm0, %xmm01387; AVX-FAST-NEXT:    vzeroupper1388; AVX-FAST-NEXT:    retq1389  %x0 = extractelement <8 x double> %x, i32 01390  %x1 = extractelement <8 x double> %x, i32 11391  %x01 = fadd double %x0, %x11392  ret double %x011393}1394 1395define double @extract_extract01_v8f64_fadd_f64_commute(<8 x double> %x) {1396; SSE3-SLOW-LABEL: extract_extract01_v8f64_fadd_f64_commute:1397; SSE3-SLOW:       # %bb.0:1398; SSE3-SLOW-NEXT:    movapd %xmm0, %xmm11399; SSE3-SLOW-NEXT:    unpckhpd {{.*#+}} xmm1 = xmm1[1],xmm0[1]1400; SSE3-SLOW-NEXT:    addsd %xmm1, %xmm01401; SSE3-SLOW-NEXT:    retq1402;1403; SSE3-FAST-LABEL: extract_extract01_v8f64_fadd_f64_commute:1404; SSE3-FAST:       # %bb.0:1405; SSE3-FAST-NEXT:    haddpd %xmm0, %xmm01406; SSE3-FAST-NEXT:    retq1407;1408; AVX-SLOW-LABEL: extract_extract01_v8f64_fadd_f64_commute:1409; AVX-SLOW:       # %bb.0:1410; AVX-SLOW-NEXT:    vshufpd {{.*#+}} xmm1 = xmm0[1,0]1411; AVX-SLOW-NEXT:    vaddsd %xmm0, %xmm1, %xmm01412; AVX-SLOW-NEXT:    vzeroupper1413; AVX-SLOW-NEXT:    retq1414;1415; AVX-FAST-LABEL: extract_extract01_v8f64_fadd_f64_commute:1416; AVX-FAST:       # %bb.0:1417; AVX-FAST-NEXT:    vhaddpd %xmm0, %xmm0, %xmm01418; AVX-FAST-NEXT:    vzeroupper1419; AVX-FAST-NEXT:    retq1420  %x0 = extractelement <8 x double> %x, i32 01421  %x1 = extractelement <8 x double> %x, i32 11422  %x01 = fadd double %x1, %x01423  ret double %x011424}1425 1426define float @extract_extract01_v16f32_fsub_f32(<16 x float> %x) {1427; SSE3-SLOW-LABEL: extract_extract01_v16f32_fsub_f32:1428; SSE3-SLOW:       # %bb.0:1429; SSE3-SLOW-NEXT:    movshdup {{.*#+}} xmm1 = xmm0[1,1,3,3]1430; SSE3-SLOW-NEXT:    subss %xmm1, %xmm01431; SSE3-SLOW-NEXT:    retq1432;1433; SSE3-FAST-LABEL: extract_extract01_v16f32_fsub_f32:1434; SSE3-FAST:       # %bb.0:1435; SSE3-FAST-NEXT:    hsubps %xmm0, %xmm01436; SSE3-FAST-NEXT:    retq1437;1438; AVX-SLOW-LABEL: extract_extract01_v16f32_fsub_f32:1439; AVX-SLOW:       # %bb.0:1440; AVX-SLOW-NEXT:    vmovshdup {{.*#+}} xmm1 = xmm0[1,1,3,3]1441; AVX-SLOW-NEXT:    vsubss %xmm1, %xmm0, %xmm01442; AVX-SLOW-NEXT:    vzeroupper1443; AVX-SLOW-NEXT:    retq1444;1445; AVX-FAST-LABEL: extract_extract01_v16f32_fsub_f32:1446; AVX-FAST:       # %bb.0:1447; AVX-FAST-NEXT:    vhsubps %xmm0, %xmm0, %xmm01448; AVX-FAST-NEXT:    vzeroupper1449; AVX-FAST-NEXT:    retq1450  %x0 = extractelement <16 x float> %x, i32 01451  %x1 = extractelement <16 x float> %x, i32 11452  %x01 = fsub float %x0, %x11453  ret float %x011454}1455 1456define float @extract_extract01_v16f32_fsub_f32_commute(<16 x float> %x) {1457; SSE3-LABEL: extract_extract01_v16f32_fsub_f32_commute:1458; SSE3:       # %bb.0:1459; SSE3-NEXT:    movshdup {{.*#+}} xmm1 = xmm0[1,1,3,3]1460; SSE3-NEXT:    subss %xmm0, %xmm11461; SSE3-NEXT:    movaps %xmm1, %xmm01462; SSE3-NEXT:    retq1463;1464; AVX-LABEL: extract_extract01_v16f32_fsub_f32_commute:1465; AVX:       # %bb.0:1466; AVX-NEXT:    vmovshdup {{.*#+}} xmm1 = xmm0[1,1,3,3]1467; AVX-NEXT:    vsubss %xmm0, %xmm1, %xmm01468; AVX-NEXT:    vzeroupper1469; AVX-NEXT:    retq1470  %x0 = extractelement <16 x float> %x, i32 01471  %x1 = extractelement <16 x float> %x, i32 11472  %x01 = fsub float %x1, %x01473  ret float %x011474}1475 1476define double @extract_extract01_v8f64_fsub_f64(<8 x double> %x) {1477; SSE3-SLOW-LABEL: extract_extract01_v8f64_fsub_f64:1478; SSE3-SLOW:       # %bb.0:1479; SSE3-SLOW-NEXT:    movapd %xmm0, %xmm11480; SSE3-SLOW-NEXT:    unpckhpd {{.*#+}} xmm1 = xmm1[1],xmm0[1]1481; SSE3-SLOW-NEXT:    subsd %xmm1, %xmm01482; SSE3-SLOW-NEXT:    retq1483;1484; SSE3-FAST-LABEL: extract_extract01_v8f64_fsub_f64:1485; SSE3-FAST:       # %bb.0:1486; SSE3-FAST-NEXT:    hsubpd %xmm0, %xmm01487; SSE3-FAST-NEXT:    retq1488;1489; AVX-SLOW-LABEL: extract_extract01_v8f64_fsub_f64:1490; AVX-SLOW:       # %bb.0:1491; AVX-SLOW-NEXT:    vshufpd {{.*#+}} xmm1 = xmm0[1,0]1492; AVX-SLOW-NEXT:    vsubsd %xmm1, %xmm0, %xmm01493; AVX-SLOW-NEXT:    vzeroupper1494; AVX-SLOW-NEXT:    retq1495;1496; AVX-FAST-LABEL: extract_extract01_v8f64_fsub_f64:1497; AVX-FAST:       # %bb.0:1498; AVX-FAST-NEXT:    vhsubpd %xmm0, %xmm0, %xmm01499; AVX-FAST-NEXT:    vzeroupper1500; AVX-FAST-NEXT:    retq1501  %x0 = extractelement <8 x double> %x, i32 01502  %x1 = extractelement <8 x double> %x, i32 11503  %x01 = fsub double %x0, %x11504  ret double %x011505}1506 1507define double @extract_extract01_v8f64_fsub_f64_commute(<8 x double> %x) {1508; SSE3-LABEL: extract_extract01_v8f64_fsub_f64_commute:1509; SSE3:       # %bb.0:1510; SSE3-NEXT:    movapd %xmm0, %xmm11511; SSE3-NEXT:    unpckhpd {{.*#+}} xmm1 = xmm1[1],xmm0[1]1512; SSE3-NEXT:    subsd %xmm0, %xmm11513; SSE3-NEXT:    movapd %xmm1, %xmm01514; SSE3-NEXT:    retq1515;1516; AVX-LABEL: extract_extract01_v8f64_fsub_f64_commute:1517; AVX:       # %bb.0:1518; AVX-NEXT:    vshufpd {{.*#+}} xmm1 = xmm0[1,0]1519; AVX-NEXT:    vsubsd %xmm0, %xmm1, %xmm01520; AVX-NEXT:    vzeroupper1521; AVX-NEXT:    retq1522  %x0 = extractelement <8 x double> %x, i32 01523  %x1 = extractelement <8 x double> %x, i32 11524  %x01 = fsub double %x1, %x01525  ret double %x011526}1527 1528; Check output when 1 or both extracts have extra uses.1529 1530define float @extract_extract01_v4f32_fadd_f32_uses1(<4 x float> %x, ptr %p) {1531; SSE3-SLOW-LABEL: extract_extract01_v4f32_fadd_f32_uses1:1532; SSE3-SLOW:       # %bb.0:1533; SSE3-SLOW-NEXT:    movss %xmm0, (%rdi)1534; SSE3-SLOW-NEXT:    movshdup {{.*#+}} xmm1 = xmm0[1,1,3,3]1535; SSE3-SLOW-NEXT:    addss %xmm1, %xmm01536; SSE3-SLOW-NEXT:    retq1537;1538; SSE3-FAST-LABEL: extract_extract01_v4f32_fadd_f32_uses1:1539; SSE3-FAST:       # %bb.0:1540; SSE3-FAST-NEXT:    movss %xmm0, (%rdi)1541; SSE3-FAST-NEXT:    haddps %xmm0, %xmm01542; SSE3-FAST-NEXT:    retq1543;1544; AVX-SLOW-LABEL: extract_extract01_v4f32_fadd_f32_uses1:1545; AVX-SLOW:       # %bb.0:1546; AVX-SLOW-NEXT:    vmovss %xmm0, (%rdi)1547; AVX-SLOW-NEXT:    vmovshdup {{.*#+}} xmm1 = xmm0[1,1,3,3]1548; AVX-SLOW-NEXT:    vaddss %xmm1, %xmm0, %xmm01549; AVX-SLOW-NEXT:    retq1550;1551; AVX-FAST-LABEL: extract_extract01_v4f32_fadd_f32_uses1:1552; AVX-FAST:       # %bb.0:1553; AVX-FAST-NEXT:    vmovss %xmm0, (%rdi)1554; AVX-FAST-NEXT:    vhaddps %xmm0, %xmm0, %xmm01555; AVX-FAST-NEXT:    retq1556  %x0 = extractelement <4 x float> %x, i32 01557  store float %x0, ptr %p1558  %x1 = extractelement <4 x float> %x, i32 11559  %x01 = fadd float %x0, %x11560  ret float %x011561}1562 1563define float @extract_extract01_v4f32_fadd_f32_uses2(<4 x float> %x, ptr %p) {1564; SSE3-SLOW-LABEL: extract_extract01_v4f32_fadd_f32_uses2:1565; SSE3-SLOW:       # %bb.0:1566; SSE3-SLOW-NEXT:    movshdup {{.*#+}} xmm1 = xmm0[1,1,3,3]1567; SSE3-SLOW-NEXT:    movss %xmm1, (%rdi)1568; SSE3-SLOW-NEXT:    addss %xmm1, %xmm01569; SSE3-SLOW-NEXT:    retq1570;1571; SSE3-FAST-LABEL: extract_extract01_v4f32_fadd_f32_uses2:1572; SSE3-FAST:       # %bb.0:1573; SSE3-FAST-NEXT:    movshdup {{.*#+}} xmm1 = xmm0[1,1,3,3]1574; SSE3-FAST-NEXT:    movss %xmm1, (%rdi)1575; SSE3-FAST-NEXT:    haddps %xmm0, %xmm01576; SSE3-FAST-NEXT:    retq1577;1578; AVX-SLOW-LABEL: extract_extract01_v4f32_fadd_f32_uses2:1579; AVX-SLOW:       # %bb.0:1580; AVX-SLOW-NEXT:    vmovshdup {{.*#+}} xmm1 = xmm0[1,1,3,3]1581; AVX-SLOW-NEXT:    vmovss %xmm1, (%rdi)1582; AVX-SLOW-NEXT:    vaddss %xmm1, %xmm0, %xmm01583; AVX-SLOW-NEXT:    retq1584;1585; AVX-FAST-LABEL: extract_extract01_v4f32_fadd_f32_uses2:1586; AVX-FAST:       # %bb.0:1587; AVX-FAST-NEXT:    vextractps $1, %xmm0, (%rdi)1588; AVX-FAST-NEXT:    vhaddps %xmm0, %xmm0, %xmm01589; AVX-FAST-NEXT:    retq1590  %x0 = extractelement <4 x float> %x, i32 01591  %x1 = extractelement <4 x float> %x, i32 11592  store float %x1, ptr %p1593  %x01 = fadd float %x0, %x11594  ret float %x011595}1596 1597define float @extract_extract01_v4f32_fadd_f32_uses3(<4 x float> %x, ptr %p1, ptr %p2) {1598; SSE3-LABEL: extract_extract01_v4f32_fadd_f32_uses3:1599; SSE3:       # %bb.0:1600; SSE3-NEXT:    movss %xmm0, (%rdi)1601; SSE3-NEXT:    movshdup {{.*#+}} xmm1 = xmm0[1,1,3,3]1602; SSE3-NEXT:    movss %xmm1, (%rsi)1603; SSE3-NEXT:    addss %xmm1, %xmm01604; SSE3-NEXT:    retq1605;1606; AVX-LABEL: extract_extract01_v4f32_fadd_f32_uses3:1607; AVX:       # %bb.0:1608; AVX-NEXT:    vmovss %xmm0, (%rdi)1609; AVX-NEXT:    vmovshdup {{.*#+}} xmm1 = xmm0[1,1,3,3]1610; AVX-NEXT:    vmovss %xmm1, (%rsi)1611; AVX-NEXT:    vaddss %xmm1, %xmm0, %xmm01612; AVX-NEXT:    retq1613  %x0 = extractelement <4 x float> %x, i32 01614  store float %x0, ptr %p11615  %x1 = extractelement <4 x float> %x, i32 11616  store float %x1, ptr %p21617  %x01 = fadd float %x0, %x11618  ret float %x011619}1620 1621; Repeat tests from general reductions to verify output for hoppy targets:1622; PR38971: https://bugs.llvm.org/show_bug.cgi?id=389711623 1624declare float @llvm.vector.reduce.fadd.f32.v8f32(float, <8 x float>)1625declare double @llvm.vector.reduce.fadd.f64.v4f64(double, <4 x double>)1626 1627define float @fadd_reduce_v8f32(float %a0, <8 x float> %a1) {1628; SSE3-SLOW-LABEL: fadd_reduce_v8f32:1629; SSE3-SLOW:       # %bb.0:1630; SSE3-SLOW-NEXT:    addps %xmm2, %xmm11631; SSE3-SLOW-NEXT:    movaps %xmm1, %xmm21632; SSE3-SLOW-NEXT:    unpckhpd {{.*#+}} xmm2 = xmm2[1],xmm1[1]1633; SSE3-SLOW-NEXT:    addps %xmm1, %xmm21634; SSE3-SLOW-NEXT:    movshdup {{.*#+}} xmm1 = xmm2[1,1,3,3]1635; SSE3-SLOW-NEXT:    addss %xmm2, %xmm11636; SSE3-SLOW-NEXT:    addss %xmm1, %xmm01637; SSE3-SLOW-NEXT:    retq1638;1639; SSE3-FAST-LABEL: fadd_reduce_v8f32:1640; SSE3-FAST:       # %bb.0:1641; SSE3-FAST-NEXT:    haddps %xmm1, %xmm21642; SSE3-FAST-NEXT:    haddps %xmm2, %xmm21643; SSE3-FAST-NEXT:    haddps %xmm2, %xmm21644; SSE3-FAST-NEXT:    addss %xmm2, %xmm01645; SSE3-FAST-NEXT:    retq1646;1647; AVX-SLOW-LABEL: fadd_reduce_v8f32:1648; AVX-SLOW:       # %bb.0:1649; AVX-SLOW-NEXT:    vextractf128 $1, %ymm1, %xmm21650; AVX-SLOW-NEXT:    vaddps %xmm2, %xmm1, %xmm11651; AVX-SLOW-NEXT:    vshufpd {{.*#+}} xmm2 = xmm1[1,0]1652; AVX-SLOW-NEXT:    vaddps %xmm2, %xmm1, %xmm11653; AVX-SLOW-NEXT:    vmovshdup {{.*#+}} xmm2 = xmm1[1,1,3,3]1654; AVX-SLOW-NEXT:    vaddss %xmm2, %xmm1, %xmm11655; AVX-SLOW-NEXT:    vaddss %xmm1, %xmm0, %xmm01656; AVX-SLOW-NEXT:    vzeroupper1657; AVX-SLOW-NEXT:    retq1658;1659; AVX-FAST-LABEL: fadd_reduce_v8f32:1660; AVX-FAST:       # %bb.0:1661; AVX-FAST-NEXT:    vextractf128 $1, %ymm1, %xmm21662; AVX-FAST-NEXT:    vhaddps %xmm1, %xmm2, %xmm11663; AVX-FAST-NEXT:    vhaddps %xmm1, %xmm1, %xmm11664; AVX-FAST-NEXT:    vhaddps %xmm1, %xmm1, %xmm11665; AVX-FAST-NEXT:    vaddss %xmm1, %xmm0, %xmm01666; AVX-FAST-NEXT:    vzeroupper1667; AVX-FAST-NEXT:    retq1668  %r = call fast float @llvm.vector.reduce.fadd.f32.v8f32(float %a0, <8 x float> %a1)1669  ret float %r1670}1671 1672define double @fadd_reduce_v4f64(double %a0, <4 x double> %a1) {1673; SSE3-SLOW-LABEL: fadd_reduce_v4f64:1674; SSE3-SLOW:       # %bb.0:1675; SSE3-SLOW-NEXT:    addpd %xmm2, %xmm11676; SSE3-SLOW-NEXT:    movapd %xmm1, %xmm21677; SSE3-SLOW-NEXT:    unpckhpd {{.*#+}} xmm2 = xmm2[1],xmm1[1]1678; SSE3-SLOW-NEXT:    addsd %xmm1, %xmm21679; SSE3-SLOW-NEXT:    addsd %xmm2, %xmm01680; SSE3-SLOW-NEXT:    retq1681;1682; SSE3-FAST-LABEL: fadd_reduce_v4f64:1683; SSE3-FAST:       # %bb.0:1684; SSE3-FAST-NEXT:    haddpd %xmm1, %xmm21685; SSE3-FAST-NEXT:    haddpd %xmm2, %xmm21686; SSE3-FAST-NEXT:    addsd %xmm2, %xmm01687; SSE3-FAST-NEXT:    retq1688;1689; AVX-SLOW-LABEL: fadd_reduce_v4f64:1690; AVX-SLOW:       # %bb.0:1691; AVX-SLOW-NEXT:    vextractf128 $1, %ymm1, %xmm21692; AVX-SLOW-NEXT:    vaddpd %xmm2, %xmm1, %xmm11693; AVX-SLOW-NEXT:    vshufpd {{.*#+}} xmm2 = xmm1[1,0]1694; AVX-SLOW-NEXT:    vaddsd %xmm2, %xmm1, %xmm11695; AVX-SLOW-NEXT:    vaddsd %xmm1, %xmm0, %xmm01696; AVX-SLOW-NEXT:    vzeroupper1697; AVX-SLOW-NEXT:    retq1698;1699; AVX-FAST-LABEL: fadd_reduce_v4f64:1700; AVX-FAST:       # %bb.0:1701; AVX-FAST-NEXT:    vextractf128 $1, %ymm1, %xmm21702; AVX-FAST-NEXT:    vhaddpd %xmm1, %xmm2, %xmm11703; AVX-FAST-NEXT:    vhaddpd %xmm1, %xmm1, %xmm11704; AVX-FAST-NEXT:    vaddsd %xmm1, %xmm0, %xmm01705; AVX-FAST-NEXT:    vzeroupper1706; AVX-FAST-NEXT:    retq1707  %r = call fast double @llvm.vector.reduce.fadd.f64.v4f64(double %a0, <4 x double> %a1)1708  ret double %r1709}1710 1711define float @PR39936_v8f32(<8 x float>) {1712; SSSE3-SLOW-LABEL: PR39936_v8f32:1713; SSSE3-SLOW:       # %bb.0:1714; SSSE3-SLOW-NEXT:    haddps %xmm1, %xmm01715; SSSE3-SLOW-NEXT:    movaps %xmm0, %xmm11716; SSSE3-SLOW-NEXT:    shufps {{.*#+}} xmm1 = xmm1[0,2],xmm0[2,3]1717; SSSE3-SLOW-NEXT:    shufps {{.*#+}} xmm0 = xmm0[1,3,2,3]1718; SSSE3-SLOW-NEXT:    addps %xmm1, %xmm01719; SSSE3-SLOW-NEXT:    movshdup {{.*#+}} xmm1 = xmm0[1,1,3,3]1720; SSSE3-SLOW-NEXT:    addss %xmm1, %xmm01721; SSSE3-SLOW-NEXT:    retq1722;1723; SSSE3-FAST-LABEL: PR39936_v8f32:1724; SSSE3-FAST:       # %bb.0:1725; SSSE3-FAST-NEXT:    haddps %xmm1, %xmm01726; SSSE3-FAST-NEXT:    haddps %xmm0, %xmm01727; SSSE3-FAST-NEXT:    haddps %xmm0, %xmm01728; SSSE3-FAST-NEXT:    retq1729;1730; SSE3-SLOW-LABEL: PR39936_v8f32:1731; SSE3-SLOW:       # %bb.0:1732; SSE3-SLOW-NEXT:    haddps %xmm1, %xmm01733; SSE3-SLOW-NEXT:    haddps %xmm0, %xmm01734; SSE3-SLOW-NEXT:    movshdup {{.*#+}} xmm1 = xmm0[1,1,3,3]1735; SSE3-SLOW-NEXT:    addss %xmm1, %xmm01736; SSE3-SLOW-NEXT:    retq1737;1738; SSE3-FAST-LABEL: PR39936_v8f32:1739; SSE3-FAST:       # %bb.0:1740; SSE3-FAST-NEXT:    haddps %xmm1, %xmm01741; SSE3-FAST-NEXT:    haddps %xmm0, %xmm01742; SSE3-FAST-NEXT:    haddps %xmm0, %xmm01743; SSE3-FAST-NEXT:    retq1744;1745; AVX-SLOW-LABEL: PR39936_v8f32:1746; AVX-SLOW:       # %bb.0:1747; AVX-SLOW-NEXT:    vextractf128 $1, %ymm0, %xmm11748; AVX-SLOW-NEXT:    vhaddps %xmm1, %xmm0, %xmm01749; AVX-SLOW-NEXT:    vhaddps %xmm0, %xmm0, %xmm01750; AVX-SLOW-NEXT:    vmovshdup {{.*#+}} xmm1 = xmm0[1,1,3,3]1751; AVX-SLOW-NEXT:    vaddss %xmm1, %xmm0, %xmm01752; AVX-SLOW-NEXT:    vzeroupper1753; AVX-SLOW-NEXT:    retq1754;1755; AVX-FAST-LABEL: PR39936_v8f32:1756; AVX-FAST:       # %bb.0:1757; AVX-FAST-NEXT:    vextractf128 $1, %ymm0, %xmm11758; AVX-FAST-NEXT:    vhaddps %xmm1, %xmm0, %xmm01759; AVX-FAST-NEXT:    vhaddps %xmm0, %xmm0, %xmm01760; AVX-FAST-NEXT:    vhaddps %xmm0, %xmm0, %xmm01761; AVX-FAST-NEXT:    vzeroupper1762; AVX-FAST-NEXT:    retq1763  %2 = shufflevector <8 x float> %0, <8 x float> undef, <8 x i32> <i32 0, i32 2, i32 4, i32 6, i32 undef, i32 undef, i32 undef, i32 undef>1764  %3 = shufflevector <8 x float> %0, <8 x float> undef, <8 x i32> <i32 1, i32 3, i32 5, i32 7, i32 undef, i32 undef, i32 undef, i32 undef>1765  %4 = fadd <8 x float> %2, %31766  %5 = shufflevector <8 x float> %4, <8 x float> undef, <8 x i32> <i32 0, i32 2, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>1767  %6 = shufflevector <8 x float> %4, <8 x float> undef, <8 x i32> <i32 1, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>1768  %7 = fadd <8 x float> %5, %61769  %8 = shufflevector <8 x float> %7, <8 x float> undef, <8 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>1770  %9 = fadd <8 x float> %7, %81771  %10 = extractelement <8 x float> %9, i32 01772  ret float %101773}1774 1775define float @hadd32_4(<4 x float> %x225) {1776; SSE3-SLOW-LABEL: hadd32_4:1777; SSE3-SLOW:       # %bb.0:1778; SSE3-SLOW-NEXT:    movaps %xmm0, %xmm11779; SSE3-SLOW-NEXT:    unpckhpd {{.*#+}} xmm1 = xmm1[1],xmm0[1]1780; SSE3-SLOW-NEXT:    addps %xmm1, %xmm01781; SSE3-SLOW-NEXT:    movshdup {{.*#+}} xmm1 = xmm0[1,1,3,3]1782; SSE3-SLOW-NEXT:    addss %xmm1, %xmm01783; SSE3-SLOW-NEXT:    retq1784;1785; SSE3-FAST-LABEL: hadd32_4:1786; SSE3-FAST:       # %bb.0:1787; SSE3-FAST-NEXT:    movaps %xmm0, %xmm11788; SSE3-FAST-NEXT:    unpckhpd {{.*#+}} xmm1 = xmm1[1],xmm0[1]1789; SSE3-FAST-NEXT:    addps %xmm1, %xmm01790; SSE3-FAST-NEXT:    haddps %xmm0, %xmm01791; SSE3-FAST-NEXT:    retq1792;1793; AVX-SLOW-LABEL: hadd32_4:1794; AVX-SLOW:       # %bb.0:1795; AVX-SLOW-NEXT:    vshufpd {{.*#+}} xmm1 = xmm0[1,0]1796; AVX-SLOW-NEXT:    vaddps %xmm1, %xmm0, %xmm01797; AVX-SLOW-NEXT:    vmovshdup {{.*#+}} xmm1 = xmm0[1,1,3,3]1798; AVX-SLOW-NEXT:    vaddss %xmm1, %xmm0, %xmm01799; AVX-SLOW-NEXT:    retq1800;1801; AVX-FAST-LABEL: hadd32_4:1802; AVX-FAST:       # %bb.0:1803; AVX-FAST-NEXT:    vshufpd {{.*#+}} xmm1 = xmm0[1,0]1804; AVX-FAST-NEXT:    vaddps %xmm1, %xmm0, %xmm01805; AVX-FAST-NEXT:    vhaddps %xmm0, %xmm0, %xmm01806; AVX-FAST-NEXT:    retq1807  %x226 = shufflevector <4 x float> %x225, <4 x float> undef, <4 x i32> <i32 2, i32 3, i32 undef, i32 undef>1808  %x227 = fadd <4 x float> %x225, %x2261809  %x228 = shufflevector <4 x float> %x227, <4 x float> undef, <4 x i32> <i32 1, i32 undef, i32 undef, i32 undef>1810  %x229 = fadd <4 x float> %x227, %x2281811  %x230 = extractelement <4 x float> %x229, i32 01812  ret float %x2301813}1814 1815define float @hadd32_8(<8 x float> %x225) {1816; SSE3-SLOW-LABEL: hadd32_8:1817; SSE3-SLOW:       # %bb.0:1818; SSE3-SLOW-NEXT:    movaps %xmm0, %xmm11819; SSE3-SLOW-NEXT:    unpckhpd {{.*#+}} xmm1 = xmm1[1],xmm0[1]1820; SSE3-SLOW-NEXT:    addps %xmm1, %xmm01821; SSE3-SLOW-NEXT:    movshdup {{.*#+}} xmm1 = xmm0[1,1,3,3]1822; SSE3-SLOW-NEXT:    addss %xmm1, %xmm01823; SSE3-SLOW-NEXT:    retq1824;1825; SSE3-FAST-LABEL: hadd32_8:1826; SSE3-FAST:       # %bb.0:1827; SSE3-FAST-NEXT:    movaps %xmm0, %xmm11828; SSE3-FAST-NEXT:    unpckhpd {{.*#+}} xmm1 = xmm1[1],xmm0[1]1829; SSE3-FAST-NEXT:    addps %xmm1, %xmm01830; SSE3-FAST-NEXT:    haddps %xmm0, %xmm01831; SSE3-FAST-NEXT:    retq1832;1833; AVX-SLOW-LABEL: hadd32_8:1834; AVX-SLOW:       # %bb.0:1835; AVX-SLOW-NEXT:    vshufpd {{.*#+}} xmm1 = xmm0[1,0]1836; AVX-SLOW-NEXT:    vaddps %xmm1, %xmm0, %xmm01837; AVX-SLOW-NEXT:    vmovshdup {{.*#+}} xmm1 = xmm0[1,1,3,3]1838; AVX-SLOW-NEXT:    vaddss %xmm1, %xmm0, %xmm01839; AVX-SLOW-NEXT:    vzeroupper1840; AVX-SLOW-NEXT:    retq1841;1842; AVX-FAST-LABEL: hadd32_8:1843; AVX-FAST:       # %bb.0:1844; AVX-FAST-NEXT:    vshufpd {{.*#+}} xmm1 = xmm0[1,0]1845; AVX-FAST-NEXT:    vaddps %xmm1, %xmm0, %xmm01846; AVX-FAST-NEXT:    vhaddps %xmm0, %xmm0, %xmm01847; AVX-FAST-NEXT:    vzeroupper1848; AVX-FAST-NEXT:    retq1849  %x226 = shufflevector <8 x float> %x225, <8 x float> undef, <8 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>1850  %x227 = fadd <8 x float> %x225, %x2261851  %x228 = shufflevector <8 x float> %x227, <8 x float> undef, <8 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>1852  %x229 = fadd <8 x float> %x227, %x2281853  %x230 = extractelement <8 x float> %x229, i32 01854  ret float %x2301855}1856 1857define float @hadd32_16(<16 x float> %x225) {1858; SSE3-SLOW-LABEL: hadd32_16:1859; SSE3-SLOW:       # %bb.0:1860; SSE3-SLOW-NEXT:    movaps %xmm0, %xmm11861; SSE3-SLOW-NEXT:    unpckhpd {{.*#+}} xmm1 = xmm1[1],xmm0[1]1862; SSE3-SLOW-NEXT:    addps %xmm1, %xmm01863; SSE3-SLOW-NEXT:    movshdup {{.*#+}} xmm1 = xmm0[1,1,3,3]1864; SSE3-SLOW-NEXT:    addss %xmm1, %xmm01865; SSE3-SLOW-NEXT:    retq1866;1867; SSE3-FAST-LABEL: hadd32_16:1868; SSE3-FAST:       # %bb.0:1869; SSE3-FAST-NEXT:    movaps %xmm0, %xmm11870; SSE3-FAST-NEXT:    unpckhpd {{.*#+}} xmm1 = xmm1[1],xmm0[1]1871; SSE3-FAST-NEXT:    addps %xmm1, %xmm01872; SSE3-FAST-NEXT:    haddps %xmm0, %xmm01873; SSE3-FAST-NEXT:    retq1874;1875; AVX-SLOW-LABEL: hadd32_16:1876; AVX-SLOW:       # %bb.0:1877; AVX-SLOW-NEXT:    vshufpd {{.*#+}} xmm1 = xmm0[1,0]1878; AVX-SLOW-NEXT:    vaddps %xmm1, %xmm0, %xmm01879; AVX-SLOW-NEXT:    vmovshdup {{.*#+}} xmm1 = xmm0[1,1,3,3]1880; AVX-SLOW-NEXT:    vaddss %xmm1, %xmm0, %xmm01881; AVX-SLOW-NEXT:    vzeroupper1882; AVX-SLOW-NEXT:    retq1883;1884; AVX-FAST-LABEL: hadd32_16:1885; AVX-FAST:       # %bb.0:1886; AVX-FAST-NEXT:    vshufpd {{.*#+}} xmm1 = xmm0[1,0]1887; AVX-FAST-NEXT:    vaddps %xmm1, %xmm0, %xmm01888; AVX-FAST-NEXT:    vhaddps %xmm0, %xmm0, %xmm01889; AVX-FAST-NEXT:    vzeroupper1890; AVX-FAST-NEXT:    retq1891  %x226 = shufflevector <16 x float> %x225, <16 x float> undef, <16 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>1892  %x227 = fadd <16 x float> %x225, %x2261893  %x228 = shufflevector <16 x float> %x227, <16 x float> undef, <16 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>1894  %x229 = fadd <16 x float> %x227, %x2281895  %x230 = extractelement <16 x float> %x229, i32 01896  ret float %x2301897}1898 1899define float @hadd32_4_optsize(<4 x float> %x225) optsize {1900; SSE3-LABEL: hadd32_4_optsize:1901; SSE3:       # %bb.0:1902; SSE3-NEXT:    movaps %xmm0, %xmm11903; SSE3-NEXT:    unpckhpd {{.*#+}} xmm1 = xmm1[1],xmm0[1]1904; SSE3-NEXT:    addps %xmm1, %xmm01905; SSE3-NEXT:    haddps %xmm0, %xmm01906; SSE3-NEXT:    retq1907;1908; AVX-LABEL: hadd32_4_optsize:1909; AVX:       # %bb.0:1910; AVX-NEXT:    vshufpd {{.*#+}} xmm1 = xmm0[1,0]1911; AVX-NEXT:    vaddps %xmm1, %xmm0, %xmm01912; AVX-NEXT:    vhaddps %xmm0, %xmm0, %xmm01913; AVX-NEXT:    retq1914  %x226 = shufflevector <4 x float> %x225, <4 x float> undef, <4 x i32> <i32 2, i32 3, i32 undef, i32 undef>1915  %x227 = fadd <4 x float> %x225, %x2261916  %x228 = shufflevector <4 x float> %x227, <4 x float> undef, <4 x i32> <i32 1, i32 undef, i32 undef, i32 undef>1917  %x229 = fadd <4 x float> %x227, %x2281918  %x230 = extractelement <4 x float> %x229, i32 01919  ret float %x2301920}1921 1922define float @hadd32_8_optsize(<8 x float> %x225) optsize {1923; SSE3-LABEL: hadd32_8_optsize:1924; SSE3:       # %bb.0:1925; SSE3-NEXT:    movaps %xmm0, %xmm11926; SSE3-NEXT:    unpckhpd {{.*#+}} xmm1 = xmm1[1],xmm0[1]1927; SSE3-NEXT:    addps %xmm1, %xmm01928; SSE3-NEXT:    haddps %xmm0, %xmm01929; SSE3-NEXT:    retq1930;1931; AVX-LABEL: hadd32_8_optsize:1932; AVX:       # %bb.0:1933; AVX-NEXT:    vshufpd {{.*#+}} xmm1 = xmm0[1,0]1934; AVX-NEXT:    vaddps %xmm1, %xmm0, %xmm01935; AVX-NEXT:    vhaddps %xmm0, %xmm0, %xmm01936; AVX-NEXT:    vzeroupper1937; AVX-NEXT:    retq1938  %x226 = shufflevector <8 x float> %x225, <8 x float> undef, <8 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>1939  %x227 = fadd <8 x float> %x225, %x2261940  %x228 = shufflevector <8 x float> %x227, <8 x float> undef, <8 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>1941  %x229 = fadd <8 x float> %x227, %x2281942  %x230 = extractelement <8 x float> %x229, i32 01943  ret float %x2301944}1945 1946define float @hadd32_16_optsize(<16 x float> %x225) optsize {1947; SSE3-LABEL: hadd32_16_optsize:1948; SSE3:       # %bb.0:1949; SSE3-NEXT:    movaps %xmm0, %xmm11950; SSE3-NEXT:    unpckhpd {{.*#+}} xmm1 = xmm1[1],xmm0[1]1951; SSE3-NEXT:    addps %xmm1, %xmm01952; SSE3-NEXT:    haddps %xmm0, %xmm01953; SSE3-NEXT:    retq1954;1955; AVX-LABEL: hadd32_16_optsize:1956; AVX:       # %bb.0:1957; AVX-NEXT:    vshufpd {{.*#+}} xmm1 = xmm0[1,0]1958; AVX-NEXT:    vaddps %xmm1, %xmm0, %xmm01959; AVX-NEXT:    vhaddps %xmm0, %xmm0, %xmm01960; AVX-NEXT:    vzeroupper1961; AVX-NEXT:    retq1962  %x226 = shufflevector <16 x float> %x225, <16 x float> undef, <16 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>1963  %x227 = fadd <16 x float> %x225, %x2261964  %x228 = shufflevector <16 x float> %x227, <16 x float> undef, <16 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>1965  %x229 = fadd <16 x float> %x227, %x2281966  %x230 = extractelement <16 x float> %x229, i32 01967  ret float %x2301968}1969 1970define float @hadd32_4_pgso(<4 x float> %x225) !prof !14 {1971; SSE3-LABEL: hadd32_4_pgso:1972; SSE3:       # %bb.0:1973; SSE3-NEXT:    movaps %xmm0, %xmm11974; SSE3-NEXT:    unpckhpd {{.*#+}} xmm1 = xmm1[1],xmm0[1]1975; SSE3-NEXT:    addps %xmm1, %xmm01976; SSE3-NEXT:    haddps %xmm0, %xmm01977; SSE3-NEXT:    retq1978;1979; AVX-LABEL: hadd32_4_pgso:1980; AVX:       # %bb.0:1981; AVX-NEXT:    vshufpd {{.*#+}} xmm1 = xmm0[1,0]1982; AVX-NEXT:    vaddps %xmm1, %xmm0, %xmm01983; AVX-NEXT:    vhaddps %xmm0, %xmm0, %xmm01984; AVX-NEXT:    retq1985  %x226 = shufflevector <4 x float> %x225, <4 x float> undef, <4 x i32> <i32 2, i32 3, i32 undef, i32 undef>1986  %x227 = fadd <4 x float> %x225, %x2261987  %x228 = shufflevector <4 x float> %x227, <4 x float> undef, <4 x i32> <i32 1, i32 undef, i32 undef, i32 undef>1988  %x229 = fadd <4 x float> %x227, %x2281989  %x230 = extractelement <4 x float> %x229, i32 01990  ret float %x2301991}1992 1993define float @hadd32_8_pgso(<8 x float> %x225) !prof !14 {1994; SSE3-LABEL: hadd32_8_pgso:1995; SSE3:       # %bb.0:1996; SSE3-NEXT:    movaps %xmm0, %xmm11997; SSE3-NEXT:    unpckhpd {{.*#+}} xmm1 = xmm1[1],xmm0[1]1998; SSE3-NEXT:    addps %xmm1, %xmm01999; SSE3-NEXT:    haddps %xmm0, %xmm02000; SSE3-NEXT:    retq2001;2002; AVX-LABEL: hadd32_8_pgso:2003; AVX:       # %bb.0:2004; AVX-NEXT:    vshufpd {{.*#+}} xmm1 = xmm0[1,0]2005; AVX-NEXT:    vaddps %xmm1, %xmm0, %xmm02006; AVX-NEXT:    vhaddps %xmm0, %xmm0, %xmm02007; AVX-NEXT:    vzeroupper2008; AVX-NEXT:    retq2009  %x226 = shufflevector <8 x float> %x225, <8 x float> undef, <8 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>2010  %x227 = fadd <8 x float> %x225, %x2262011  %x228 = shufflevector <8 x float> %x227, <8 x float> undef, <8 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>2012  %x229 = fadd <8 x float> %x227, %x2282013  %x230 = extractelement <8 x float> %x229, i32 02014  ret float %x2302015}2016 2017define float @hadd32_16_pgso(<16 x float> %x225) !prof !14 {2018; SSE3-LABEL: hadd32_16_pgso:2019; SSE3:       # %bb.0:2020; SSE3-NEXT:    movaps %xmm0, %xmm12021; SSE3-NEXT:    unpckhpd {{.*#+}} xmm1 = xmm1[1],xmm0[1]2022; SSE3-NEXT:    addps %xmm1, %xmm02023; SSE3-NEXT:    haddps %xmm0, %xmm02024; SSE3-NEXT:    retq2025;2026; AVX-LABEL: hadd32_16_pgso:2027; AVX:       # %bb.0:2028; AVX-NEXT:    vshufpd {{.*#+}} xmm1 = xmm0[1,0]2029; AVX-NEXT:    vaddps %xmm1, %xmm0, %xmm02030; AVX-NEXT:    vhaddps %xmm0, %xmm0, %xmm02031; AVX-NEXT:    vzeroupper2032; AVX-NEXT:    retq2033  %x226 = shufflevector <16 x float> %x225, <16 x float> undef, <16 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>2034  %x227 = fadd <16 x float> %x225, %x2262035  %x228 = shufflevector <16 x float> %x227, <16 x float> undef, <16 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>2036  %x229 = fadd <16 x float> %x227, %x2282037  %x230 = extractelement <16 x float> %x229, i32 02038  ret float %x2302039}2040 2041define float @partial_reduction_fadd_v8f32(<8 x float> %x) {2042; SSE3-SLOW-LABEL: partial_reduction_fadd_v8f32:2043; SSE3-SLOW:       # %bb.0:2044; SSE3-SLOW-NEXT:    movaps %xmm0, %xmm12045; SSE3-SLOW-NEXT:    unpckhpd {{.*#+}} xmm1 = xmm1[1],xmm0[1]2046; SSE3-SLOW-NEXT:    addps %xmm1, %xmm02047; SSE3-SLOW-NEXT:    movshdup {{.*#+}} xmm1 = xmm0[1,1,3,3]2048; SSE3-SLOW-NEXT:    addss %xmm1, %xmm02049; SSE3-SLOW-NEXT:    retq2050;2051; SSE3-FAST-LABEL: partial_reduction_fadd_v8f32:2052; SSE3-FAST:       # %bb.0:2053; SSE3-FAST-NEXT:    movaps %xmm0, %xmm12054; SSE3-FAST-NEXT:    unpckhpd {{.*#+}} xmm1 = xmm1[1],xmm0[1]2055; SSE3-FAST-NEXT:    addps %xmm1, %xmm02056; SSE3-FAST-NEXT:    haddps %xmm0, %xmm02057; SSE3-FAST-NEXT:    retq2058;2059; AVX-SLOW-LABEL: partial_reduction_fadd_v8f32:2060; AVX-SLOW:       # %bb.0:2061; AVX-SLOW-NEXT:    vshufpd {{.*#+}} xmm1 = xmm0[1,0]2062; AVX-SLOW-NEXT:    vaddps %xmm1, %xmm0, %xmm02063; AVX-SLOW-NEXT:    vmovshdup {{.*#+}} xmm1 = xmm0[1,1,3,3]2064; AVX-SLOW-NEXT:    vaddss %xmm1, %xmm0, %xmm02065; AVX-SLOW-NEXT:    vzeroupper2066; AVX-SLOW-NEXT:    retq2067;2068; AVX-FAST-LABEL: partial_reduction_fadd_v8f32:2069; AVX-FAST:       # %bb.0:2070; AVX-FAST-NEXT:    vhaddps %xmm0, %xmm0, %xmm02071; AVX-FAST-NEXT:    vhaddps %xmm0, %xmm0, %xmm02072; AVX-FAST-NEXT:    vzeroupper2073; AVX-FAST-NEXT:    retq2074  %x23 = shufflevector <8 x float> %x, <8 x float> undef, <8 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>2075  %x0213 = fadd <8 x float> %x, %x232076  %x13 = shufflevector <8 x float> %x0213, <8 x float> undef, <8 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>2077  %x0123 = fadd nsz reassoc <8 x float> %x0213, %x132078  %r = extractelement <8 x float> %x0123, i32 02079  ret float %r2080}2081 2082; Negative test - only the flags on the final math op in the2083; sequence determine whether we can transform to horizontal ops.2084 2085define float @partial_reduction_fadd_v8f32_wrong_flags(<8 x float> %x) {2086; SSE3-SLOW-LABEL: partial_reduction_fadd_v8f32_wrong_flags:2087; SSE3-SLOW:       # %bb.0:2088; SSE3-SLOW-NEXT:    movaps %xmm0, %xmm12089; SSE3-SLOW-NEXT:    unpckhpd {{.*#+}} xmm1 = xmm1[1],xmm0[1]2090; SSE3-SLOW-NEXT:    addps %xmm1, %xmm02091; SSE3-SLOW-NEXT:    movshdup {{.*#+}} xmm1 = xmm0[1,1,3,3]2092; SSE3-SLOW-NEXT:    addss %xmm1, %xmm02093; SSE3-SLOW-NEXT:    retq2094;2095; SSE3-FAST-LABEL: partial_reduction_fadd_v8f32_wrong_flags:2096; SSE3-FAST:       # %bb.0:2097; SSE3-FAST-NEXT:    movaps %xmm0, %xmm12098; SSE3-FAST-NEXT:    unpckhpd {{.*#+}} xmm1 = xmm1[1],xmm0[1]2099; SSE3-FAST-NEXT:    addps %xmm1, %xmm02100; SSE3-FAST-NEXT:    haddps %xmm0, %xmm02101; SSE3-FAST-NEXT:    retq2102;2103; AVX-SLOW-LABEL: partial_reduction_fadd_v8f32_wrong_flags:2104; AVX-SLOW:       # %bb.0:2105; AVX-SLOW-NEXT:    vshufpd {{.*#+}} xmm1 = xmm0[1,0]2106; AVX-SLOW-NEXT:    vaddps %xmm1, %xmm0, %xmm02107; AVX-SLOW-NEXT:    vmovshdup {{.*#+}} xmm1 = xmm0[1,1,3,3]2108; AVX-SLOW-NEXT:    vaddss %xmm1, %xmm0, %xmm02109; AVX-SLOW-NEXT:    vzeroupper2110; AVX-SLOW-NEXT:    retq2111;2112; AVX-FAST-LABEL: partial_reduction_fadd_v8f32_wrong_flags:2113; AVX-FAST:       # %bb.0:2114; AVX-FAST-NEXT:    vshufpd {{.*#+}} xmm1 = xmm0[1,0]2115; AVX-FAST-NEXT:    vaddps %xmm1, %xmm0, %xmm02116; AVX-FAST-NEXT:    vhaddps %xmm0, %xmm0, %xmm02117; AVX-FAST-NEXT:    vzeroupper2118; AVX-FAST-NEXT:    retq2119  %x23 = shufflevector <8 x float> %x, <8 x float> undef, <8 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>2120  %x0213 = fadd fast <8 x float> %x, %x232121  %x13 = shufflevector <8 x float> %x0213, <8 x float> undef, <8 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>2122  %x0123 = fadd ninf nnan <8 x float> %x0213, %x132123  %r = extractelement <8 x float> %x0123, i32 02124  ret float %r2125}2126 2127define float @partial_reduction_fadd_v16f32(<16 x float> %x) {2128; SSE3-SLOW-LABEL: partial_reduction_fadd_v16f32:2129; SSE3-SLOW:       # %bb.0:2130; SSE3-SLOW-NEXT:    movaps %xmm0, %xmm12131; SSE3-SLOW-NEXT:    unpckhpd {{.*#+}} xmm1 = xmm1[1],xmm0[1]2132; SSE3-SLOW-NEXT:    addps %xmm1, %xmm02133; SSE3-SLOW-NEXT:    movshdup {{.*#+}} xmm1 = xmm0[1,1,3,3]2134; SSE3-SLOW-NEXT:    addss %xmm1, %xmm02135; SSE3-SLOW-NEXT:    retq2136;2137; SSE3-FAST-LABEL: partial_reduction_fadd_v16f32:2138; SSE3-FAST:       # %bb.0:2139; SSE3-FAST-NEXT:    movaps %xmm0, %xmm12140; SSE3-FAST-NEXT:    unpckhpd {{.*#+}} xmm1 = xmm1[1],xmm0[1]2141; SSE3-FAST-NEXT:    addps %xmm1, %xmm02142; SSE3-FAST-NEXT:    haddps %xmm0, %xmm02143; SSE3-FAST-NEXT:    retq2144;2145; AVX-SLOW-LABEL: partial_reduction_fadd_v16f32:2146; AVX-SLOW:       # %bb.0:2147; AVX-SLOW-NEXT:    vshufpd {{.*#+}} xmm1 = xmm0[1,0]2148; AVX-SLOW-NEXT:    vaddps %xmm1, %xmm0, %xmm02149; AVX-SLOW-NEXT:    vmovshdup {{.*#+}} xmm1 = xmm0[1,1,3,3]2150; AVX-SLOW-NEXT:    vaddss %xmm1, %xmm0, %xmm02151; AVX-SLOW-NEXT:    vzeroupper2152; AVX-SLOW-NEXT:    retq2153;2154; AVX-FAST-LABEL: partial_reduction_fadd_v16f32:2155; AVX-FAST:       # %bb.0:2156; AVX-FAST-NEXT:    vhaddps %xmm0, %xmm0, %xmm02157; AVX-FAST-NEXT:    vhaddps %xmm0, %xmm0, %xmm02158; AVX-FAST-NEXT:    vzeroupper2159; AVX-FAST-NEXT:    retq2160  %x23 = shufflevector <16 x float> %x, <16 x float> undef, <16 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>2161  %x0213 = fadd <16 x float> %x, %x232162  %x13 = shufflevector <16 x float> %x0213, <16 x float> undef, <16 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>2163  %x0123 = fadd reassoc nsz <16 x float> %x0213, %x132164  %r = extractelement <16 x float> %x0123, i32 02165  ret float %r2166}2167 2168!llvm.module.flags = !{!0}2169!0 = !{i32 1, !"ProfileSummary", !1}2170!1 = !{!2, !3, !4, !5, !6, !7, !8, !9}2171!2 = !{!"ProfileFormat", !"InstrProf"}2172!3 = !{!"TotalCount", i64 10000}2173!4 = !{!"MaxCount", i64 10}2174!5 = !{!"MaxInternalCount", i64 1}2175!6 = !{!"MaxFunctionCount", i64 1000}2176!7 = !{!"NumCounts", i64 3}2177!8 = !{!"NumFunctions", i64 3}2178!9 = !{!"DetailedSummary", !10}2179!10 = !{!11, !12, !13}2180!11 = !{i32 10000, i64 100, i32 1}2181!12 = !{i32 999000, i64 100, i32 1}2182!13 = !{i32 999999, i64 1, i32 2}2183!14 = !{!"function_entry_count", i64 0}2184