basic-thumb-instructions.s revision 395b453bed53a60c559b679eb92f75d0b140b307
13912b73c74dc9c928228504e9a23c577b57c4e12Jim Grosbach@ RUN: llvm-mc -triple=thumbv6-apple-darwin -show-encoding < %s | FileCheck %s 23912b73c74dc9c928228504e9a23c577b57c4e12Jim Grosbach .syntax unified 33912b73c74dc9c928228504e9a23c577b57c4e12Jim Grosbach .globl _func 43912b73c74dc9c928228504e9a23c577b57c4e12Jim Grosbach 53912b73c74dc9c928228504e9a23c577b57c4e12Jim Grosbach@ Check that the assembler can handle the documented syntax from the ARM ARM. 63912b73c74dc9c928228504e9a23c577b57c4e12Jim Grosbach@ For complex constructs like shifter operands, check more thoroughly for them 73912b73c74dc9c928228504e9a23c577b57c4e12Jim Grosbach@ once then spot check that following instructions accept the form generally. 83912b73c74dc9c928228504e9a23c577b57c4e12Jim Grosbach@ This gives us good coverage while keeping the overall size of the test 93912b73c74dc9c928228504e9a23c577b57c4e12Jim Grosbach@ more reasonable. 103912b73c74dc9c928228504e9a23c577b57c4e12Jim Grosbach 113912b73c74dc9c928228504e9a23c577b57c4e12Jim Grosbach_func: 123912b73c74dc9c928228504e9a23c577b57c4e12Jim Grosbach@ CHECK: _func 133912b73c74dc9c928228504e9a23c577b57c4e12Jim Grosbach 143912b73c74dc9c928228504e9a23c577b57c4e12Jim Grosbach@------------------------------------------------------------------------------ 15358499ea3b72dda4392d340ee5a36d1bbe76728cJim Grosbach@ ADC (register) 16358499ea3b72dda4392d340ee5a36d1bbe76728cJim Grosbach@------------------------------------------------------------------------------ 17358499ea3b72dda4392d340ee5a36d1bbe76728cJim Grosbach adcs r4, r6 18358499ea3b72dda4392d340ee5a36d1bbe76728cJim Grosbach 19358499ea3b72dda4392d340ee5a36d1bbe76728cJim Grosbach@ CHECK: adcs r4, r6 @ encoding: [0x74,0x41] 20358499ea3b72dda4392d340ee5a36d1bbe76728cJim Grosbach 21358499ea3b72dda4392d340ee5a36d1bbe76728cJim Grosbach 22358499ea3b72dda4392d340ee5a36d1bbe76728cJim Grosbach@------------------------------------------------------------------------------ 2389e2aa6afd408f1b4c6b47c53bbf31d48463bcabJim Grosbach@ ADD (immediate) 2489e2aa6afd408f1b4c6b47c53bbf31d48463bcabJim Grosbach@------------------------------------------------------------------------------ 2589e2aa6afd408f1b4c6b47c53bbf31d48463bcabJim Grosbach adds r1, r2, #3 2689e2aa6afd408f1b4c6b47c53bbf31d48463bcabJim Grosbach adds r2, #3 2789e2aa6afd408f1b4c6b47c53bbf31d48463bcabJim Grosbach adds r2, #8 2889e2aa6afd408f1b4c6b47c53bbf31d48463bcabJim Grosbach 2989e2aa6afd408f1b4c6b47c53bbf31d48463bcabJim Grosbach@ CHECK: adds r1, r2, #3 @ encoding: [0xd1,0x1c] 3089e2aa6afd408f1b4c6b47c53bbf31d48463bcabJim Grosbach@ CHECK: adds r2, r2, #3 @ encoding: [0xd2,0x1c] 3189e2aa6afd408f1b4c6b47c53bbf31d48463bcabJim Grosbach@ CHECK: adds r2, #8 @ encoding: [0x08,0x32] 3289e2aa6afd408f1b4c6b47c53bbf31d48463bcabJim Grosbach 3389e2aa6afd408f1b4c6b47c53bbf31d48463bcabJim Grosbach 3489e2aa6afd408f1b4c6b47c53bbf31d48463bcabJim Grosbach@------------------------------------------------------------------------------ 353912b73c74dc9c928228504e9a23c577b57c4e12Jim Grosbach@ ADD (register) 363912b73c74dc9c928228504e9a23c577b57c4e12Jim Grosbach@------------------------------------------------------------------------------ 373912b73c74dc9c928228504e9a23c577b57c4e12Jim Grosbach adds r1, r2, r3 383912b73c74dc9c928228504e9a23c577b57c4e12Jim Grosbach add r2, r8 393912b73c74dc9c928228504e9a23c577b57c4e12Jim Grosbach 403912b73c74dc9c928228504e9a23c577b57c4e12Jim Grosbach@ CHECK: adds r1, r2, r3 @ encoding: [0xd1,0x18] 41b1ee18ee69624d51211e59fa42b54a0f5827318aJim Grosbach@ CHECK: add r2, r8 @ encoding: [0x42,0x44] 4253727fc659af5f8fc51499fd875165533187d734Jim Grosbach 4353727fc659af5f8fc51499fd875165533187d734Jim Grosbach 4453727fc659af5f8fc51499fd875165533187d734Jim Grosbach@------------------------------------------------------------------------------ 4553727fc659af5f8fc51499fd875165533187d734Jim Grosbach@ FIXME: ADD (SP plus immediate) 4653727fc659af5f8fc51499fd875165533187d734Jim Grosbach@------------------------------------------------------------------------------ 4753727fc659af5f8fc51499fd875165533187d734Jim Grosbach@------------------------------------------------------------------------------ 4853727fc659af5f8fc51499fd875165533187d734Jim Grosbach@ FIXME: ADD (SP plus register) 4953727fc659af5f8fc51499fd875165533187d734Jim Grosbach@------------------------------------------------------------------------------ 505a1cd045cd4220f84dae81ab2079e2272dfc51c1Jim Grosbach 515a1cd045cd4220f84dae81ab2079e2272dfc51c1Jim Grosbach 525a1cd045cd4220f84dae81ab2079e2272dfc51c1Jim Grosbach@------------------------------------------------------------------------------ 535a1cd045cd4220f84dae81ab2079e2272dfc51c1Jim Grosbach@ ADR 545a1cd045cd4220f84dae81ab2079e2272dfc51c1Jim Grosbach@------------------------------------------------------------------------------ 555a1cd045cd4220f84dae81ab2079e2272dfc51c1Jim Grosbach adr r2, _baz 565a1cd045cd4220f84dae81ab2079e2272dfc51c1Jim Grosbach 575a1cd045cd4220f84dae81ab2079e2272dfc51c1Jim Grosbach@ CHECK: adr r2, _baz @ encoding: [A,0xa2] 585a1cd045cd4220f84dae81ab2079e2272dfc51c1Jim Grosbach @ fixup A - offset: 0, value: _baz, kind: fixup_thumb_adr_pcrel_10 5900f5d982057574cf65a4a3f29548ff9fb0ecfbd0Jim Grosbach 6000f5d982057574cf65a4a3f29548ff9fb0ecfbd0Jim Grosbach 6100f5d982057574cf65a4a3f29548ff9fb0ecfbd0Jim Grosbach@------------------------------------------------------------------------------ 6200f5d982057574cf65a4a3f29548ff9fb0ecfbd0Jim Grosbach@ ASR (immediate) 6300f5d982057574cf65a4a3f29548ff9fb0ecfbd0Jim Grosbach@------------------------------------------------------------------------------ 6400f5d982057574cf65a4a3f29548ff9fb0ecfbd0Jim Grosbach asrs r2, r3, #32 6500f5d982057574cf65a4a3f29548ff9fb0ecfbd0Jim Grosbach asrs r2, r3, #5 6600f5d982057574cf65a4a3f29548ff9fb0ecfbd0Jim Grosbach asrs r2, r3, #1 6700f5d982057574cf65a4a3f29548ff9fb0ecfbd0Jim Grosbach 6800f5d982057574cf65a4a3f29548ff9fb0ecfbd0Jim Grosbach@ CHECK: asrs r2, r3, #32 @ encoding: [0x1a,0x10] 6900f5d982057574cf65a4a3f29548ff9fb0ecfbd0Jim Grosbach@ CHECK: asrs r2, r3, #5 @ encoding: [0x5a,0x11] 7000f5d982057574cf65a4a3f29548ff9fb0ecfbd0Jim Grosbach@ CHECK: asrs r2, r3, #1 @ encoding: [0x5a,0x10] 7100f5d982057574cf65a4a3f29548ff9fb0ecfbd0Jim Grosbach 7200f5d982057574cf65a4a3f29548ff9fb0ecfbd0Jim Grosbach 7300f5d982057574cf65a4a3f29548ff9fb0ecfbd0Jim Grosbach@------------------------------------------------------------------------------ 7400f5d982057574cf65a4a3f29548ff9fb0ecfbd0Jim Grosbach@ ASR (register) 7500f5d982057574cf65a4a3f29548ff9fb0ecfbd0Jim Grosbach@------------------------------------------------------------------------------ 7600f5d982057574cf65a4a3f29548ff9fb0ecfbd0Jim Grosbach asrs r5, r2 7700f5d982057574cf65a4a3f29548ff9fb0ecfbd0Jim Grosbach 7800f5d982057574cf65a4a3f29548ff9fb0ecfbd0Jim Grosbach@ CHECK: asrs r5, r2 @ encoding: [0x15,0x41] 79395b453bed53a60c559b679eb92f75d0b140b307Jim Grosbach 80395b453bed53a60c559b679eb92f75d0b140b307Jim Grosbach 81395b453bed53a60c559b679eb92f75d0b140b307Jim Grosbach@------------------------------------------------------------------------------ 82395b453bed53a60c559b679eb92f75d0b140b307Jim Grosbach@ B 83395b453bed53a60c559b679eb92f75d0b140b307Jim Grosbach@------------------------------------------------------------------------------ 84395b453bed53a60c559b679eb92f75d0b140b307Jim Grosbach b _baz 85395b453bed53a60c559b679eb92f75d0b140b307Jim Grosbach beq _bar 86395b453bed53a60c559b679eb92f75d0b140b307Jim Grosbach 87395b453bed53a60c559b679eb92f75d0b140b307Jim Grosbach@ CHECK: b _baz @ encoding: [A,0xe0'A'] 88395b453bed53a60c559b679eb92f75d0b140b307Jim Grosbach @ fixup A - offset: 0, value: _baz, kind: fixup_arm_thumb_br 89395b453bed53a60c559b679eb92f75d0b140b307Jim Grosbach@ CHECK: beq _bar @ encoding: [A,0xd0] 90395b453bed53a60c559b679eb92f75d0b140b307Jim Grosbach @ fixup A - offset: 0, value: _bar, kind: fixup_arm_thumb_bcc 91