Merging r259740:
[oota-llvm.git] / test / CodeGen / PowerPC / mem_update.ll
1 ; RUN: llc < %s -march=ppc32 | \
2 ; RUN:   not grep addi
3 ; RUN: llc -code-model=small < %s -march=ppc64 | \
4 ; RUN:   not grep addi
5
6 @Glob = global i64 4
7
8 define i32* @test0(i32* %X, i32* %dest) nounwind {
9         %Y = getelementptr i32, i32* %X, i32 4
10         %A = load i32, i32* %Y
11         store i32 %A, i32* %dest
12         ret i32* %Y
13 }
14
15 define i32* @test1(i32* %X, i32* %dest) nounwind {
16         %Y = getelementptr i32, i32* %X, i32 4
17         %A = load i32, i32* %Y
18         store i32 %A, i32* %dest
19         ret i32* %Y
20 }
21
22 define i16* @test2(i16* %X, i32* %dest) nounwind {
23         %Y = getelementptr i16, i16* %X, i32 4
24         %A = load i16, i16* %Y
25         %B = sext i16 %A to i32
26         store i32 %B, i32* %dest
27         ret i16* %Y
28 }
29
30 define i16* @test3(i16* %X, i32* %dest) nounwind {
31         %Y = getelementptr i16, i16* %X, i32 4
32         %A = load i16, i16* %Y
33         %B = zext i16 %A to i32
34         store i32 %B, i32* %dest
35         ret i16* %Y
36 }
37
38 define i16* @test3a(i16* %X, i64* %dest) nounwind {
39         %Y = getelementptr i16, i16* %X, i32 4
40         %A = load i16, i16* %Y
41         %B = sext i16 %A to i64
42         store i64 %B, i64* %dest
43         ret i16* %Y
44 }
45
46 define i64* @test4(i64* %X, i64* %dest) nounwind {
47         %Y = getelementptr i64, i64* %X, i32 4
48         %A = load i64, i64* %Y
49         store i64 %A, i64* %dest
50         ret i64* %Y
51 }
52
53 define i16* @test5(i16* %X) nounwind {
54         %Y = getelementptr i16, i16* %X, i32 4
55         store i16 7, i16* %Y
56         ret i16* %Y
57 }
58
59 define i64* @test6(i64* %X, i64 %A) nounwind {
60         %Y = getelementptr i64, i64* %X, i32 4
61         store i64 %A, i64* %Y
62         ret i64* %Y
63 }
64
65 define i64* @test7(i64* %X, i64 %A) nounwind {
66         store i64 %A, i64* @Glob
67         ret i64* @Glob
68 }