1 ; RUN: llc < %s -mcpu=corei7 -march=x86 -mattr=+sse2,-sse4.1 | FileCheck %s
3 define void @test1(<4 x float>* %F, float* %f) nounwind {
5 ; CHECK: # BB#0: # %entry
6 ; CHECK-NEXT: movl {{[0-9]+}}(%esp), %eax
7 ; CHECK-NEXT: movl {{[0-9]+}}(%esp), %ecx
8 ; CHECK-NEXT: movaps (%ecx), %xmm0
9 ; CHECK-NEXT: addps %xmm0, %xmm0
10 ; CHECK-NEXT: movss %xmm0, (%eax)
13 %tmp = load <4 x float>* %F ; <<4 x float>> [#uses=2]
14 %tmp7 = fadd <4 x float> %tmp, %tmp ; <<4 x float>> [#uses=1]
15 %tmp2 = extractelement <4 x float> %tmp7, i32 0 ; <float> [#uses=1]
16 store float %tmp2, float* %f
20 define float @test2(<4 x float>* %F, float* %f) nounwind {
22 ; CHECK: # BB#0: # %entry
23 ; CHECK-NEXT: pushl %eax
24 ; CHECK-NEXT: movl {{[0-9]+}}(%esp), %eax
25 ; CHECK-NEXT: movaps (%eax), %xmm0
26 ; CHECK-NEXT: addps %xmm0, %xmm0
27 ; CHECK-NEXT: shufpd {{.*#+}} xmm0 = xmm0[1,0]
28 ; CHECK-NEXT: movss %xmm0, (%esp)
29 ; CHECK-NEXT: flds (%esp)
30 ; CHECK-NEXT: popl %eax
33 %tmp = load <4 x float>* %F ; <<4 x float>> [#uses=2]
34 %tmp7 = fadd <4 x float> %tmp, %tmp ; <<4 x float>> [#uses=1]
35 %tmp2 = extractelement <4 x float> %tmp7, i32 2 ; <float> [#uses=1]
39 define void @test3(float* %R, <4 x float>* %P1) nounwind {
41 ; CHECK: # BB#0: # %entry
42 ; CHECK-NEXT: movl {{[0-9]+}}(%esp), %eax
43 ; CHECK-NEXT: movl {{[0-9]+}}(%esp), %ecx
44 ; CHECK-NEXT: movss 12(%ecx), %xmm0
45 ; CHECK-NEXT: movss %xmm0, (%eax)
48 %X = load <4 x float>* %P1 ; <<4 x float>> [#uses=1]
49 %tmp = extractelement <4 x float> %X, i32 3 ; <float> [#uses=1]
50 store float %tmp, float* %R
54 define double @test4(double %A) nounwind {
56 ; CHECK: # BB#0: # %entry
57 ; CHECK-NEXT: subl $12, %esp
58 ; CHECK-NEXT: calll foo
59 ; CHECK-NEXT: shufpd {{.*#+}} xmm0 = xmm0[1,0]
60 ; CHECK-NEXT: addsd {{[0-9]+}}(%esp), %xmm0
61 ; CHECK-NEXT: movsd %xmm0, (%esp)
62 ; CHECK-NEXT: fldl (%esp)
63 ; CHECK-NEXT: addl $12, %esp
66 %tmp1 = call <2 x double> @foo( ) ; <<2 x double>> [#uses=1]
67 %tmp2 = extractelement <2 x double> %tmp1, i32 1 ; <double> [#uses=1]
68 %tmp3 = fadd double %tmp2, %A ; <double> [#uses=1]
72 declare <2 x double> @foo()