1 ; RUN: llc < %s -mcpu=corei7 -march=x86 -mattr=+sse2,-sse4.1 | FileCheck %s
3 target triple = "x86_64-unknown-linux-gnu"
5 define void @test1(<4 x float>* %F, float* %f) nounwind {
7 ; CHECK: # BB#0: # %entry
8 ; CHECK-NEXT: movl {{[0-9]+}}(%esp), %eax
9 ; CHECK-NEXT: movl {{[0-9]+}}(%esp), %ecx
10 ; CHECK-NEXT: movaps (%ecx), %xmm0
11 ; CHECK-NEXT: addps %xmm0, %xmm0
12 ; CHECK-NEXT: movss %xmm0, (%eax)
15 %tmp = load <4 x float>, <4 x float>* %F ; <<4 x float>> [#uses=2]
16 %tmp7 = fadd <4 x float> %tmp, %tmp ; <<4 x float>> [#uses=1]
17 %tmp2 = extractelement <4 x float> %tmp7, i32 0 ; <float> [#uses=1]
18 store float %tmp2, float* %f
22 define float @test2(<4 x float>* %F, float* %f) nounwind {
24 ; CHECK: # BB#0: # %entry
25 ; CHECK-NEXT: pushl %eax
26 ; CHECK-NEXT: movl {{[0-9]+}}(%esp), %eax
27 ; CHECK-NEXT: movaps (%eax), %xmm0
28 ; CHECK-NEXT: addps %xmm0, %xmm0
29 ; CHECK-NEXT: shufpd {{.*#+}} xmm0 = xmm0[1,0]
30 ; CHECK-NEXT: movss %xmm0, (%esp)
31 ; CHECK-NEXT: flds (%esp)
32 ; CHECK-NEXT: popl %eax
35 %tmp = load <4 x float>, <4 x float>* %F ; <<4 x float>> [#uses=2]
36 %tmp7 = fadd <4 x float> %tmp, %tmp ; <<4 x float>> [#uses=1]
37 %tmp2 = extractelement <4 x float> %tmp7, i32 2 ; <float> [#uses=1]
41 define void @test3(float* %R, <4 x float>* %P1) nounwind {
43 ; CHECK: # BB#0: # %entry
44 ; CHECK-NEXT: movl {{[0-9]+}}(%esp), %eax
45 ; CHECK-NEXT: movl {{[0-9]+}}(%esp), %ecx
46 ; CHECK-NEXT: movss 12(%ecx), %xmm0
47 ; CHECK-NEXT: movss %xmm0, (%eax)
50 %X = load <4 x float>, <4 x float>* %P1 ; <<4 x float>> [#uses=1]
51 %tmp = extractelement <4 x float> %X, i32 3 ; <float> [#uses=1]
52 store float %tmp, float* %R
56 define double @test4(double %A) nounwind {
58 ; CHECK: # BB#0: # %entry
59 ; CHECK-NEXT: subl $12, %esp
60 ; CHECK-NEXT: calll foo
61 ; CHECK-NEXT: shufpd {{.*#+}} xmm0 = xmm0[1,0]
62 ; CHECK-NEXT: addsd {{[0-9]+}}(%esp), %xmm0
63 ; CHECK-NEXT: movsd %xmm0, (%esp)
64 ; CHECK-NEXT: fldl (%esp)
65 ; CHECK-NEXT: addl $12, %esp
68 %tmp1 = call <2 x double> @foo( ) ; <<2 x double>> [#uses=1]
69 %tmp2 = extractelement <2 x double> %tmp1, i32 1 ; <double> [#uses=1]
70 %tmp3 = fadd double %tmp2, %A ; <double> [#uses=1]
74 declare <2 x double> @foo()