]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/Transforms/ScalarRepl/vector_promote.ll
Update llvm to r84119.
[FreeBSD/FreeBSD.git] / test / Transforms / ScalarRepl / vector_promote.ll
1 ; RUN: opt < %s -scalarrepl -S | not grep alloca
2 ; RUN: opt < %s -scalarrepl -S | grep {load <4 x float>}
3
4 define void @test(<4 x float>* %F, float %f) {
5 entry:
6         %G = alloca <4 x float>, align 16               ; <<4 x float>*> [#uses=3]
7         %tmp = load <4 x float>* %F             ; <<4 x float>> [#uses=2]
8         %tmp3 = fadd <4 x float> %tmp, %tmp             ; <<4 x float>> [#uses=1]
9         store <4 x float> %tmp3, <4 x float>* %G
10         %G.upgrd.1 = getelementptr <4 x float>* %G, i32 0, i32 0                ; <float*> [#uses=1]
11         store float %f, float* %G.upgrd.1
12         %tmp4 = load <4 x float>* %G            ; <<4 x float>> [#uses=2]
13         %tmp6 = fadd <4 x float> %tmp4, %tmp4           ; <<4 x float>> [#uses=1]
14         store <4 x float> %tmp6, <4 x float>* %F
15         ret void
16 }
17
18 define void @test2(<4 x float>* %F, float %f) {
19 entry:
20         %G = alloca <4 x float>, align 16               ; <<4 x float>*> [#uses=3]
21         %tmp = load <4 x float>* %F             ; <<4 x float>> [#uses=2]
22         %tmp3 = fadd <4 x float> %tmp, %tmp             ; <<4 x float>> [#uses=1]
23         store <4 x float> %tmp3, <4 x float>* %G
24         %tmp.upgrd.2 = getelementptr <4 x float>* %G, i32 0, i32 2              ; <float*> [#uses=1]
25         store float %f, float* %tmp.upgrd.2
26         %tmp4 = load <4 x float>* %G            ; <<4 x float>> [#uses=2]
27         %tmp6 = fadd <4 x float> %tmp4, %tmp4           ; <<4 x float>> [#uses=1]
28         store <4 x float> %tmp6, <4 x float>* %F
29         ret void
30 }
31
32 define void @test3(<4 x float>* %F, float* %f) {
33 entry:
34         %G = alloca <4 x float>, align 16               ; <<4 x float>*> [#uses=2]
35         %tmp = load <4 x float>* %F             ; <<4 x float>> [#uses=2]
36         %tmp3 = fadd <4 x float> %tmp, %tmp             ; <<4 x float>> [#uses=1]
37         store <4 x float> %tmp3, <4 x float>* %G
38         %tmp.upgrd.3 = getelementptr <4 x float>* %G, i32 0, i32 2              ; <float*> [#uses=1]
39         %tmp.upgrd.4 = load float* %tmp.upgrd.3         ; <float> [#uses=1]
40         store float %tmp.upgrd.4, float* %f
41         ret void
42 }
43
44 define void @test4(<4 x float>* %F, float* %f) {
45 entry:
46         %G = alloca <4 x float>, align 16               ; <<4 x float>*> [#uses=2]
47         %tmp = load <4 x float>* %F             ; <<4 x float>> [#uses=2]
48         %tmp3 = fadd <4 x float> %tmp, %tmp             ; <<4 x float>> [#uses=1]
49         store <4 x float> %tmp3, <4 x float>* %G
50         %G.upgrd.5 = getelementptr <4 x float>* %G, i32 0, i32 0                ; <float*> [#uses=1]
51         %tmp.upgrd.6 = load float* %G.upgrd.5           ; <float> [#uses=1]
52         store float %tmp.upgrd.6, float* %f
53         ret void
54 }
55
56 define i32 @test5(float %X) {  ;; should turn into bitcast.
57         %X_addr = alloca [4 x float]
58         %X1 = getelementptr [4 x float]* %X_addr, i32 0, i32 2
59         store float %X, float* %X1
60         %a = bitcast float* %X1 to i32*
61         %tmp = load i32* %a
62         ret i32 %tmp
63 }
64