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 @
------------------------------------------------------------------------------
100 @ CHECK
: bmi.w
#-256 @ encoding: [0x3f,0xf5,0x80,0xaf]
101 @ CHECK
: bne.w
#254 @ encoding: [0x40,0xf0,0x7f,0x80]
102 @ CHECK
: blt.w
#-1048576 @ encoding: [0xc0,0xf6,0x00,0x80]
103 @ CHECK
: bge.w
#1048574 @ encoding: [0xbf,0xf2,0xff,0xaf]
105 @
------------------------------------------------------------------------------
106 @ unconditional branches without width suffix encode depending of offset size
107 @
------------------------------------------------------------------------------
116 @ CHECK
: bne #-256 @ encoding: [0x80,0xd1]
117 @ CHECK
: bgt #254 @ encoding: [0x7f,0xdc]
118 @ CHECK
: bne.w
#-258 @ encoding: [0x7f,0xf4,0x7f,0xaf]
119 @ CHECK
: bgt.w
#256 @ encoding: [0x00,0xf3,0x80,0x80]
120 @ CHECK
: bne.w
#-1048576 @ encoding: [0x40,0xf4,0x00,0x80]
121 @ CHECK
: bgt.w
#1048574 @ encoding: [0x3f,0xf3,0xff,0xaf]
123 @
------------------------------------------------------------------------------
124 @ same branch insturction encoding to conditional
or unconditional depending
125 @ on whether it is in an IT block
or not
126 @
------------------------------------------------------------------------------
132 @ CHECK
: it eq @ encoding
: [0x08,0xbf]
133 @ CHECK
: addeq
r0, r1 @ encoding
: [0x08,0x44]
134 @ CHECK
: bne #128 @ encoding: [0x40,0xd1]
140 @ CHECK
: ite eq @ encoding
: [0x0c,0xbf]
141 @ CHECK
: addeq
r0, r1 @ encoding
: [0x08,0x44]
142 @ CHECK
: bne #128 @ encoding: [0x40,0xe0]
144 @ RUN
: llvm-mc
-triple
=thumbv7-apple-darwin
-mcpu
=cortex-a8
-show-encoding
< %s | FileCheck
%s
146 @
------------------------------------------------------------------------------
147 @ unconditional branches accept narrow suffix
and encode to short encodings
148 @
------------------------------------------------------------------------------
153 @ CHECK
: b #-2048 @ encoding: [0x00,0xe4]
154 @ CHECK
: b #2046 @ encoding: [0xff,0xe3]
156 @
------------------------------------------------------------------------------
157 @ unconditional branches accept wide suffix
and encode to wide encodings
158 @
------------------------------------------------------------------------------
165 @ CHECK
: b.w
#-2048 @ encoding: [0xff,0xf7,0x00,0xbc]
166 @ CHECK
: b.w
#2046 @ encoding: [0x00,0xf0,0xff,0xbb]
167 @ CHECK
: b.w
#-1677216 @ encoding: [0x66,0xf6,0x30,0xbc]
168 @ CHECK
: b.w
#1677214 @ encoding: [0x99,0xf1,0xcf,0xbb]
170 @
------------------------------------------------------------------------------
171 @ unconditional branches without width suffix encode depending of offset size
172 @
------------------------------------------------------------------------------
181 @ CHECK
: b #-2048 @ encoding: [0x00,0xe4]
182 @ CHECK
: b #2046 @ encoding: [0xff,0xe3]
183 @ CHECK
: b.w
#-2050 @ encoding: [0xff,0xf7,0xff,0xbb]
184 @ CHECK
: b.w
#2048 @ encoding: [0x00,0xf0,0x00,0xbc]
185 @ CHECK
: b.w
#-1677216 @ encoding: [0x66,0xf6,0x30,0xbc]
186 @ CHECK
: b.w
#1677214 @ encoding: [0x99,0xf1,0xcf,0xbb]
188 @
------------------------------------------------------------------------------
189 @ unconditional branches with width narrow suffix in IT block
190 @
------------------------------------------------------------------------------
197 @ CHECK
: it eq @ encoding
: [0x08,0xbf]
198 @ CHECK
: beq #-2048 @ encoding: [0x00,0xe4]
199 @ CHECK
: it ne @ encoding
: [0x18,0xbf]
200 @ CHECK
: bne #-2046 @ encoding: [0x01,0xe4]
202 @
------------------------------------------------------------------------------
203 @ unconditional branches with wide suffix in IT block
204 @
------------------------------------------------------------------------------
215 @ CHECK
: it gt @ encoding
: [0xc8,0xbf]
216 @ CHECK
: bgt.w
#-2048 @ encoding: [0xff,0xf7,0x00,0xbc]
217 @ CHECK
: it le @ encoding
: [0xd8,0xbf]
218 @ CHECK
: ble.w
#2046 @ encoding: [0x00,0xf0,0xff,0xbb]
219 @ CHECK
: it ge @ encoding
: [0xa8,0xbf]
220 @ CHECK
: bge.w
#-1677216 @ encoding: [0x66,0xf6,0x30,0xbc]
221 @ CHECK
: it lt @ encoding
: [0xb8,0xbf]
222 @ CHECK
: blt.w
#1677214 @ encoding: [0x99,0xf1,0xcf,0xbb]
224 @
------------------------------------------------------------------------------
225 @ conditional branches accept narrow suffix
and encode to short encodings
226 @
------------------------------------------------------------------------------
231 @ CHECK
: beq #-256 @ encoding: [0x80,0xd0]
232 @ CHECK
: bne #254 @ encoding: [0x7f,0xd1]
234 @
------------------------------------------------------------------------------
235 @ unconditional branches accept wide suffix
and encode to wide encodings
236 @
------------------------------------------------------------------------------
243 @ CHECK
: bmi.w
#-256 @ encoding: [0x3f,0xf5,0x80,0xaf]
244 @ CHECK
: bne.w
#254 @ encoding: [0x40,0xf0,0x7f,0x80]
245 @ CHECK
: blt.w
#-1048576 @ encoding: [0xc0,0xf6,0x00,0x80]
246 @ CHECK
: bge.w
#1048574 @ encoding: [0xbf,0xf2,0xff,0xaf]
248 @
------------------------------------------------------------------------------
249 @ unconditional branches without width suffix encode depending of offset size
250 @
------------------------------------------------------------------------------
259 @ CHECK
: bne #-256 @ encoding: [0x80,0xd1]
260 @ CHECK
: bgt #254 @ encoding: [0x7f,0xdc]
261 @ CHECK
: bne.w
#-258 @ encoding: [0x7f,0xf4,0x7f,0xaf]
262 @ CHECK
: bgt.w
#256 @ encoding: [0x00,0xf3,0x80,0x80]
263 @ CHECK
: bne.w
#-1048576 @ encoding: [0x40,0xf4,0x00,0x80]
264 @ CHECK
: bgt.w
#1048574 @ encoding: [0x3f,0xf3,0xff,0xaf]
266 @
------------------------------------------------------------------------------
267 @ same branch insturction encoding to conditional
or unconditional depending
268 @ on whether it is in an IT block
or not
269 @
------------------------------------------------------------------------------
275 @ CHECK
: it eq @ encoding
: [0x08,0xbf]
276 @ CHECK
: addeq
r0, r1 @ encoding
: [0x08,0x44]
277 @ CHECK
: bne #128 @ encoding: [0x40,0xd1]
283 @ CHECK
: ite eq @ encoding
: [0x0c,0xbf]
284 @ CHECK
: addeq
r0, r1 @ encoding
: [0x08,0x44]
285 @ CHECK
: bne #128 @ encoding: [0x40,0xe0]
288 @
------------------------------------------------------------------------------
289 @ Branch targets destined for ARM mode must
== 0 (mod
4), otherwise
(mod
2).
290 @
------------------------------------------------------------------------------
296 @ N.b. destination is
"align(PC, 4) + imm" so imm is still
4-byte
297 @ aligned even though current PC may
not and destination must be.
300 @ CHECK
: b #2 @ encoding: [0x01,0xe0]
301 @ CHECK
: bl #2 @ encoding: [0x00,0xf0,0x01,0xf8]
302 @ CHECK
: beq #2 @ encoding: [0x01,0xd0]
303 @ CHECK
: cbz
r0, #2 @ encoding: [0x08,0xb1]
304 @ CHECK
: blx
#4 @ encoding: [0x00,0xf0,0x02,0xe8]