2011-08-16 21:34:08 +00:00
|
|
|
@ RUN: llvm-mc -triple=thumbv6-apple-darwin -show-encoding < %s | FileCheck %s
|
|
|
|
.syntax unified
|
|
|
|
.globl _func
|
|
|
|
|
|
|
|
@ Check that the assembler can handle the documented syntax from the ARM ARM.
|
|
|
|
@ For complex constructs like shifter operands, check more thoroughly for them
|
|
|
|
@ once then spot check that following instructions accept the form generally.
|
|
|
|
@ This gives us good coverage while keeping the overall size of the test
|
|
|
|
@ more reasonable.
|
|
|
|
|
|
|
|
_func:
|
|
|
|
@ CHECK: _func
|
|
|
|
|
2011-08-17 17:55:28 +00:00
|
|
|
@------------------------------------------------------------------------------
|
|
|
|
@ ADC (register)
|
|
|
|
@------------------------------------------------------------------------------
|
|
|
|
adcs r4, r6
|
|
|
|
|
|
|
|
@ CHECK: adcs r4, r6 @ encoding: [0x74,0x41]
|
|
|
|
|
|
|
|
|
2011-08-16 23:57:34 +00:00
|
|
|
@------------------------------------------------------------------------------
|
|
|
|
@ ADD (immediate)
|
|
|
|
@------------------------------------------------------------------------------
|
|
|
|
adds r1, r2, #3
|
|
|
|
adds r2, #3
|
|
|
|
adds r2, #8
|
|
|
|
|
|
|
|
@ CHECK: adds r1, r2, #3 @ encoding: [0xd1,0x1c]
|
|
|
|
@ CHECK: adds r2, r2, #3 @ encoding: [0xd2,0x1c]
|
|
|
|
@ CHECK: adds r2, #8 @ encoding: [0x08,0x32]
|
|
|
|
|
|
|
|
|
2011-08-16 21:34:08 +00:00
|
|
|
@------------------------------------------------------------------------------
|
|
|
|
@ ADD (register)
|
|
|
|
@------------------------------------------------------------------------------
|
|
|
|
adds r1, r2, r3
|
|
|
|
add r2, r8
|
|
|
|
|
|
|
|
@ CHECK: adds r1, r2, r3 @ encoding: [0xd1,0x18]
|
2011-08-17 17:46:01 +00:00
|
|
|
@ CHECK: add r2, r8 @ encoding: [0x42,0x44]
|
2011-08-17 20:35:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
@------------------------------------------------------------------------------
|
|
|
|
@ FIXME: ADD (SP plus immediate)
|
|
|
|
@------------------------------------------------------------------------------
|
|
|
|
@------------------------------------------------------------------------------
|
|
|
|
@ FIXME: ADD (SP plus register)
|
|
|
|
@------------------------------------------------------------------------------
|
2011-08-17 20:37:40 +00:00
|
|
|
|
|
|
|
|
|
|
|
@------------------------------------------------------------------------------
|
|
|
|
@ ADR
|
|
|
|
@------------------------------------------------------------------------------
|
|
|
|
adr r2, _baz
|
|
|
|
|
|
|
|
@ CHECK: adr r2, _baz @ encoding: [A,0xa2]
|
|
|
|
@ fixup A - offset: 0, value: _baz, kind: fixup_thumb_adr_pcrel_10
|
2011-08-17 22:49:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
@------------------------------------------------------------------------------
|
|
|
|
@ ASR (immediate)
|
|
|
|
@------------------------------------------------------------------------------
|
|
|
|
asrs r2, r3, #32
|
|
|
|
asrs r2, r3, #5
|
|
|
|
asrs r2, r3, #1
|
|
|
|
|
|
|
|
@ CHECK: asrs r2, r3, #32 @ encoding: [0x1a,0x10]
|
|
|
|
@ CHECK: asrs r2, r3, #5 @ encoding: [0x5a,0x11]
|
|
|
|
@ CHECK: asrs r2, r3, #1 @ encoding: [0x5a,0x10]
|
|
|
|
|
|
|
|
|
|
|
|
@------------------------------------------------------------------------------
|
|
|
|
@ ASR (register)
|
|
|
|
@------------------------------------------------------------------------------
|
|
|
|
asrs r5, r2
|
|
|
|
|
|
|
|
@ CHECK: asrs r5, r2 @ encoding: [0x15,0x41]
|
2011-08-17 22:57:40 +00:00
|
|
|
|
|
|
|
|
|
|
|
@------------------------------------------------------------------------------
|
|
|
|
@ B
|
|
|
|
@------------------------------------------------------------------------------
|
|
|
|
b _baz
|
|
|
|
beq _bar
|
|
|
|
|
|
|
|
@ CHECK: b _baz @ encoding: [A,0xe0'A']
|
|
|
|
@ fixup A - offset: 0, value: _baz, kind: fixup_arm_thumb_br
|
|
|
|
@ CHECK: beq _bar @ encoding: [A,0xd0]
|
|
|
|
@ fixup A - offset: 0, value: _bar, kind: fixup_arm_thumb_bcc
|
2011-08-17 23:00:53 +00:00
|
|
|
|
|
|
|
|
|
|
|
@------------------------------------------------------------------------------
|
|
|
|
@ BICS
|
|
|
|
@------------------------------------------------------------------------------
|
|
|
|
bics r1, r6
|
|
|
|
|
|
|
|
@ CHECK: bics r1, r6 @ encoding: [0xb1,0x43]
|
2011-08-17 23:11:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
@------------------------------------------------------------------------------
|
|
|
|
@ BKPT
|
|
|
|
@------------------------------------------------------------------------------
|
|
|
|
bkpt #0
|
|
|
|
bkpt #255
|
|
|
|
|
|
|
|
@ CHECK: bkpt #0 @ encoding: [0x00,0xbe]
|
|
|
|
@ CHECK: bkpt #255 @ encoding: [0xff,0xbe]
|
2011-08-18 17:00:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
@------------------------------------------------------------------------------
|
|
|
|
@ BL/BLX (immediate)
|
|
|
|
@------------------------------------------------------------------------------
|
|
|
|
bl _bar
|
|
|
|
blx _baz
|
|
|
|
|
|
|
|
@ CHECK: bl _bar @ encoding: [A,0xf0'A',A,0xf8'A']
|
|
|
|
@ fixup A - offset: 0, value: _bar, kind: fixup_arm_thumb_bl
|
|
|
|
@ CHECK: blx _baz @ encoding: [A,0xf0'A',A,0xe8'A']
|
|
|
|
@ fixup A - offset: 0, value: _baz, kind: fixup_arm_thumb_blx
|
2011-08-18 17:02:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
@------------------------------------------------------------------------------
|
|
|
|
@ BLX (register)
|
|
|
|
@------------------------------------------------------------------------------
|
|
|
|
blx r4
|
|
|
|
|
|
|
|
@ CHECK: blx r4 @ encoding: [0xa0,0x47]
|
|
|
|
|
|
|
|
|
|
|
|
@------------------------------------------------------------------------------
|
|
|
|
@ BX
|
|
|
|
@------------------------------------------------------------------------------
|
|
|
|
bx r2
|
|
|
|
|
|
|
|
@ CHECK: bx r2 @ encoding: [0x10,0x47]
|
2011-08-18 17:55:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
@------------------------------------------------------------------------------
|
|
|
|
@ CMN
|
|
|
|
@------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
cmn r5, r1
|
|
|
|
|
|
|
|
@ CHECK: cmn r5, r1 @ encoding: [0xcd,0x42]
|
|
|
|
|
2011-08-18 18:08:29 +00:00
|
|
|
|
|
|
|
@------------------------------------------------------------------------------
|
|
|
|
@ CMP
|
|
|
|
@------------------------------------------------------------------------------
|
|
|
|
cmp r6, #32
|
|
|
|
cmp r3, r4
|
|
|
|
cmp r8, r1
|
|
|
|
|
|
|
|
@ CHECK: cmp r6, #32 @ encoding: [0x20,0x2e]
|
|
|
|
@ CHECK: cmp r3, r4 @ encoding: [0xa3,0x42]
|
|
|
|
@ CHECK: cmp r8, r1 @ encoding: [0x88,0x45]
|
2011-08-18 18:10:38 +00:00
|
|
|
|
|
|
|
@------------------------------------------------------------------------------
|
|
|
|
@ EOR
|
|
|
|
@------------------------------------------------------------------------------
|
|
|
|
eors r4, r5
|
|
|
|
|
|
|
|
@ CHECK: eors r4, r5 @ encoding: [0x6c,0x40]
|
2011-08-18 21:50:53 +00:00
|
|
|
|
|
|
|
|
|
|
|
@------------------------------------------------------------------------------
|
|
|
|
@ LDM
|
|
|
|
@------------------------------------------------------------------------------
|
|
|
|
ldm r3, {r0, r1, r2, r3, r4, r5, r6, r7}
|
|
|
|
ldm r2!, {r1, r3, r4, r5, r7}
|
|
|
|
ldm r1, {r1}
|
|
|
|
|
|
|
|
@ CHECK: ldm r3, {r0, r1, r2, r3, r4, r5, r6, r7} @ encoding: [0xff,0xcb]
|
|
|
|
@ CHECK: ldm r2!, {r1, r3, r4, r5, r7} @ encoding: [0xba,0xca]
|
|
|
|
@ CHECK: ldm r1, {r1} @ encoding: [0x02,0xc9]
|
2011-08-19 17:55:24 +00:00
|
|
|
|
|
|
|
|
|
|
|
@------------------------------------------------------------------------------
|
|
|
|
@ LDR (immediate)
|
|
|
|
@------------------------------------------------------------------------------
|
|
|
|
ldr r1, [r5]
|
|
|
|
ldr r2, [r6, #32]
|
|
|
|
ldr r3, [r7, #124]
|
2011-08-19 18:13:48 +00:00
|
|
|
ldr r1, [sp]
|
|
|
|
ldr r2, [sp, #24]
|
|
|
|
ldr r3, [sp, #1020]
|
|
|
|
|
2011-08-19 17:55:24 +00:00
|
|
|
|
|
|
|
@ CHECK: ldr r1, [r5] @ encoding: [0x29,0x68]
|
|
|
|
@ CHECK: ldr r2, [r6, #32] @ encoding: [0x32,0x6a]
|
|
|
|
@ CHECK: ldr r3, [r7, #124] @ encoding: [0xfb,0x6f]
|
2011-08-19 18:13:48 +00:00
|
|
|
@ CHECK: ldr r1, [sp] @ encoding: [0x00,0x99]
|
|
|
|
@ CHECK: ldr r2, [sp, #24] @ encoding: [0x06,0x9a]
|
|
|
|
@ CHECK: ldr r3, [sp, #1020] @ encoding: [0xff,0x9b]
|
2011-08-19 17:55:24 +00:00
|
|
|
|