1; RUN: llc < %s -mtriple=x86_64-linux -mcpu=penryn -o - | FileCheck %s --check-prefix=X64 2; RUN: llc < %s -mcpu=yonah -march=x86 -mtriple=i386-linux-gnu -o - | FileCheck %s --check-prefix=X32 3 4; PR7518 5define void @test1(<2 x float> %Q, float *%P2) nounwind { 6; X64-LABEL: test1: 7; X64: # BB#0: 8; X64-NEXT: movshdup {{.*#+}} xmm1 = xmm0[1,1,3,3] 9; X64-NEXT: addss %xmm0, %xmm1 10; X64-NEXT: movss %xmm1, (%rdi) 11; X64-NEXT: retq 12; 13; X32-LABEL: test1: 14; X32: # BB#0: 15; X32-NEXT: movl {{[0-9]+}}(%esp), %eax 16; X32-NEXT: movshdup {{.*#+}} xmm1 = xmm0[1,1,3,3] 17; X32-NEXT: addss %xmm0, %xmm1 18; X32-NEXT: movss %xmm1, (%eax) 19; X32-NEXT: retl 20 %a = extractelement <2 x float> %Q, i32 0 21 %b = extractelement <2 x float> %Q, i32 1 22 %c = fadd float %a, %b 23 store float %c, float* %P2 24 ret void 25} 26 27define <2 x float> @test2(<2 x float> %Q, <2 x float> %R, <2 x float> *%P) nounwind { 28; X64-LABEL: test2: 29; X64: # BB#0: 30; X64-NEXT: addps %xmm1, %xmm0 31; X64-NEXT: retq 32; 33; X32-LABEL: test2: 34; X32: # BB#0: 35; X32-NEXT: addps %xmm1, %xmm0 36; X32-NEXT: retl 37 %Z = fadd <2 x float> %Q, %R 38 ret <2 x float> %Z 39} 40 41define <2 x float> @test3(<4 x float> %A) nounwind { 42; X64-LABEL: test3: 43; X64: # BB#0: 44; X64-NEXT: addps %xmm0, %xmm0 45; X64-NEXT: retq 46; 47; X32-LABEL: test3: 48; X32: # BB#0: 49; X32-NEXT: addps %xmm0, %xmm0 50; X32-NEXT: retl 51 %B = shufflevector <4 x float> %A, <4 x float> undef, <2 x i32> <i32 0, i32 1> 52 %C = fadd <2 x float> %B, %B 53 ret <2 x float> %C 54} 55 56define <2 x float> @test4(<2 x float> %A) nounwind { 57; X64-LABEL: test4: 58; X64: # BB#0: 59; X64-NEXT: addps %xmm0, %xmm0 60; X64-NEXT: retq 61; 62; X32-LABEL: test4: 63; X32: # BB#0: 64; X32-NEXT: addps %xmm0, %xmm0 65; X32-NEXT: retl 66 %C = fadd <2 x float> %A, %A 67 ret <2 x float> %C 68} 69 70define <4 x float> @test5(<4 x float> %A) nounwind { 71; X64-LABEL: test5: 72; X64: # BB#0: 73; X64-NEXT: addps %xmm0, %xmm0 74; X64-NEXT: addps %xmm0, %xmm0 75; X64-NEXT: retq 76; 77; X32-LABEL: test5: 78; X32: # BB#0: 79; X32-NEXT: addps %xmm0, %xmm0 80; X32-NEXT: addps %xmm0, %xmm0 81; X32-NEXT: retl 82 %B = shufflevector <4 x float> %A, <4 x float> undef, <2 x i32> <i32 0, i32 1> 83 %C = fadd <2 x float> %B, %B 84 br label %BB 85 86BB: 87 %D = fadd <2 x float> %C, %C 88 %E = shufflevector <2 x float> %D, <2 x float> undef, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef> 89 ret <4 x float> %E 90} 91 92 93