Re-revert 91459. It's breaking the x86_64 darwin bootstrap.
[oota-llvm.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 target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64"
4
5 define void @test(<4 x float>* %F, float %f) {
6 entry:
7         %G = alloca <4 x float>, align 16               ; <<4 x float>*> [#uses=3]
8         %tmp = load <4 x float>* %F             ; <<4 x float>> [#uses=2]
9         %tmp3 = fadd <4 x float> %tmp, %tmp             ; <<4 x float>> [#uses=1]
10         store <4 x float> %tmp3, <4 x float>* %G
11         %G.upgrd.1 = getelementptr <4 x float>* %G, i32 0, i32 0                ; <float*> [#uses=1]
12         store float %f, float* %G.upgrd.1
13         %tmp4 = load <4 x float>* %G            ; <<4 x float>> [#uses=2]
14         %tmp6 = fadd <4 x float> %tmp4, %tmp4           ; <<4 x float>> [#uses=1]
15         store <4 x float> %tmp6, <4 x float>* %F
16         ret void
17 }
18
19 define void @test2(<4 x float>* %F, float %f) {
20 entry:
21         %G = alloca <4 x float>, align 16               ; <<4 x float>*> [#uses=3]
22         %tmp = load <4 x float>* %F             ; <<4 x float>> [#uses=2]
23         %tmp3 = fadd <4 x float> %tmp, %tmp             ; <<4 x float>> [#uses=1]
24         store <4 x float> %tmp3, <4 x float>* %G
25         %tmp.upgrd.2 = getelementptr <4 x float>* %G, i32 0, i32 2              ; <float*> [#uses=1]
26         store float %f, float* %tmp.upgrd.2
27         %tmp4 = load <4 x float>* %G            ; <<4 x float>> [#uses=2]
28         %tmp6 = fadd <4 x float> %tmp4, %tmp4           ; <<4 x float>> [#uses=1]
29         store <4 x float> %tmp6, <4 x float>* %F
30         ret void
31 }
32
33 define void @test3(<4 x float>* %F, float* %f) {
34 entry:
35         %G = alloca <4 x float>, align 16               ; <<4 x float>*> [#uses=2]
36         %tmp = load <4 x float>* %F             ; <<4 x float>> [#uses=2]
37         %tmp3 = fadd <4 x float> %tmp, %tmp             ; <<4 x float>> [#uses=1]
38         store <4 x float> %tmp3, <4 x float>* %G
39         %tmp.upgrd.3 = getelementptr <4 x float>* %G, i32 0, i32 2              ; <float*> [#uses=1]
40         %tmp.upgrd.4 = load float* %tmp.upgrd.3         ; <float> [#uses=1]
41         store float %tmp.upgrd.4, float* %f
42         ret void
43 }
44
45 define void @test4(<4 x float>* %F, float* %f) {
46 entry:
47         %G = alloca <4 x float>, align 16               ; <<4 x float>*> [#uses=2]
48         %tmp = load <4 x float>* %F             ; <<4 x float>> [#uses=2]
49         %tmp3 = fadd <4 x float> %tmp, %tmp             ; <<4 x float>> [#uses=1]
50         store <4 x float> %tmp3, <4 x float>* %G
51         %G.upgrd.5 = getelementptr <4 x float>* %G, i32 0, i32 0                ; <float*> [#uses=1]
52         %tmp.upgrd.6 = load float* %G.upgrd.5           ; <float> [#uses=1]
53         store float %tmp.upgrd.6, float* %f
54         ret void
55 }
56
57 define i32 @test5(float %X) {  ;; should turn into bitcast.
58         %X_addr = alloca [4 x float]
59         %X1 = getelementptr [4 x float]* %X_addr, i32 0, i32 2
60         store float %X, float* %X1
61         %a = bitcast float* %X1 to i32*
62         %tmp = load i32* %a
63         ret i32 %tmp
64 }
65