Chris Lattner | 11b3d16 | 2010-07-05 05:52:56 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s -march=x86-64 -mcpu=penryn -asm-verbose=0 -o - | FileCheck %s -check-prefix=X64 |
Chris Lattner | 4fd1ab3 | 2010-07-05 03:56:55 +0000 | [diff] [blame] | 2 | ; RUN: llc < %s -mcpu=yonah -march=x86 -asm-verbose=0 -o - | FileCheck %s -check-prefix=X32 |
Chris Lattner | e35d984 | 2010-07-04 22:57:10 +0000 | [diff] [blame] | 3 | |
| 4 | ; PR7518 |
| 5 | define void @test1(<2 x float> %Q, float *%P2) nounwind { |
| 6 | %a = extractelement <2 x float> %Q, i32 0 |
| 7 | %b = extractelement <2 x float> %Q, i32 1 |
| 8 | %c = fadd float %a, %b |
| 9 | |
| 10 | store float %c, float* %P2 |
| 11 | ret void |
Chris Lattner | f172ecd | 2010-07-04 23:07:25 +0000 | [diff] [blame] | 12 | ; X64: test1: |
Chris Lattner | e6f7c26 | 2010-08-25 22:49:25 +0000 | [diff] [blame] | 13 | ; X64-NEXT: pshufd $1, %xmm0, %xmm1 |
| 14 | ; X64-NEXT: addss %xmm0, %xmm1 |
| 15 | ; X64-NEXT: movss %xmm1, (%rdi) |
Chris Lattner | f172ecd | 2010-07-04 23:07:25 +0000 | [diff] [blame] | 16 | ; X64-NEXT: ret |
| 17 | |
| 18 | ; X32: test1: |
Chris Lattner | e6f7c26 | 2010-08-25 22:49:25 +0000 | [diff] [blame] | 19 | ; X32-NEXT: pshufd $1, %xmm0, %xmm1 |
| 20 | ; X32-NEXT: addss %xmm0, %xmm1 |
| 21 | ; X32-NEXT: movl 4(%esp), %eax |
| 22 | ; X32-NEXT: movss %xmm1, (%eax) |
Chris Lattner | f172ecd | 2010-07-04 23:07:25 +0000 | [diff] [blame] | 23 | ; X32-NEXT: ret |
Chris Lattner | e35d984 | 2010-07-04 22:57:10 +0000 | [diff] [blame] | 24 | } |
| 25 | |
Chris Lattner | 11b3d16 | 2010-07-05 05:52:56 +0000 | [diff] [blame] | 26 | |
| 27 | define <2 x float> @test2(<2 x float> %Q, <2 x float> %R, <2 x float> *%P) nounwind { |
| 28 | %Z = fadd <2 x float> %Q, %R |
| 29 | ret <2 x float> %Z |
| 30 | |
| 31 | ; X64: test2: |
Chris Lattner | e6f7c26 | 2010-08-25 22:49:25 +0000 | [diff] [blame] | 32 | ; X64-NEXT: addps %xmm1, %xmm0 |
Chris Lattner | 11b3d16 | 2010-07-05 05:52:56 +0000 | [diff] [blame] | 33 | ; X64-NEXT: ret |
| 34 | } |
Chris Lattner | e6f7c26 | 2010-08-25 22:49:25 +0000 | [diff] [blame] | 35 | |
| 36 | |
| 37 | define <2 x float> @test3(<4 x float> %A) nounwind { |
| 38 | %B = shufflevector <4 x float> %A, <4 x float> undef, <2 x i32> <i32 0, i32 1> |
| 39 | %C = fadd <2 x float> %B, %B |
| 40 | ret <2 x float> %C |
| 41 | ; CHECK: test3: |
| 42 | ; CHECK-NEXT: addps %xmm0, %xmm0 |
| 43 | ; CHECK-NEXT: ret |
| 44 | } |
| 45 | |
| 46 | define <2 x float> @test4(<2 x float> %A) nounwind { |
| 47 | %C = fadd <2 x float> %A, %A |
| 48 | ret <2 x float> %C |
| 49 | ; CHECK: test4: |
| 50 | ; CHECK-NEXT: addps %xmm0, %xmm0 |
| 51 | ; CHECK-NEXT: ret |
| 52 | } |
| 53 | |
| 54 | define <4 x float> @test5(<4 x float> %A) nounwind { |
| 55 | %B = shufflevector <4 x float> %A, <4 x float> undef, <2 x i32> <i32 0, i32 1> |
| 56 | %C = fadd <2 x float> %B, %B |
| 57 | br label %BB |
| 58 | |
| 59 | BB: |
| 60 | %D = fadd <2 x float> %C, %C |
| 61 | %E = shufflevector <2 x float> %D, <2 x float> undef, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef> |
| 62 | ret <4 x float> %E |
| 63 | |
| 64 | ; CHECK: _test5: |
| 65 | ; CHECK-NEXT: addps %xmm0, %xmm0 |
| 66 | ; CHECK-NEXT: addps %xmm0, %xmm0 |
| 67 | ; CHECK-NEXT: ret |
| 68 | } |
| 69 | |
| 70 | |