Home | History | Annotate | Download | only in ARM
      1 @---
      2 @ Run these test in both Thumb1 and Thumb2 modes, as all of the encodings
      3 @ should be valid, and parse the same, in both.
      4 @---
      5 @ RUN: llvm-mc -triple=thumbv6-apple-darwin -show-encoding < %s | FileCheck %s
      6 @ RUN: llvm-mc -triple=thumbv7-apple-darwin -show-encoding < %s | FileCheck %s
      7 @ RUN: llvm-mc -triple=thumbebv7-unknown-unknown -show-encoding < %s | FileCheck --check-prefix=CHECK-BE %s
      8   .syntax unified
      9   .globl _func
     10 
     11 @ Check that the assembler can handle the documented syntax from the ARM ARM.
     12 @ For complex constructs like shifter operands, check more thoroughly for them
     13 @ once then spot check that following instructions accept the form generally.
     14 @ This gives us good coverage while keeping the overall size of the test
     15 @ more reasonable.
     16 
     17 
     18 @ FIXME: Some 3-operand instructions have a 2-operand assembly syntax.
     19 
     20 _func:
     21 @ CHECK: _func
     22 
     23 @------------------------------------------------------------------------------
     24 @ ADC (register)
     25 @------------------------------------------------------------------------------
     26         adcs r4, r6
     27 
     28 @ CHECK: adcs	r4, r6                  @ encoding: [0x74,0x41]
     29 
     30 
     31 @------------------------------------------------------------------------------
     32 @ ADD (immediate)
     33 @------------------------------------------------------------------------------
     34         adds r1, r2, #3
     35 @ When Rd is not explicitly specified, encoding T2 is preferred even though
     36 @ the literal is in the range [0,7] which would allow encoding T1.
     37         adds r2, #3
     38         adds r2, #8
     39 
     40 @ CHECK: adds	r1, r2, #3              @ encoding: [0xd1,0x1c]
     41 @ CHECK: adds	r2, #3                  @ encoding: [0x03,0x32]
     42 @ CHECK: adds	r2, #8                  @ encoding: [0x08,0x32]
     43 
     44 
     45 @------------------------------------------------------------------------------
     46 @ ADD (register)
     47 @------------------------------------------------------------------------------
     48         adds r1, r2, r3
     49         add r2, r8
     50 
     51 @ CHECK: adds	r1, r2, r3              @ encoding: [0xd1,0x18]
     52 @ CHECK: add	r2, r8                  @ encoding: [0x42,0x44]
     53 
     54 
     55 @------------------------------------------------------------------------------
     56 @ ADD (SP plus immediate)
     57 @------------------------------------------------------------------------------
     58         add sp, #4
     59         add sp, #508
     60         add sp, sp, #4
     61         add r2, sp, #8
     62         add r2, sp, #1020
     63 	add sp, sp, #-8
     64 	add sp, #-8
     65 
     66 @ CHECK: add	sp, #4                  @ encoding: [0x01,0xb0]
     67 @ CHECK: add	sp, #508                @ encoding: [0x7f,0xb0]
     68 @ CHECK: add	sp, #4                  @ encoding: [0x01,0xb0]
     69 @ CHECK: add	r2, sp, #8              @ encoding: [0x02,0xaa]
     70 @ CHECK: add	r2, sp, #1020           @ encoding: [0xff,0xaa]
     71 @ CHECK: sub	sp, #8                  @ encoding: [0x82,0xb0]
     72 @ CHECK: sub	sp, #8                  @ encoding: [0x82,0xb0]
     73 
     74 
     75 @------------------------------------------------------------------------------
     76 @ ADD (SP plus register)
     77 @------------------------------------------------------------------------------
     78         add sp, r3
     79         add r2, sp, r2
     80 
     81 @ CHECK: add	sp, r3                  @ encoding: [0x9d,0x44]
     82 @ CHECK: add	r2, sp, r2              @ encoding: [0x6a,0x44]
     83 
     84 
     85 @------------------------------------------------------------------------------
     86 @ ADR
     87 @------------------------------------------------------------------------------
     88         adr r2, _baz
     89         adr r5, #0
     90         adr r2, #4
     91         adr r3, #1020
     92 
     93 @ CHECK: adr	r2, _baz                @ encoding: [A,0xa2]
     94 @ CHECK:    @   fixup A - offset: 0, value: _baz, kind: fixup_thumb_adr_pcrel_10
     95 @ CHECK-BE: adr	r2, _baz                @ encoding: [0xa2,A]
     96 @ CHECK-BE:    @   fixup A - offset: 0, value: _baz, kind: fixup_thumb_adr_pcrel_10
     97 @ CHECK: adr	r5, #0                  @ encoding: [0x00,0xa5]
     98 @ CHECK: adr	r2, #4                  @ encoding: [0x01,0xa2]
     99 @ CHECK: adr	r3, #1020               @ encoding: [0xff,0xa3]
    100 
    101 @------------------------------------------------------------------------------
    102 @ ASR (immediate)
    103 @------------------------------------------------------------------------------
    104         asrs r2, r3, #32
    105         asrs r2, r3, #5
    106         asrs r2, r3, #1
    107         asrs r5, #21
    108         asrs r5, r5, #21
    109         asrs r3, r5, #21
    110 
    111 @ CHECK: asrs	r2, r3, #32             @ encoding: [0x1a,0x10]
    112 @ CHECK: asrs	r2, r3, #5              @ encoding: [0x5a,0x11]
    113 @ CHECK: asrs	r2, r3, #1              @ encoding: [0x5a,0x10]
    114 @ CHECK: asrs	r5, r5, #21             @ encoding: [0x6d,0x15]
    115 @ CHECK: asrs	r5, r5, #21             @ encoding: [0x6d,0x15]
    116 @ CHECK: asrs	r3, r5, #21             @ encoding: [0x6b,0x15]
    117 
    118 
    119 @------------------------------------------------------------------------------
    120 @ ASR (register)
    121 @------------------------------------------------------------------------------
    122         asrs r5, r2
    123 
    124 @ CHECK: asrs	r5, r2                  @ encoding: [0x15,0x41]
    125 
    126 
    127 @------------------------------------------------------------------------------
    128 @ B
    129 @------------------------------------------------------------------------------
    130         b _baz
    131         beq _bar
    132         b       #1838
    133         b       #-420
    134         beq     #-256
    135         beq     #160
    136 
    137 @ CHECK: b	_baz                    @ encoding: [A,0xe0'A']
    138 @ CHECK:     @   fixup A - offset: 0, value: _baz, kind: fixup_arm_thumb_br
    139 @ CHECK-BE: b	_baz                    @ encoding: [0xe0'A',A]
    140 @ CHECK-BE:     @   fixup A - offset: 0, value: _baz, kind: fixup_arm_thumb_br
    141 @ CHECK: beq	_bar                    @ encoding: [A,0xd0]
    142 @ CHECK:     @   fixup A - offset: 0, value: _bar, kind: fixup_arm_thumb_bcc
    143 @ CHECK-BE: beq	_bar                    @ encoding: [0xd0,A]
    144 @ CHECK-BE:     @   fixup A - offset: 0, value: _bar, kind: fixup_arm_thumb_bcc
    145 @ CHECK: b       #1838                   @ encoding: [0x97,0xe3]
    146 @ CHECK: b       #-420                   @ encoding: [0x2e,0xe7]
    147 @ CHECK: beq     #-256                   @ encoding: [0x80,0xd0]
    148 @ CHECK: beq     #160                    @ encoding: [0x50,0xd0]
    149 
    150 @------------------------------------------------------------------------------
    151 @ BL/BLX
    152 @------------------------------------------------------------------------------
    153         blx     #884800
    154         blx     #1769600
    155 
    156 @ CHECK: blx     #884800                 @ encoding: [0xd8,0xf0,0x20,0xe8]
    157 @ CHECK: blx     #1769600                @ encoding: [0xb0,0xf1,0x40,0xe8]
    158 
    159 @------------------------------------------------------------------------------
    160 @ BICS
    161 @------------------------------------------------------------------------------
    162         bics r1, r6
    163 
    164 @ CHECK: bics	r1, r6                  @ encoding: [0xb1,0x43]
    165 
    166 
    167 @------------------------------------------------------------------------------
    168 @ BKPT
    169 @------------------------------------------------------------------------------
    170         bkpt #0
    171         bkpt #255
    172 
    173 @ CHECK: bkpt	#0                      @ encoding: [0x00,0xbe]
    174 @ CHECK: bkpt	#255                    @ encoding: [0xff,0xbe]
    175 
    176 
    177 @------------------------------------------------------------------------------
    178 @ BL/BLX (immediate)
    179 @------------------------------------------------------------------------------
    180         bl _bar
    181         blx _baz
    182 
    183 @ CHECK: bl	_bar                    @ encoding: [A,0xf0'A',A,0xd0'A']
    184 @ CHECK:     @   fixup A - offset: 0, value: _bar, kind: fixup_arm_thumb_bl
    185 @ CHECK-BE: bl	_bar                    @ encoding: [0xf0'A',A,0xd0'A',A]
    186 @ CHECK-BE:     @   fixup A - offset: 0, value: _bar, kind: fixup_arm_thumb_bl
    187 @ CHECK: blx	_baz                    @ encoding: [A,0xf0'A',A,0xc0'A']
    188 @ CHECK:     @   fixup A - offset: 0, value: _baz, kind: fixup_arm_thumb_blx
    189 @ CHECK-BE: blx	_baz                    @ encoding: [0xf0'A',A,0xc0'A',A]
    190 @ CHECK-BE:     @   fixup A - offset: 0, value: _baz, kind: fixup_arm_thumb_blx
    191 
    192 
    193 @------------------------------------------------------------------------------
    194 @ BLX (register)
    195 @------------------------------------------------------------------------------
    196         blx r4
    197 
    198 @ CHECK: blx	r4                      @ encoding: [0xa0,0x47]
    199 
    200 
    201 @------------------------------------------------------------------------------
    202 @ BX
    203 @------------------------------------------------------------------------------
    204         bx r2
    205 
    206 @ CHECK: bx	r2                      @ encoding: [0x10,0x47]
    207 
    208 
    209 @------------------------------------------------------------------------------
    210 @ CMN
    211 @------------------------------------------------------------------------------
    212 
    213         cmn r5, r1
    214 
    215 @ CHECK: cmn	r5, r1                  @ encoding: [0xcd,0x42]
    216 
    217 
    218 @------------------------------------------------------------------------------
    219 @ CMP
    220 @------------------------------------------------------------------------------
    221         cmp r6, #32
    222         cmp r3, r4
    223         cmp r8, r1
    224 
    225 @ CHECK: cmp	r6, #32                 @ encoding: [0x20,0x2e]
    226 @ CHECK: cmp	r3, r4                  @ encoding: [0xa3,0x42]
    227 @ CHECK: cmp	r8, r1                  @ encoding: [0x88,0x45]
    228 
    229 @------------------------------------------------------------------------------
    230 @ CPS
    231 @------------------------------------------------------------------------------
    232 
    233         cpsie f
    234         cpsid a
    235 
    236 @ CHECK: cpsie f                        @ encoding: [0x61,0xb6]
    237 @ CHECK: cpsid a                        @ encoding: [0x74,0xb6]
    238 
    239 @------------------------------------------------------------------------------
    240 @ EOR
    241 @------------------------------------------------------------------------------
    242         eors r4, r5
    243 
    244 @ CHECK: eors	r4, r5                  @ encoding: [0x6c,0x40]
    245 
    246 
    247 @------------------------------------------------------------------------------
    248 @ LDM
    249 @------------------------------------------------------------------------------
    250         ldm r3, {r0, r1, r2, r3, r4, r5, r6, r7}
    251         ldm r2!, {r1, r3, r4, r5, r7}
    252         ldm r1, {r1}
    253 
    254 @ CHECK: ldm	r3, {r0, r1, r2, r3, r4, r5, r6, r7} @ encoding: [0xff,0xcb]
    255 @ CHECK: ldm	r2!, {r1, r3, r4, r5, r7} @ encoding: [0xba,0xca]
    256 @ CHECK: ldm	r1, {r1}                @ encoding: [0x02,0xc9]
    257 
    258 
    259 @------------------------------------------------------------------------------
    260 @ LDR (immediate)
    261 @------------------------------------------------------------------------------
    262         ldr r1, [r5]
    263         ldr r2, [r6, #32]
    264         ldr r3, [r7, #124]
    265         ldr r1, [sp]
    266         ldr r2, [sp, #24]
    267         ldr r3, [sp, #1020]
    268 
    269 
    270 @ CHECK: ldr	r1, [r5]                @ encoding: [0x29,0x68]
    271 @ CHECK: ldr	r2, [r6, #32]           @ encoding: [0x32,0x6a]
    272 @ CHECK: ldr	r3, [r7, #124]          @ encoding: [0xfb,0x6f]
    273 @ CHECK: ldr	r1, [sp]                @ encoding: [0x00,0x99]
    274 @ CHECK: ldr	r2, [sp, #24]           @ encoding: [0x06,0x9a]
    275 @ CHECK: ldr	r3, [sp, #1020]         @ encoding: [0xff,0x9b]
    276 
    277 
    278 @------------------------------------------------------------------------------
    279 @ LDR (literal)
    280 @------------------------------------------------------------------------------
    281         ldr r1, _foo
    282         ldr     r3, #604
    283         ldr     r3, #368
    284 
    285 @ CHECK: ldr	r1, _foo                @ encoding: [A,0x49]
    286 @ CHECK:     @   fixup A - offset: 0, value: _foo, kind: fixup_arm_thumb_cp
    287 @ CHECK-BE: ldr	r1, _foo                @ encoding: [0x49,A]
    288 @ CHECK-BE:     @   fixup A - offset: 0, value: _foo, kind: fixup_arm_thumb_cp
    289 @ CHECK: ldr     r3, [pc, #604]         @ encoding: [0x97,0x4b]
    290 @ CHECK: ldr     r3, [pc, #368]         @ encoding: [0x5c,0x4b]
    291 
    292 @------------------------------------------------------------------------------
    293 @ LDR (register)
    294 @------------------------------------------------------------------------------
    295         ldr r1, [r2, r3]
    296 
    297 @ CHECK: ldr	r1, [r2, r3]            @ encoding: [0xd1,0x58]
    298 
    299 
    300 @------------------------------------------------------------------------------
    301 @ LDRB (immediate)
    302 @------------------------------------------------------------------------------
    303         ldrb r4, [r3]
    304         ldrb r5, [r6, #0]
    305         ldrb r6, [r7, #31]
    306 
    307 @ CHECK: ldrb	r4, [r3]                @ encoding: [0x1c,0x78]
    308 @ CHECK: ldrb	r5, [r6]                @ encoding: [0x35,0x78]
    309 @ CHECK: ldrb	r6, [r7, #31]           @ encoding: [0xfe,0x7f]
    310 
    311 
    312 @------------------------------------------------------------------------------
    313 @ LDRB (register)
    314 @------------------------------------------------------------------------------
    315         ldrb r6, [r4, r5]
    316 
    317 @ CHECK: ldrb	r6, [r4, r5]            @ encoding: [0x66,0x5d]
    318 
    319 
    320 @------------------------------------------------------------------------------
    321 @ LDRH (immediate)
    322 @------------------------------------------------------------------------------
    323         ldrh r3, [r3]
    324         ldrh r4, [r6, #2]
    325         ldrh r5, [r7, #62]
    326 
    327 @ CHECK: ldrh	r3, [r3]                @ encoding: [0x1b,0x88]
    328 @ CHECK: ldrh	r4, [r6, #2]            @ encoding: [0x74,0x88]
    329 @ CHECK: ldrh	r5, [r7, #62]           @ encoding: [0xfd,0x8f]
    330 
    331 
    332 @------------------------------------------------------------------------------
    333 @ LDRH (register)
    334 @------------------------------------------------------------------------------
    335         ldrh r6, [r2, r6]
    336 
    337 @ CHECK: ldrh	r6, [r2, r6]            @ encoding: [0x96,0x5b]
    338 
    339 
    340 @------------------------------------------------------------------------------
    341 @ LDRSB/LDRSH
    342 @------------------------------------------------------------------------------
    343         ldrsb r6, [r2, r6]
    344         ldrsh r3, [r7, r1]
    345 
    346 @ CHECK: ldrsb	r6, [r2, r6]            @ encoding: [0x96,0x57]
    347 @ CHECK: ldrsh	r3, [r7, r1]            @ encoding: [0x7b,0x5e]
    348 
    349 
    350 @------------------------------------------------------------------------------
    351 @ LSL (immediate)
    352 @------------------------------------------------------------------------------
    353         lsls r4, r5, #0
    354         lsls r4, r5, #4
    355         lsls r3, #12
    356         lsls r3, r3, #12
    357         lsls r1, r3, #12
    358 
    359 @ CHECK: lsls	r4, r5, #0              @ encoding: [0x2c,0x00]
    360 @ CHECK: lsls	r4, r5, #4              @ encoding: [0x2c,0x01]
    361 @ CHECK: lsls	r3, r3, #12             @ encoding: [0x1b,0x03]
    362 @ CHECK: lsls	r3, r3, #12             @ encoding: [0x1b,0x03]
    363 @ CHECK: lsls	r1, r3, #12             @ encoding: [0x19,0x03]
    364 
    365 
    366 @------------------------------------------------------------------------------
    367 @ LSL (register)
    368 @------------------------------------------------------------------------------
    369         lsls r2, r6
    370 
    371 @ CHECK: lsls	r2, r6                  @ encoding: [0xb2,0x40]
    372 
    373 
    374 @------------------------------------------------------------------------------
    375 @ LSR (immediate)
    376 @------------------------------------------------------------------------------
    377         lsrs r1, r3, #1
    378         lsrs r1, r3, #32
    379         lsrs r4, #20
    380         lsrs r4, r4, #20
    381         lsrs r2, r4, #20
    382 
    383 @ CHECK: lsrs	r1, r3, #1              @ encoding: [0x59,0x08]
    384 @ CHECK: lsrs	r1, r3, #32             @ encoding: [0x19,0x08]
    385 @ CHECK: lsrs	r4, r4, #20             @ encoding: [0x24,0x0d]
    386 @ CHECK: lsrs	r4, r4, #20             @ encoding: [0x24,0x0d]
    387 @ CHECK: lsrs	r2, r4, #20             @ encoding: [0x22,0x0d]
    388 
    389 
    390 @------------------------------------------------------------------------------
    391 @ LSR (register)
    392 @------------------------------------------------------------------------------
    393         lsrs r2, r6
    394 
    395 @ CHECK: lsrs	r2, r6                  @ encoding: [0xf2,0x40]
    396 
    397 
    398 @------------------------------------------------------------------------------
    399 @ MOV (immediate)
    400 @------------------------------------------------------------------------------
    401         movs r2, #0
    402         movs r2, #255
    403         movs r2, #23
    404 
    405 @ CHECK: movs	r2, #0                  @ encoding: [0x00,0x22]
    406 @ CHECK: movs	r2, #255                @ encoding: [0xff,0x22]
    407 @ CHECK: movs	r2, #23                 @ encoding: [0x17,0x22]
    408 
    409 
    410 @------------------------------------------------------------------------------
    411 @ MOV (register)
    412 @------------------------------------------------------------------------------
    413         mov r3, r4
    414         movs r1, r3
    415 
    416 @ CHECK: mov	r3, r4                  @ encoding: [0x23,0x46]
    417 @ CHECK: movs	r1, r3                  @ encoding: [0x19,0x00]
    418 
    419 
    420 @------------------------------------------------------------------------------
    421 @ MUL
    422 @------------------------------------------------------------------------------
    423         muls r1, r2, r1
    424         muls r2, r2, r3
    425         muls r3, r4
    426 
    427 @ CHECK: muls	r1, r2, r1              @ encoding: [0x51,0x43]
    428 @ CHECK: muls	r2, r3, r2              @ encoding: [0x5a,0x43]
    429 @ CHECK: muls	r3, r4, r3              @ encoding: [0x63,0x43]
    430 
    431 
    432 @------------------------------------------------------------------------------
    433 @ MVN
    434 @------------------------------------------------------------------------------
    435         mvns r6, r3
    436 
    437 @ CHECK: mvns	r6, r3                  @ encoding: [0xde,0x43]
    438 
    439 
    440 @------------------------------------------------------------------------------
    441 @ NEG
    442 @------------------------------------------------------------------------------
    443         negs r3, r4
    444 
    445 @ CHECK: rsbs	r3, r4, #0              @ encoding: [0x63,0x42]
    446 
    447 @------------------------------------------------------------------------------
    448 @ ORR
    449 @------------------------------------------------------------------------------
    450         orrs  r3, r4
    451 
    452 @ CHECK-ERRORS: 	orrs	r3, r4                  @ encoding: [0x23,0x43]
    453 
    454 
    455 @------------------------------------------------------------------------------
    456 @ POP
    457 @------------------------------------------------------------------------------
    458         pop {r2, r3, r6}
    459 
    460 @ CHECK: pop	{r2, r3, r6}            @ encoding: [0x4c,0xbc]
    461 
    462 
    463 @------------------------------------------------------------------------------
    464 @ PUSH
    465 @------------------------------------------------------------------------------
    466         push {r1, r2, r7}
    467 
    468 @ CHECK: push	{r1, r2, r7}            @ encoding: [0x86,0xb4]
    469 
    470 
    471 @------------------------------------------------------------------------------
    472 @ REV/REV16/REVSH
    473 @------------------------------------------------------------------------------
    474         rev r6, r3
    475         rev16 r7, r2
    476         revsh r5, r1
    477 
    478 @ CHECK: rev	r6, r3                  @ encoding: [0x1e,0xba]
    479 @ CHECK: rev16	r7, r2                  @ encoding: [0x57,0xba]
    480 @ CHECK: revsh	r5, r1                  @ encoding: [0xcd,0xba]
    481 
    482 
    483 @------------------------------------------------------------------------------
    484 @ ROR
    485 @------------------------------------------------------------------------------
    486         rors r2, r7
    487 
    488 @ CHECK: rors	r2, r7                  @ encoding: [0xfa,0x41]
    489 
    490 
    491 @------------------------------------------------------------------------------
    492 @ RSB
    493 @------------------------------------------------------------------------------
    494         rsbs r1, r3, #0
    495 
    496 @ CHECK: rsbs	r1, r3, #0              @ encoding: [0x59,0x42]
    497 
    498 
    499 @------------------------------------------------------------------------------
    500 @ SBC
    501 @------------------------------------------------------------------------------
    502         sbcs r4, r3
    503 
    504 @ CHECK: sbcs	r4, r3                  @ encoding: [0x9c,0x41]
    505 
    506 
    507 @------------------------------------------------------------------------------
    508 @ SETEND
    509 @------------------------------------------------------------------------------
    510         setend be
    511         setend le
    512 
    513 @ CHECK: setend	be                      @ encoding: [0x58,0xb6]
    514 @ CHECK: setend	le                      @ encoding: [0x50,0xb6]
    515 
    516 
    517 @------------------------------------------------------------------------------
    518 @ STM
    519 @------------------------------------------------------------------------------
    520         stm r1!, {r2, r6}
    521         stm r1!, {r1, r2, r3, r7}
    522 
    523 @ CHECK: stm	r1!, {r2, r6}           @ encoding: [0x44,0xc1]
    524 @ CHECK: stm	r1!, {r1, r2, r3, r7}   @ encoding: [0x8e,0xc1]
    525 
    526 
    527 @------------------------------------------------------------------------------
    528 @ STR (immediate)
    529 @------------------------------------------------------------------------------
    530         str r2, [r7]
    531         str r2, [r7, #0]
    532         str r5, [r1, #4]
    533         str r3, [r7, #124]
    534         str r2, [sp]
    535         str r3, [sp, #0]
    536         str r4, [sp, #20]
    537         str r5, [sp, #1020]
    538 
    539 @ CHECK: str	r2, [r7]                @ encoding: [0x3a,0x60]
    540 @ CHECK: str	r2, [r7]                @ encoding: [0x3a,0x60]
    541 @ CHECK: str	r5, [r1, #4]            @ encoding: [0x4d,0x60]
    542 @ CHECK: str	r3, [r7, #124]          @ encoding: [0xfb,0x67]
    543 @ CHECK: str	r2, [sp]                @ encoding: [0x00,0x92]
    544 @ CHECK: str	r3, [sp]                @ encoding: [0x00,0x93]
    545 @ CHECK: str	r4, [sp, #20]           @ encoding: [0x05,0x94]
    546 @ CHECK: str	r5, [sp, #1020]         @ encoding: [0xff,0x95]
    547 
    548 
    549 @------------------------------------------------------------------------------
    550 @ STR (register)
    551 @------------------------------------------------------------------------------
    552         str r2, [r7, r3]
    553 
    554 @ CHECK: str	r2, [r7, r3]            @ encoding: [0xfa,0x50]
    555 
    556 
    557 @------------------------------------------------------------------------------
    558 @ STRB (immediate)
    559 @------------------------------------------------------------------------------
    560         strb r4, [r3]
    561         strb r5, [r6, #0]
    562         strb r6, [r7, #31]
    563 
    564 @ CHECK: strb	r4, [r3]                @ encoding: [0x1c,0x70]
    565 @ CHECK: strb	r5, [r6]                @ encoding: [0x35,0x70]
    566 @ CHECK: strb	r6, [r7, #31]           @ encoding: [0xfe,0x77]
    567 
    568 
    569 @------------------------------------------------------------------------------
    570 @ STRB (register)
    571 @------------------------------------------------------------------------------
    572         strb r6, [r4, r5]
    573 
    574 @ CHECK: strb	r6, [r4, r5]            @ encoding: [0x66,0x55]
    575 
    576 
    577 @------------------------------------------------------------------------------
    578 @ STRH (immediate)
    579 @------------------------------------------------------------------------------
    580         strh r3, [r3]
    581         strh r4, [r6, #2]
    582         strh r5, [r7, #62]
    583 
    584 @ CHECK: strh	r3, [r3]                @ encoding: [0x1b,0x80]
    585 @ CHECK: strh	r4, [r6, #2]            @ encoding: [0x74,0x80]
    586 @ CHECK: strh	r5, [r7, #62]           @ encoding: [0xfd,0x87]
    587 
    588 
    589 @------------------------------------------------------------------------------
    590 @ STRH (register)
    591 @------------------------------------------------------------------------------
    592         strh r6, [r2, r6]
    593 
    594 @ CHECK: strh	r6, [r2, r6]            @ encoding: [0x96,0x53]
    595 
    596 
    597 @------------------------------------------------------------------------------
    598 @ SUB (immediate)
    599 @------------------------------------------------------------------------------
    600         subs r1, r2, #3
    601         subs r2, #3
    602         subs r2, #8
    603 
    604 @ CHECK: subs	r1, r2, #3              @ encoding: [0xd1,0x1e]
    605 @ CHECK: subs	r2, #3                  @ encoding: [0x03,0x3a]
    606 @ CHECK: subs	r2, #8                  @ encoding: [0x08,0x3a]
    607 
    608 
    609 @------------------------------------------------------------------------------
    610 @ SUB (SP minus immediate)
    611 @------------------------------------------------------------------------------
    612         sub sp, #12
    613         sub sp, sp, #508
    614 
    615 @ CHECK: sub	sp, #12                 @ encoding: [0x83,0xb0]
    616 @ CHECK: sub	sp, #508                @ encoding: [0xff,0xb0]
    617 
    618 
    619 @------------------------------------------------------------------------------
    620 @ SUB (register)
    621 @------------------------------------------------------------------------------
    622         subs r1, r2, r3
    623 
    624 @ CHECK: subs	r1, r2, r3              @ encoding: [0xd1,0x1a]
    625 
    626 
    627 @------------------------------------------------------------------------------
    628 @ SVC
    629 @------------------------------------------------------------------------------
    630         svc #0
    631         svc #255
    632 
    633 @ CHECK: svc	#0                      @ encoding: [0x00,0xdf]
    634 @ CHECK: svc	#255                    @ encoding: [0xff,0xdf]
    635 
    636 
    637 @------------------------------------------------------------------------------
    638 @ SXTB/SXTH
    639 @------------------------------------------------------------------------------
    640         sxtb r3, r5
    641         sxth r3, r5
    642 
    643 @ CHECK: sxtb	r3, r5                  @ encoding: [0x6b,0xb2]
    644 @ CHECK: sxth	r3, r5                  @ encoding: [0x2b,0xb2]
    645 
    646 
    647 @------------------------------------------------------------------------------
    648 @ TST
    649 @------------------------------------------------------------------------------
    650         tst r6, r1
    651 
    652 @ CHECK: tst	r6, r1                  @ encoding: [0x0e,0x42]
    653 
    654 
    655 @------------------------------------------------------------------------------
    656 @ UXTB/UXTH
    657 @------------------------------------------------------------------------------
    658         uxtb  r7, r2
    659         uxth  r1, r4
    660 
    661 @ CHECK: uxtb	r7, r2                  @ encoding: [0xd7,0xb2]
    662 @ CHECK: uxth	r1, r4                  @ encoding: [0xa1,0xb2]
    663 
    664 
    665