Move & restructure test per review.
[oota-llvm.git] / test / CodeGen / X86 / vec_ins_extract.ll
1 ; RUN: llvm-as < %s | opt -scalarrepl -instcombine | \
2 ; RUN:   llc -march=x86 -mcpu=yonah | not grep sub.*esp
3
4 ; This checks that various insert/extract idiom work without going to the
5 ; stack.
6
7 define void @test(<4 x float>* %F, float %f) {
8 entry:
9         %tmp = load <4 x float>* %F             ; <<4 x float>> [#uses=2]
10         %tmp3 = add <4 x float> %tmp, %tmp              ; <<4 x float>> [#uses=1]
11         %tmp10 = insertelement <4 x float> %tmp3, float %f, i32 0               ; <<4 x float>> [#uses=2]
12         %tmp6 = add <4 x float> %tmp10, %tmp10          ; <<4 x float>> [#uses=1]
13         store <4 x float> %tmp6, <4 x float>* %F
14         ret void
15 }
16
17 define void @test2(<4 x float>* %F, float %f) {
18 entry:
19         %G = alloca <4 x float>, align 16               ; <<4 x float>*> [#uses=3]
20         %tmp = load <4 x float>* %F             ; <<4 x float>> [#uses=2]
21         %tmp3 = add <4 x float> %tmp, %tmp              ; <<4 x float>> [#uses=1]
22         store <4 x float> %tmp3, <4 x float>* %G
23         %tmp.upgrd.1 = getelementptr <4 x float>* %G, i32 0, i32 2              ; <float*> [#uses=1]
24         store float %f, float* %tmp.upgrd.1
25         %tmp4 = load <4 x float>* %G            ; <<4 x float>> [#uses=2]
26         %tmp6 = add <4 x float> %tmp4, %tmp4            ; <<4 x float>> [#uses=1]
27         store <4 x float> %tmp6, <4 x float>* %F
28         ret void
29 }
30
31 define void @test3(<4 x float>* %F, float* %f) {
32 entry:
33         %G = alloca <4 x float>, align 16               ; <<4 x float>*> [#uses=2]
34         %tmp = load <4 x float>* %F             ; <<4 x float>> [#uses=2]
35         %tmp3 = add <4 x float> %tmp, %tmp              ; <<4 x float>> [#uses=1]
36         store <4 x float> %tmp3, <4 x float>* %G
37         %tmp.upgrd.2 = getelementptr <4 x float>* %G, i32 0, i32 2              ; <float*> [#uses=1]
38         %tmp.upgrd.3 = load float* %tmp.upgrd.2         ; <float> [#uses=1]
39         store float %tmp.upgrd.3, float* %f
40         ret void
41 }
42
43 define void @test4(<4 x float>* %F, float* %f) {
44 entry:
45         %tmp = load <4 x float>* %F             ; <<4 x float>> [#uses=2]
46         %tmp5.lhs = extractelement <4 x float> %tmp, i32 0              ; <float> [#uses=1]
47         %tmp5.rhs = extractelement <4 x float> %tmp, i32 0              ; <float> [#uses=1]
48         %tmp5 = add float %tmp5.lhs, %tmp5.rhs          ; <float> [#uses=1]
49         store float %tmp5, float* %f
50         ret void
51 }