two-part-imm.ll
7.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=arm-eabi %s -o - | FileCheck %s --check-prefix=CHECK-ARM
; RUN: llc -mtriple=thumb-eabi -mcpu=arm1156t2-s -mattr=+thumb2 %s -o - \
; RUN: | FileCheck %s --check-prefix=CHECK-THUMB2
;; Check how immediates are handled in add/sub.
define i32 @sub0(i32 %0) {
; CHECK-ARM-LABEL: sub0:
; CHECK-ARM: @ %bb.0:
; CHECK-ARM: sub r0, r0, #23
; CHECK-ARM: mov pc, lr
;
; CHECK-THUMB2-LABEL: sub0:
; CHECK-THUMB2: @ %bb.0:
; CHECK-THUMB2: subs r0, #23
; CHECK-THUMB2: bx lr
%2 = sub i32 %0, 23
ret i32 %2
}
define i32 @sub1(i32 %0) {
; CHECK-ARM-LABEL: sub1:
; CHECK-ARM: @ %bb.0:
; CHECK-ARM: ldr r1, .LCPI1_0
; CHECK-ARM: add r0, r0, r1
; CHECK-ARM: mov pc, lr
; CHECK-ARM: .p2align 2
; CHECK-ARM: @ %bb.1:
; CHECK-ARM: .LCPI1_0:
; CHECK-ARM: .long 4294836225 @ 0xfffe0001
;
; CHECK-THUMB2-LABEL: sub1:
; CHECK-THUMB2: @ %bb.0:
; CHECK-THUMB2 movs r1, #1
; CHECK-THUMB2 movt r1, #65534
; CHECK-THUMB2 add r0, r1
; CHECK-THUMB2 bx lr
%2 = sub i32 %0, 131071
ret i32 %2
}
define i32 @sub2(i32 %0) {
; CHECK-ARM-LABEL: sub2:
; CHECK-ARM: @ %bb.0:
; CHECK-ARM: sub r0, r0, #35
; CHECK-ARM: sub r0, r0, #8960
; CHECK-ARM: mov pc, lr
;
; CHECK-THUMB2-LABEL: sub2:
; CHECK-THUMB2: @ %bb.0:
; CHECK-THUMB2: movw r1, #8995
; CHECK-THUMB2: subs r0, r0, r1
; CHECK-THUMB2: bx lr
%2 = sub i32 %0, 8995
ret i32 %2
}
define i32 @sub3(i32 %0) {
; CHECK-ARM-LABEL: sub3:
; CHECK-ARM: @ %bb.0:
; CHECK-ARM: ldr r1, .LCPI3_0
; CHECK-ARM: add r0, r0, r1
; CHECK-ARM: mov pc, lr
; CHECK-ARM: .p2align 2
; CHECK-ARM: @ %bb.1:
; CHECK-ARM: .LCPI3_0:
; CHECK-ARM: .long 4292870571 @ 0xffe001ab
;
; CHECK-THUMB2-LABEL: sub3:
; CHECK-THUMB2: @ %bb.0:
; CHECK-THUMB2: movw r1, #427
; CHECK-THUMB2: movt r1, #65504
; CHECK-THUMB2: add r0, r1
; CHECK-THUMB2: bx lr
%2 = sub i32 %0, 2096725
ret i32 %2
}
define i32 @sub4(i32 %0) {
; CHECK-ARM-LABEL: sub4:
; CHECK-ARM: @ %bb.0:
; CHECK-ARM: ldr r1, .LCPI4_0
; CHECK-ARM: dd r0, r0, r1
; CHECK-ARM: mov pc, lr
; CHECK-ARM: .p2align 2
; CHECK-ARM: @ %bb.1:
; CHECK-ARM: .LCPI4_0:
; CHECK-ARM: .long 4286505147 @ 0xff7ee0bb
;
; CHECK-THUMB2-LABEL: sub4:
; CHECK-THUMB2: @ %bb.0:
; CHECK-THUMB2 movw r1, #57531
; CHECK-THUMB2 movt r1, #65406
; CHECK-THUMB2: add r0, r1
; CHECK-THUMB2: bx lr
%2 = sub i32 %0, 8462149
ret i32 %2
}
define i32 @add0(i32 %0) {
; CHECK-ARM-LABEL: add0:
; CHECK-ARM: @ %bb.0:
; CHECK-ARM: add r0, r0, #23
; CHECK-ARM: mov pc, lr
;
; CHECK-THUMB2-LABEL: add0:
; CHECK-THUMB2: @ %bb.0:
; CHECK-THUMB2: adds r0, #23
; CHECK-THUMB2: bx lr
%2 = add i32 %0, 23
ret i32 %2
}
define i32 @add1(i32 %0) {
; CHECK-ARM-LABEL: add1:
; CHECK-ARM: @ %bb.0:
; CHECK-ARM ldr r1, .LCPI4_0
; CHECK-ARM add r0, r0, r1
; CHECK-ARM mov pc, lr
; CHECK-ARM .p2align 2
; CHECK-ARM @ %bb.1:
; CHECK-ARM .LCPI4_0:
; CHECK-ARM .long 131071 @ 0x1ffff
;
; CHECK-THUMB2-LABEL: add1:
; CHECK-THUMB2: @ %bb.0:
; CHECK-THUMB2: movw r1, #65535
; CHECK-THUMB2: movt r1, #1
; CHECK-THUMB2: add r0, r1
; CHECK-THUMB2: bx lr
%2 = add i32 %0, 131071
ret i32 %2
}
define i32 @add2(i32 %0) {
; CHECK-ARM-LABEL: add2:
; CHECK-ARM: @ %bb.0:
; CHECK-ARM: add r0, r0, #8960
; CHECK-ARM: add r0, r0, #2293760
; CHECK-ARM: mov pc, lr
;
; CHECK-THUMB2-LABEL: add2:
; CHECK-THUMB2: @ %bb.0:
; CHECK-THUMB2: add.w r0, r0, #2293760
; CHECK-THUMB2: add.w r0, r0, #8960
; CHECK-THUMB2: bx lr
%2 = add i32 %0, 2302720
ret i32 %2
}
define i32 @add3(i32 %0) {
; CHECK-ARM-LABEL: add3:
; CHECK-ARM: @ %bb.0:
; CHECK-ARM: ldr r1, .LCPI8_0
; CHECK-ARM: add r0, r0, r1
; CHECK-ARM: mov pc, lr
; CHECK-ARM: .p2align 2
; CHECK-ARM: @ %bb.1:
; CHECK-ARM: .LCPI8_0:
; CHECK-ARM: .long 2096725 @ 0x1ffe55
;
; CHECK-THUMB2-LABEL: add3:
; CHECK-THUMB2: @ %bb.0:
; CHECK-THUMB2: movw r1, #65109
; CHECK-THUMB2: movt r1, #31
; CHECK-THUMB2: add r0, r1
; CHECK-THUMB2: bx lr
%2 = add i32 %0, 2096725
ret i32 %2
}
define i32 @add4(i32 %0) {
; CHECK-ARM-LABEL: add4:
; CHECK-ARM: @ %bb.0:
; CHECK-ARM: ldr r1, .LCPI9_0
; CHECK-ARM: add r0, r0, r1
; CHECK-ARM: mov pc, lr
; CHECK-ARM: .p2align 2
; CHECK-ARM: @ %bb.1:
; CHECK-ARM: .LCPI9_0:
; CHECK-ARM: .long 8462149 @ 0x811f45
;
; CHECK-THUMB2-LABEL: add4:
; CHECK-THUMB2: @ %bb.0:
; CHECK-THUMB2: movw r1, #8005
; CHECK-THUMB2: movt r1, #129
; CHECK-THUMB2: add r0, r1
; CHECK-THUMB2: bx lr
%2 = add i32 %0, 8462149
ret i32 %2
}
define i32 @orr0(i32 %0) {
; CHECK-ARM-LABEL: orr0:
; CHECK-ARM: @ %bb.0:
; CHECK-ARM: orr r0, r0, #8960
; CHECK-ARM: orr r0, r0, #2293760
; CHECK-ARM: mov pc, lr
;
; CHECK-THUMB2-LABEL: orr0:
; CHECK-THUMB2: @ %bb.0:
; CHECK-THUMB2: orr r0, r0, #2293760
; CHECK-THUMB2: orr r0, r0, #8960
; CHECK-THUMB2: bx lr
%2 = or i32 %0, 2302720
ret i32 %2
}
define i32 @orr1(i32 %0) {
; CHECK-ARM-LABEL: orr1:
; CHECK-ARM: @ %bb.0:
; CHECK-ARM: orr r0, r0, #23
; CHECK-ARM: mov pc, lr
;
; CHECK-THUMB2-LABEL: orr1:
; CHECK-THUMB2: @ %bb.0:
; CHECK-THUMB2: orr r0, r0, #23
; CHECK-THUMB2: bx lr
%2 = or i32 %0, 23
ret i32 %2
}
define i32 @orr2(i32 %0) {
; CHECK-ARM-LABEL: orr2:
; CHECK-ARM: @ %bb.0:
; CHECK-ARM: ldr r1, .LCPI12_0
; CHECK-ARM: orr r0, r0, r1
; CHECK-ARM: mov pc, lr
; CHECK-ARM: .p2align 2
; CHECK-ARM: @ %bb.1:
; CHECK-ARM: .LCPI12_0:
; CHECK-ARM: .long 131071 @ 0x1ffff
;
; CHECK-THUMB2-LABEL: orr2:
; CHECK-THUMB2: @ %bb.0:
; CHECK-THUMB2 movs r1, #1
; CHECK-THUMB2 movt r1, #65534
; CHECK-THUMB2 orr r0, r1
; CHECK-THUMB2 bx lr
%2 = or i32 %0, 131071
ret i32 %2
}
define i32 @eor0(i32 %0) {
; CHECK-ARM-LABEL: eor0:
; CHECK-ARM: @ %bb.0:
; CHECK-ARM: eor r0, r0, #8960
; CHECK-ARM: eor r0, r0, #2293760
; CHECK-ARM: mov pc, lr
;
; CHECK-THUMB2-LABEL: eor0:
; CHECK-THUMB2: @ %bb.0:
; CHECK-THUMB2: eor r0, r0, #2293760
; CHECK-THUMB2: eor r0, r0, #8960
; CHECK-THUMB2: bx lr
%2 = xor i32 %0, 2302720
ret i32 %2
}
define i32 @eor1(i32 %0) {
; CHECK-ARM-LABEL: eor1:
; CHECK-ARM: @ %bb.0:
; CHECK-ARM: eor r0, r0, #23
; CHECK-ARM: mov pc, lr
;
; CHECK-THUMB2-LABEL: eor1:
; CHECK-THUMB2: @ %bb.0:
; CHECK-THUMB2: eor r0, r0, #23
; CHECK-THUMB2: bx lr
%2 = xor i32 %0, 23
ret i32 %2
}
define i32 @eor2(i32 %0) {
; CHECK-ARM-LABEL: eor2:
; CHECK-ARM: @ %bb.0:
; CHECK-ARM: ldr r1, .LCPI15_0
; CHECK-ARM: eor r0, r0, r1
; CHECK-ARM: mov pc, lr
; CHECK-ARM: .p2align 2
; CHECK-ARM: @ %bb.1:
; CHECK-ARM: .LCPI15_0:
; CHECK-ARM: .long 131071 @ 0x1ffff
;
; CHECK-THUMB2-LABEL: eor2:
; CHECK-THUMB2: @ %bb.0:
; CHECK-THUMB2 movs r1, #1
; CHECK-THUMB2 movt r1, #65534
; CHECK-THUMB2 eor r0, r1
; CHECK-THUMB2 bx lr
%2 = xor i32 %0, 131071
ret i32 %2
}