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