1; RUN: llc < %s -O0 -fast-isel-abort=1 -relocation-model=dynamic-no-pic -mtriple=thumbv7-apple-ios -verify-machineinstrs | FileCheck %s --check-prefix=THUMB
2
3define i32 @t1(i32* nocapture %ptr) nounwind readonly {
4entry:
5; THUMB: t1
6  %add.ptr = getelementptr inbounds i32, i32* %ptr, i32 -1
7  %0 = load i32, i32* %add.ptr, align 4
8; THUMB: ldr r{{[0-9]}}, [r0, #-4]
9  ret i32 %0
10}
11
12define i32 @t2(i32* nocapture %ptr) nounwind readonly {
13entry:
14; THUMB: t2
15  %add.ptr = getelementptr inbounds i32, i32* %ptr, i32 -63
16  %0 = load i32, i32* %add.ptr, align 4
17; THUMB: ldr r{{[0-9]}}, [r0, #-252]
18  ret i32 %0
19}
20
21define i32 @t3(i32* nocapture %ptr) nounwind readonly {
22entry:
23; THUMB: t3
24  %add.ptr = getelementptr inbounds i32, i32* %ptr, i32 -64
25  %0 = load i32, i32* %add.ptr, align 4
26; THUMB: ldr r{{[0-9]}}, [r0]
27  ret i32 %0
28}
29
30define zeroext i16 @t4(i16* nocapture %ptr) nounwind readonly {
31entry:
32; THUMB: t4
33  %add.ptr = getelementptr inbounds i16, i16* %ptr, i32 -1
34  %0 = load i16, i16* %add.ptr, align 2
35; THUMB: ldrh r{{[0-9]}}, [r0, #-2]
36  ret i16 %0
37}
38
39define zeroext i16 @t5(i16* nocapture %ptr) nounwind readonly {
40entry:
41; THUMB: t5
42  %add.ptr = getelementptr inbounds i16, i16* %ptr, i32 -127
43  %0 = load i16, i16* %add.ptr, align 2
44; THUMB: ldrh r{{[0-9]}}, [r0, #-254]
45  ret i16 %0
46}
47
48define zeroext i16 @t6(i16* nocapture %ptr) nounwind readonly {
49entry:
50; THUMB: t6
51  %add.ptr = getelementptr inbounds i16, i16* %ptr, i32 -128
52  %0 = load i16, i16* %add.ptr, align 2
53; THUMB: ldrh r{{[0-9]}}, [r0]
54  ret i16 %0
55}
56
57define zeroext i8 @t7(i8* nocapture %ptr) nounwind readonly {
58entry:
59; THUMB: t7
60  %add.ptr = getelementptr inbounds i8, i8* %ptr, i32 -1
61  %0 = load i8, i8* %add.ptr, align 1
62; THUMB: ldrb r{{[0-9]}}, [r0, #-1]
63  ret i8 %0
64}
65
66define zeroext i8 @t8(i8* nocapture %ptr) nounwind readonly {
67entry:
68; THUMB: t8
69  %add.ptr = getelementptr inbounds i8, i8* %ptr, i32 -255
70  %0 = load i8, i8* %add.ptr, align 1
71; THUMB: ldrb r{{[0-9]}}, [r0, #-255]
72  ret i8 %0
73}
74
75define zeroext i8 @t9(i8* nocapture %ptr) nounwind readonly {
76entry:
77; THUMB: t9
78  %add.ptr = getelementptr inbounds i8, i8* %ptr, i32 -256
79  %0 = load i8, i8* %add.ptr, align 1
80; THUMB: ldrb r{{[0-9]}}, [r0]
81  ret i8 %0
82}
83
84define void @t10(i32* nocapture %ptr) nounwind {
85entry:
86; THUMB: t10
87  %add.ptr = getelementptr inbounds i32, 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
93define void @t11(i32* nocapture %ptr) nounwind {
94entry:
95; THUMB: t11
96  %add.ptr = getelementptr inbounds i32, 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
102define void @t12(i32* nocapture %ptr) nounwind {
103entry:
104; THUMB: t12
105  %add.ptr = getelementptr inbounds i32, 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
111define void @t13(i16* nocapture %ptr) nounwind {
112entry:
113; THUMB: t13
114  %add.ptr = getelementptr inbounds i16, 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
120define void @t14(i16* nocapture %ptr) nounwind {
121entry:
122; THUMB: t14
123  %add.ptr = getelementptr inbounds i16, 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
129define void @t15(i16* nocapture %ptr) nounwind {
130entry:
131; THUMB: t15
132  %add.ptr = getelementptr inbounds i16, 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
138define void @t16(i8* nocapture %ptr) nounwind {
139entry:
140; THUMB: t16
141  %add.ptr = getelementptr inbounds i8, 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
147define void @t17(i8* nocapture %ptr) nounwind {
148entry:
149; THUMB: t17
150  %add.ptr = getelementptr inbounds i8, 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
156define void @t18(i8* nocapture %ptr) nounwind {
157entry:
158; THUMB: t18
159  %add.ptr = getelementptr inbounds i8, i8* %ptr, i32 -256
160  store i8 0, i8* %add.ptr, align 1
161; THUMB: strb r{{[0-9]}}, [r0]
162  ret void
163}
164