@ RUN: llvm-mc -triple=thumbv7-apple-darwin -mcpu=cortex-a8 -show-encoding < %s | FileCheck %s
@------------------------------------------------------------------------------
@ unconditional branches accept narrow suffix and encode to short encodings
@------------------------------------------------------------------------------
b.n b.n
@ CHECK: b @ CHECK: b
@------------------------------------------------------------------------------
@ unconditional branches accept wide suffix and encode to wide encodings
@------------------------------------------------------------------------------
b.w b.w b.w b.w
@ CHECK: b.w @ CHECK: b.w @ CHECK: b.w @ CHECK: b.w
@------------------------------------------------------------------------------
@ unconditional branches without width suffix encode depending of offset size
@------------------------------------------------------------------------------
b b b b b b
@ CHECK: b @ CHECK: b @ CHECK: b.w @ CHECK: b.w @ CHECK: b.w @ CHECK: b.w
@------------------------------------------------------------------------------
@ unconditional branches with width narrow suffix in IT block
@------------------------------------------------------------------------------
it eq
beq.n it ne
bne.n
@ CHECK: it eq @ encoding: [0x08,0xbf]
@ CHECK: beq @ CHECK: it ne @ encoding: [0x18,0xbf]
@ CHECK: bne
@------------------------------------------------------------------------------
@ unconditional branches with wide suffix in IT block
@------------------------------------------------------------------------------
it gt
bgt.w it le
ble.w it ge
bge.w it lt
blt.w
@ CHECK: it gt @ encoding: [0xc8,0xbf]
@ CHECK: bgt.w @ CHECK: it le @ encoding: [0xd8,0xbf]
@ CHECK: ble.w @ CHECK: it ge @ encoding: [0xa8,0xbf]
@ CHECK: bge.w @ CHECK: it lt @ encoding: [0xb8,0xbf]
@ CHECK: blt.w
@------------------------------------------------------------------------------
@ conditional branches accept narrow suffix and encode to short encodings
@------------------------------------------------------------------------------
beq.n bne.n
@ CHECK: beq @ CHECK: bne
@------------------------------------------------------------------------------
@ unconditional branches accept wide suffix and encode to wide encodings
@------------------------------------------------------------------------------
bl.w it ne
blne.w bmi.w bne.w blt.w bge.w
@ CHECK: bl @ CHECK: it ne @ encoding: [0x18,0xbf]
@ CHECK: blne @ CHECK: bmi.w @ CHECK: bne.w @ CHECK: blt.w @ CHECK: bge.w
@------------------------------------------------------------------------------
@ unconditional branches without width suffix encode depending of offset size
@------------------------------------------------------------------------------
bne bgt bne bgt bne bgt
@ CHECK: bne @ CHECK: bgt @ CHECK: bne.w @ CHECK: bgt.w @ CHECK: bne.w @ CHECK: bgt.w
@------------------------------------------------------------------------------
@ same branch insturction encoding to conditional or unconditional depending
@ on whether it is in an IT block or not
@------------------------------------------------------------------------------
it eq
addeq r0, r1
bne
@ CHECK: it eq @ encoding: [0x08,0xbf]
@ CHECK: addeq r0, r1 @ encoding: [0x08,0x44]
@ CHECK: bne
ite eq
addeq r0, r1
bne
@ CHECK: ite eq @ encoding: [0x0c,0xbf]
@ CHECK: addeq r0, r1 @ encoding: [0x08,0x44]
@ CHECK: bne
@ RUN: llvm-mc -triple=thumbv7-apple-darwin -mcpu=cortex-a8 -show-encoding < %s | FileCheck %s
@------------------------------------------------------------------------------
@ unconditional branches accept narrow suffix and encode to short encodings
@------------------------------------------------------------------------------
b.n b.n
@ CHECK: b @ CHECK: b
@------------------------------------------------------------------------------
@ unconditional branches accept wide suffix and encode to wide encodings
@------------------------------------------------------------------------------
b.w b.w b.w b.w
@ CHECK: b.w @ CHECK: b.w @ CHECK: b.w @ CHECK: b.w
@------------------------------------------------------------------------------
@ unconditional branches without width suffix encode depending of offset size
@------------------------------------------------------------------------------
b b b b b b
@ CHECK: b @ CHECK: b @ CHECK: b.w @ CHECK: b.w @ CHECK: b.w @ CHECK: b.w
@------------------------------------------------------------------------------
@ unconditional branches with width narrow suffix in IT block
@------------------------------------------------------------------------------
it eq
beq.n it ne
bne.n
@ CHECK: it eq @ encoding: [0x08,0xbf]
@ CHECK: beq @ CHECK: it ne @ encoding: [0x18,0xbf]
@ CHECK: bne
@------------------------------------------------------------------------------
@ unconditional branches with wide suffix in IT block
@------------------------------------------------------------------------------
it gt
bgt.w it le
ble.w it ge
bge.w it lt
blt.w
@ CHECK: it gt @ encoding: [0xc8,0xbf]
@ CHECK: bgt.w @ CHECK: it le @ encoding: [0xd8,0xbf]
@ CHECK: ble.w @ CHECK: it ge @ encoding: [0xa8,0xbf]
@ CHECK: bge.w @ CHECK: it lt @ encoding: [0xb8,0xbf]
@ CHECK: blt.w
@------------------------------------------------------------------------------
@ conditional branches accept narrow suffix and encode to short encodings
@------------------------------------------------------------------------------
beq.n bne.n
@ CHECK: beq @ CHECK: bne
@------------------------------------------------------------------------------
@ unconditional branches accept wide suffix and encode to wide encodings
@------------------------------------------------------------------------------
bmi.w bne.w blt.w bge.w
@ CHECK: bmi.w @ CHECK: bne.w @ CHECK: blt.w @ CHECK: bge.w
@------------------------------------------------------------------------------
@ unconditional branches without width suffix encode depending of offset size
@------------------------------------------------------------------------------
bne bgt bne bgt bne bgt
@ CHECK: bne @ CHECK: bgt @ CHECK: bne.w @ CHECK: bgt.w @ CHECK: bne.w @ CHECK: bgt.w
@------------------------------------------------------------------------------
@ same branch insturction encoding to conditional or unconditional depending
@ on whether it is in an IT block or not
@------------------------------------------------------------------------------
it eq
addeq r0, r1
bne
@ CHECK: it eq @ encoding: [0x08,0xbf]
@ CHECK: addeq r0, r1 @ encoding: [0x08,0x44]
@ CHECK: bne
ite eq
addeq r0, r1
bne
@ CHECK: ite eq @ encoding: [0x0c,0xbf]
@ CHECK: addeq r0, r1 @ encoding: [0x08,0x44]
@ CHECK: bne
@------------------------------------------------------------------------------
@ Branch targets destined for ARM mode must == 0 (mod 4), otherwise (mod 2).
@------------------------------------------------------------------------------
b bl beq cbz r0, @ N.b. destination is "align(PC, 4) + imm" so imm is still 4-byte
@ aligned even though current PC may not and destination must be.
blx
@ CHECK: b @ CHECK: bl @ CHECK: beq @ CHECK: cbz r0, @ CHECK: blx