d9c9cc459c7ec18d65755a60a61c594d0f469140
[oota-llvm.git] / test / CodeGen / ARM / fast-isel-ldr-str-thumb-neg-index.ll
1 ; RUN: llc < %s -O0 -fast-isel-abort -relocation-model=dynamic-no-pic -mtriple=thumbv7-apple-ios -verify-machineinstrs | FileCheck %s --check-prefix=THUMB
2
3 define i32 @t1(i32* nocapture %ptr) nounwind readonly {
4 entry:
5 ; THUMB: t1
6   %add.ptr = getelementptr inbounds i32* %ptr, i32 -1
7   %0 = load i32* %add.ptr, align 4
8 ; THUMB: ldr r{{[0-9]}}, [r0, #-4]
9   ret i32 %0
10 }
11
12 define i32 @t2(i32* nocapture %ptr) nounwind readonly {
13 entry:
14 ; THUMB: t2
15   %add.ptr = getelementptr inbounds i32* %ptr, i32 -63
16   %0 = load i32* %add.ptr, align 4
17 ; THUMB: ldr r{{[0-9]}}, [r0, #-252]
18   ret i32 %0
19 }
20
21 define i32 @t3(i32* nocapture %ptr) nounwind readonly {
22 entry:
23 ; THUMB: t3
24   %add.ptr = getelementptr inbounds i32* %ptr, i32 -64
25   %0 = load i32* %add.ptr, align 4
26 ; THUMB: ldr r{{[0-9]}}, [r0]
27   ret i32 %0
28 }
29
30 define zeroext i16 @t4(i16* nocapture %ptr) nounwind readonly {
31 entry:
32 ; THUMB: t4
33   %add.ptr = getelementptr inbounds i16* %ptr, i32 -1
34   %0 = load i16* %add.ptr, align 2
35 ; THUMB: ldrh r{{[0-9]}}, [r0, #-2]
36   ret i16 %0
37 }
38
39 define zeroext i16 @t5(i16* nocapture %ptr) nounwind readonly {
40 entry:
41 ; THUMB: t5
42   %add.ptr = getelementptr inbounds i16* %ptr, i32 -127
43   %0 = load i16* %add.ptr, align 2
44 ; THUMB: ldrh r{{[0-9]}}, [r0, #-254]
45   ret i16 %0
46 }
47
48 define zeroext i16 @t6(i16* nocapture %ptr) nounwind readonly {
49 entry:
50 ; THUMB: t6
51   %add.ptr = getelementptr inbounds i16* %ptr, i32 -128
52   %0 = load i16* %add.ptr, align 2
53 ; THUMB: ldrh r{{[0-9]}}, [r0]
54   ret i16 %0
55 }
56
57 define zeroext i8 @t7(i8* nocapture %ptr) nounwind readonly {
58 entry:
59 ; THUMB: t7
60   %add.ptr = getelementptr inbounds i8* %ptr, i32 -1
61   %0 = load i8* %add.ptr, align 1
62 ; THUMB: ldrb r{{[0-9]}}, [r0, #-1]
63   ret i8 %0
64 }
65
66 define zeroext i8 @t8(i8* nocapture %ptr) nounwind readonly {
67 entry:
68 ; THUMB: t8
69   %add.ptr = getelementptr inbounds i8* %ptr, i32 -255
70   %0 = load i8* %add.ptr, align 1
71 ; THUMB: ldrb r{{[0-9]}}, [r0, #-255]
72   ret i8 %0
73 }
74
75 define zeroext i8 @t9(i8* nocapture %ptr) nounwind readonly {
76 entry:
77 ; THUMB: t9
78   %add.ptr = getelementptr inbounds i8* %ptr, i32 -256
79   %0 = load i8* %add.ptr, align 1
80 ; THUMB: ldrb r{{[0-9]}}, [r0]
81   ret i8 %0
82 }
83
84 define void @t10(i32* nocapture %ptr) nounwind {
85 entry:
86 ; THUMB: t10
87   %add.ptr = getelementptr inbounds i32* %ptr, i32 -1
88   store i32 0, i32* %add.ptr, align 4
89 ; THUMB: str r{{[0-9]}}, [r0, #-4]
90   ret void
91 }
92
93 define void @t11(i32* nocapture %ptr) nounwind {
94 entry:
95 ; THUMB: t11
96   %add.ptr = getelementptr inbounds i32* %ptr, i32 -63
97   store i32 0, i32* %add.ptr, align 4
98 ; THUMB: str r{{[0-9]}}, [r0, #-252]
99   ret void
100 }
101
102 define void @t12(i32* nocapture %ptr) nounwind {
103 entry:
104 ; THUMB: t12
105   %add.ptr = getelementptr inbounds i32* %ptr, i32 -64
106   store i32 0, i32* %add.ptr, align 4
107 ; THUMB: str r{{[0-9]}}, [r0]
108   ret void
109 }
110
111 define void @t13(i16* nocapture %ptr) nounwind {
112 entry:
113 ; THUMB: t13
114   %add.ptr = getelementptr inbounds i16* %ptr, i32 -1
115   store i16 0, i16* %add.ptr, align 2
116 ; THUMB: strh r{{[0-9]}}, [r0, #-2]
117   ret void
118 }
119
120 define void @t14(i16* nocapture %ptr) nounwind {
121 entry:
122 ; THUMB: t14
123   %add.ptr = getelementptr inbounds i16* %ptr, i32 -127
124   store i16 0, i16* %add.ptr, align 2
125 ; THUMB: strh r{{[0-9]}}, [r0, #-254]
126   ret void
127 }
128
129 define void @t15(i16* nocapture %ptr) nounwind {
130 entry:
131 ; THUMB: t15
132   %add.ptr = getelementptr inbounds i16* %ptr, i32 -128
133   store i16 0, i16* %add.ptr, align 2
134 ; THUMB: strh r{{[0-9]}}, [r0]
135   ret void
136 }
137
138 define void @t16(i8* nocapture %ptr) nounwind {
139 entry:
140 ; THUMB: t16
141   %add.ptr = getelementptr inbounds i8* %ptr, i32 -1
142   store i8 0, i8* %add.ptr, align 1
143 ; THUMB: strb r{{[0-9]}}, [r0, #-1]
144   ret void
145 }
146
147 define void @t17(i8* nocapture %ptr) nounwind {
148 entry:
149 ; THUMB: t17
150   %add.ptr = getelementptr inbounds i8* %ptr, i32 -255
151   store i8 0, i8* %add.ptr, align 1
152 ; THUMB: strb r{{[0-9]}}, [r0, #-255]
153   ret void
154 }
155
156 define void @t18(i8* nocapture %ptr) nounwind {
157 entry:
158 ; THUMB: t18
159   %add.ptr = getelementptr inbounds i8* %ptr, i32 -256
160   store i8 0, i8* %add.ptr, align 1
161 ; THUMB: strb r{{[0-9]}}, [r0]
162   ret void
163 }