1 @ RUN
: llvm-mc
-triple
=thumbv7-apple-darwin
-mcpu
=cortex-a8
-show-encoding
< %s | FileCheck
%s
3 @
------------------------------------------------------------------------------
4 @ unconditional branches accept narrow suffix
and encode to short encodings
5 @
------------------------------------------------------------------------------
10 @ CHECK
: b #-2048 @ encoding: [0x00,0xe4]
11 @ CHECK
: b #2046 @ encoding: [0xff,0xe3]
13 @
------------------------------------------------------------------------------
14 @ unconditional branches accept wide suffix
and encode to wide encodings
15 @
------------------------------------------------------------------------------
22 @ CHECK
: b.w
#-2048 @ encoding: [0xff,0xf7,0x00,0xbc]
23 @ CHECK
: b.w
#2046 @ encoding: [0x00,0xf0,0xff,0xbb]
24 @ CHECK
: b.w
#-1677216 @ encoding: [0x66,0xf6,0x30,0xbc]
25 @ CHECK
: b.w
#1677214 @ encoding: [0x99,0xf1,0xcf,0xbb]
27 @
------------------------------------------------------------------------------
28 @ unconditional branches without width suffix encode depending of offset size
29 @
------------------------------------------------------------------------------
38 @ CHECK
: b #-2048 @ encoding: [0x00,0xe4]
39 @ CHECK
: b #2046 @ encoding: [0xff,0xe3]
40 @ CHECK
: b.w
#-2050 @ encoding: [0xff,0xf7,0xff,0xbb]
41 @ CHECK
: b.w
#2048 @ encoding: [0x00,0xf0,0x00,0xbc]
42 @ CHECK
: b.w
#-1677216 @ encoding: [0x66,0xf6,0x30,0xbc]
43 @ CHECK
: b.w
#1677214 @ encoding: [0x99,0xf1,0xcf,0xbb]
45 @
------------------------------------------------------------------------------
46 @ unconditional branches with width narrow suffix in IT block
47 @
------------------------------------------------------------------------------
54 @ CHECK
: it eq @ encoding
: [0x08,0xbf]
55 @ CHECK
: beq #-2048 @ encoding: [0x00,0xe4]
56 @ CHECK
: it ne @ encoding
: [0x18,0xbf]
57 @ CHECK
: bne #-2046 @ encoding: [0x01,0xe4]
59 @
------------------------------------------------------------------------------
60 @ unconditional branches with wide suffix in IT block
61 @
------------------------------------------------------------------------------
72 @ CHECK
: it gt @ encoding
: [0xc8,0xbf]
73 @ CHECK
: bgt.w
#-2048 @ encoding: [0xff,0xf7,0x00,0xbc]
74 @ CHECK
: it le @ encoding
: [0xd8,0xbf]
75 @ CHECK
: ble.w
#2046 @ encoding: [0x00,0xf0,0xff,0xbb]
76 @ CHECK
: it ge @ encoding
: [0xa8,0xbf]
77 @ CHECK
: bge.w
#-1677216 @ encoding: [0x66,0xf6,0x30,0xbc]
78 @ CHECK
: it lt @ encoding
: [0xb8,0xbf]
79 @ CHECK
: blt.w
#1677214 @ encoding: [0x99,0xf1,0xcf,0xbb]
81 @
------------------------------------------------------------------------------
82 @ conditional branches accept narrow suffix
and encode to short encodings
83 @
------------------------------------------------------------------------------
88 @ CHECK
: beq #-256 @ encoding: [0x80,0xd0]
89 @ CHECK
: bne #254 @ encoding: [0x7f,0xd1]
91 @
------------------------------------------------------------------------------
92 @ unconditional branches accept wide suffix
and encode to wide encodings
93 @
------------------------------------------------------------------------------
103 @ CHECK
: bl #256 @ encoding: [0x00,0xf0,0x80,0xf8]
104 @ CHECK
: it ne @ encoding
: [0x18,0xbf]
105 @ CHECK
: blne
#256 @ encoding: [0x00,0xf0,0x80,0xf8]
106 @ CHECK
: bmi.w
#-256 @ encoding: [0x3f,0xf5,0x80,0xaf]
107 @ CHECK
: bne.w
#254 @ encoding: [0x40,0xf0,0x7f,0x80]
108 @ CHECK
: blt.w
#-1048576 @ encoding: [0xc0,0xf6,0x00,0x80]
109 @ CHECK
: bge.w
#1048574 @ encoding: [0xbf,0xf2,0xff,0xaf]
111 @
------------------------------------------------------------------------------
112 @ unconditional branches without width suffix encode depending of offset size
113 @
------------------------------------------------------------------------------
122 @ CHECK
: bne #-256 @ encoding: [0x80,0xd1]
123 @ CHECK
: bgt #254 @ encoding: [0x7f,0xdc]
124 @ CHECK
: bne.w
#-258 @ encoding: [0x7f,0xf4,0x7f,0xaf]
125 @ CHECK
: bgt.w
#256 @ encoding: [0x00,0xf3,0x80,0x80]
126 @ CHECK
: bne.w
#-1048576 @ encoding: [0x40,0xf4,0x00,0x80]
127 @ CHECK
: bgt.w
#1048574 @ encoding: [0x3f,0xf3,0xff,0xaf]
129 @
------------------------------------------------------------------------------
130 @ same branch insturction encoding to conditional
or unconditional depending
131 @ on whether it is in an IT block
or not
132 @
------------------------------------------------------------------------------
138 @ CHECK
: it eq @ encoding
: [0x08,0xbf]
139 @ CHECK
: addeq
r0, r1 @ encoding
: [0x08,0x44]
140 @ CHECK
: bne #128 @ encoding: [0x40,0xd1]
146 @ CHECK
: ite eq @ encoding
: [0x0c,0xbf]
147 @ CHECK
: addeq
r0, r1 @ encoding
: [0x08,0x44]
148 @ CHECK
: bne #128 @ encoding: [0x40,0xe0]
150 @ RUN
: llvm-mc
-triple
=thumbv7-apple-darwin
-mcpu
=cortex-a8
-show-encoding
< %s | FileCheck
%s
152 @
------------------------------------------------------------------------------
153 @ unconditional branches accept narrow suffix
and encode to short encodings
154 @
------------------------------------------------------------------------------
159 @ CHECK
: b #-2048 @ encoding: [0x00,0xe4]
160 @ CHECK
: b #2046 @ encoding: [0xff,0xe3]
162 @
------------------------------------------------------------------------------
163 @ unconditional branches accept wide suffix
and encode to wide encodings
164 @
------------------------------------------------------------------------------
171 @ CHECK
: b.w
#-2048 @ encoding: [0xff,0xf7,0x00,0xbc]
172 @ CHECK
: b.w
#2046 @ encoding: [0x00,0xf0,0xff,0xbb]
173 @ CHECK
: b.w
#-1677216 @ encoding: [0x66,0xf6,0x30,0xbc]
174 @ CHECK
: b.w
#1677214 @ encoding: [0x99,0xf1,0xcf,0xbb]
176 @
------------------------------------------------------------------------------
177 @ unconditional branches without width suffix encode depending of offset size
178 @
------------------------------------------------------------------------------
187 @ CHECK
: b #-2048 @ encoding: [0x00,0xe4]
188 @ CHECK
: b #2046 @ encoding: [0xff,0xe3]
189 @ CHECK
: b.w
#-2050 @ encoding: [0xff,0xf7,0xff,0xbb]
190 @ CHECK
: b.w
#2048 @ encoding: [0x00,0xf0,0x00,0xbc]
191 @ CHECK
: b.w
#-1677216 @ encoding: [0x66,0xf6,0x30,0xbc]
192 @ CHECK
: b.w
#1677214 @ encoding: [0x99,0xf1,0xcf,0xbb]
194 @
------------------------------------------------------------------------------
195 @ unconditional branches with width narrow suffix in IT block
196 @
------------------------------------------------------------------------------
203 @ CHECK
: it eq @ encoding
: [0x08,0xbf]
204 @ CHECK
: beq #-2048 @ encoding: [0x00,0xe4]
205 @ CHECK
: it ne @ encoding
: [0x18,0xbf]
206 @ CHECK
: bne #-2046 @ encoding: [0x01,0xe4]
208 @
------------------------------------------------------------------------------
209 @ unconditional branches with wide suffix in IT block
210 @
------------------------------------------------------------------------------
221 @ CHECK
: it gt @ encoding
: [0xc8,0xbf]
222 @ CHECK
: bgt.w
#-2048 @ encoding: [0xff,0xf7,0x00,0xbc]
223 @ CHECK
: it le @ encoding
: [0xd8,0xbf]
224 @ CHECK
: ble.w
#2046 @ encoding: [0x00,0xf0,0xff,0xbb]
225 @ CHECK
: it ge @ encoding
: [0xa8,0xbf]
226 @ CHECK
: bge.w
#-1677216 @ encoding: [0x66,0xf6,0x30,0xbc]
227 @ CHECK
: it lt @ encoding
: [0xb8,0xbf]
228 @ CHECK
: blt.w
#1677214 @ encoding: [0x99,0xf1,0xcf,0xbb]
230 @
------------------------------------------------------------------------------
231 @ conditional branches accept narrow suffix
and encode to short encodings
232 @
------------------------------------------------------------------------------
237 @ CHECK
: beq #-256 @ encoding: [0x80,0xd0]
238 @ CHECK
: bne #254 @ encoding: [0x7f,0xd1]
240 @
------------------------------------------------------------------------------
241 @ unconditional branches accept wide suffix
and encode to wide encodings
242 @
------------------------------------------------------------------------------
249 @ CHECK
: bmi.w
#-256 @ encoding: [0x3f,0xf5,0x80,0xaf]
250 @ CHECK
: bne.w
#254 @ encoding: [0x40,0xf0,0x7f,0x80]
251 @ CHECK
: blt.w
#-1048576 @ encoding: [0xc0,0xf6,0x00,0x80]
252 @ CHECK
: bge.w
#1048574 @ encoding: [0xbf,0xf2,0xff,0xaf]
254 @
------------------------------------------------------------------------------
255 @ unconditional branches without width suffix encode depending of offset size
256 @
------------------------------------------------------------------------------
265 @ CHECK
: bne #-256 @ encoding: [0x80,0xd1]
266 @ CHECK
: bgt #254 @ encoding: [0x7f,0xdc]
267 @ CHECK
: bne.w
#-258 @ encoding: [0x7f,0xf4,0x7f,0xaf]
268 @ CHECK
: bgt.w
#256 @ encoding: [0x00,0xf3,0x80,0x80]
269 @ CHECK
: bne.w
#-1048576 @ encoding: [0x40,0xf4,0x00,0x80]
270 @ CHECK
: bgt.w
#1048574 @ encoding: [0x3f,0xf3,0xff,0xaf]
272 @
------------------------------------------------------------------------------
273 @ same branch insturction encoding to conditional
or unconditional depending
274 @ on whether it is in an IT block
or not
275 @
------------------------------------------------------------------------------
281 @ CHECK
: it eq @ encoding
: [0x08,0xbf]
282 @ CHECK
: addeq
r0, r1 @ encoding
: [0x08,0x44]
283 @ CHECK
: bne #128 @ encoding: [0x40,0xd1]
289 @ CHECK
: ite eq @ encoding
: [0x0c,0xbf]
290 @ CHECK
: addeq
r0, r1 @ encoding
: [0x08,0x44]
291 @ CHECK
: bne #128 @ encoding: [0x40,0xe0]
294 @
------------------------------------------------------------------------------
295 @ Branch targets destined for ARM mode must
== 0 (mod
4), otherwise
(mod
2).
296 @
------------------------------------------------------------------------------
302 @ N.b. destination is
"align(PC, 4) + imm" so imm is still
4-byte
303 @ aligned even though current PC may
not and destination must be.
306 @ CHECK
: b #2 @ encoding: [0x01,0xe0]
307 @ CHECK
: bl #2 @ encoding: [0x00,0xf0,0x01,0xf8]
308 @ CHECK
: beq #2 @ encoding: [0x01,0xd0]
309 @ CHECK
: cbz
r0, #2 @ encoding: [0x08,0xb1]
310 @ CHECK
: blx
#4 @ encoding: [0x00,0xf0,0x02,0xe8]