Inline asm mult-alt constraint tests.
[oota-llvm.git] / test / CodeGen / X86 / v2f32.ll
1 ; RUN: llc < %s -march=x86-64 -mcpu=penryn -asm-verbose=0 -o - | FileCheck %s -check-prefix=X64
2 ; RUN: llc < %s -mcpu=yonah -march=x86 -asm-verbose=0 -o - | FileCheck %s -check-prefix=X32
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
12 ; X64: test1:
13 ; X64-NEXT: pshufd      $1, %xmm0, %xmm1
14 ; X64-NEXT: addss       %xmm0, %xmm1
15 ; X64-NEXT: movss       %xmm1, (%rdi)
16 ; X64-NEXT: ret
17
18 ; X32: test1:
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)
23 ; X32-NEXT: ret
24 }
25
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:
32 ; X64-NEXT: addps       %xmm1, %xmm0
33 ; X64-NEXT: ret
34 }
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