Fixes a bug in the DAGCombiner. LoadSDNodes have two values (data, chain).
[oota-llvm.git] / test / CodeGen / X86 / vec_extract.ll
1 ; RUN: llc < %s -mcpu=corei7 -march=x86 -mattr=+sse2,-sse41 -o %t
2 ; RUN: grep movss    %t | count 4
3 ; RUN: grep movhlps  %t | count 1
4 ; RUN: not grep pshufd   %t 
5 ; RUN: grep unpckhpd %t | count 1
6
7 define void @test1(<4 x float>* %F, float* %f) nounwind {
8         %tmp = load <4 x float>* %F             ; <<4 x float>> [#uses=2]
9         %tmp7 = fadd <4 x float> %tmp, %tmp             ; <<4 x float>> [#uses=1]
10         %tmp2 = extractelement <4 x float> %tmp7, i32 0         ; <float> [#uses=1]
11         store float %tmp2, float* %f
12         ret void
13 }
14
15 define float @test2(<4 x float>* %F, float* %f) nounwind {
16         %tmp = load <4 x float>* %F             ; <<4 x float>> [#uses=2]
17         %tmp7 = fadd <4 x float> %tmp, %tmp             ; <<4 x float>> [#uses=1]
18         %tmp2 = extractelement <4 x float> %tmp7, i32 2         ; <float> [#uses=1]
19         ret float %tmp2
20 }
21
22 define void @test3(float* %R, <4 x float>* %P1) nounwind {
23         %X = load <4 x float>* %P1              ; <<4 x float>> [#uses=1]
24         %tmp = extractelement <4 x float> %X, i32 3             ; <float> [#uses=1]
25         store float %tmp, float* %R
26         ret void
27 }
28
29 define double @test4(double %A) nounwind {
30         %tmp1 = call <2 x double> @foo( )               ; <<2 x double>> [#uses=1]
31         %tmp2 = extractelement <2 x double> %tmp1, i32 1                ; <double> [#uses=1]
32         %tmp3 = fadd double %tmp2, %A           ; <double> [#uses=1]
33         ret double %tmp3
34 }
35
36 declare <2 x double> @foo()