1; RUN: llc < %s -mcpu=corei7 -march=x86 -mattr=+sse2,-sse4.1 | FileCheck %s 2 3target triple = "x86_64-unknown-linux-gnu" 4 5define void @test1(<4 x float>* %F, float* %f) nounwind { 6; CHECK-LABEL: test1: 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) 13; CHECK-NEXT: retl 14entry: 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 19 ret void 20} 21 22define float @test2(<4 x float>* %F, float* %f) nounwind { 23; CHECK-LABEL: test2: 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 33; CHECK-NEXT: retl 34entry: 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] 38 ret float %tmp2 39} 40 41define void @test3(float* %R, <4 x float>* %P1) nounwind { 42; CHECK-LABEL: test3: 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) 48; CHECK-NEXT: retl 49entry: 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 53 ret void 54} 55 56define double @test4(double %A) nounwind { 57; CHECK-LABEL: test4: 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 66; CHECK-NEXT: retl 67entry: 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] 71 ret double %tmp3 72} 73 74declare <2 x double> @foo() 75