Home | History | Annotate | Download | only in ARM
      1 # RUN: llvm-mc -triple=thumbv6-apple-darwin -disassemble < %s | FileCheck %s
      2 
      3 #------------------------------------------------------------------------------
      4 # ADC (register)
      5 #------------------------------------------------------------------------------
      6 # CHECK: adcs r4, r6
      7 
      8 0x74 0x41
      9 
     10 
     11 #------------------------------------------------------------------------------
     12 # ADD (immediate)
     13 #------------------------------------------------------------------------------
     14 # CHECK: adds r1, r2, #3
     15 # CHECK: adds r2, r2, #3
     16 # CHECK: adds r2, #8
     17 
     18 0xd1 0x1c
     19 0xd2 0x1c
     20 0x08 0x32
     21 
     22 #------------------------------------------------------------------------------
     23 # ADD (register)
     24 #------------------------------------------------------------------------------
     25 # CHECK: adds r1, r2, r3
     26 # CHECK: add r2, r8
     27 
     28 0xd1 0x18
     29 0x42 0x44
     30 
     31 #------------------------------------------------------------------------------
     32 # ADD (SP plus immediate)
     33 #------------------------------------------------------------------------------
     34 # CHECK: add sp, #508
     35 # CHECK: add sp, #4
     36 # CHECK: add r2, sp, #8
     37 # CHECK: add r2, sp, #1020
     38 
     39 0x7f 0xb0
     40 0x01 0xb0
     41 0x02 0xaa
     42 0xff 0xaa
     43 
     44 
     45 #------------------------------------------------------------------------------
     46 # ADD (SP plus register)
     47 #------------------------------------------------------------------------------
     48 # CHECK: add sp, r3
     49 # CHECK: add r2, sp, r2
     50 
     51 0x9d 0x44
     52 0x6a 0x44
     53 
     54 #------------------------------------------------------------------------------
     55 # ADR
     56 #------------------------------------------------------------------------------
     57 # CHECK: adr	r2, #3
     58 0x03 0xa2
     59 
     60 #------------------------------------------------------------------------------
     61 # ASR (immediate)
     62 #------------------------------------------------------------------------------
     63 # CHECK: asrs r2, r3, #32
     64 # CHECK: asrs r2, r3, #5
     65 # CHECK: asrs r2, r3, #1
     66 
     67 0x1a 0x10
     68 0x5a 0x11
     69 0x5a 0x10
     70 
     71 #------------------------------------------------------------------------------
     72 # ASR (register)
     73 #------------------------------------------------------------------------------
     74 # CHECK: asrs r5, r2
     75 
     76 0x15 0x41
     77 
     78 #------------------------------------------------------------------------------
     79 # BICS
     80 #------------------------------------------------------------------------------
     81 # CHECK: bics r1, r6
     82 
     83 0xb1 0x43
     84 
     85 #------------------------------------------------------------------------------
     86 # BKPT
     87 #------------------------------------------------------------------------------
     88 # CHECK: bkpt #0
     89 # CHECK: bkpt #255
     90 
     91 0x00 0xbe
     92 0xff 0xbe
     93 
     94 #------------------------------------------------------------------------------
     95 # BLX (register)
     96 #------------------------------------------------------------------------------
     97 # CHECK: blx r4
     98 
     99 0xa0 0x47
    100 
    101 #------------------------------------------------------------------------------
    102 # BX
    103 #------------------------------------------------------------------------------
    104 # CHECK: bx r2
    105 
    106 0x10 0x47
    107 
    108 #------------------------------------------------------------------------------
    109 # CMN
    110 #------------------------------------------------------------------------------
    111 # CHECK: cmn r5, r1
    112 
    113 0xcd 0x42
    114 
    115 #------------------------------------------------------------------------------
    116 # CMP
    117 #------------------------------------------------------------------------------
    118 # CHECK: cmp r6, #32
    119 # CHECK: cmp r3, r4
    120 # CHECK: cmp r8, r1
    121 
    122 0x20 0x2e
    123 0xa3 0x42
    124 0x88 0x45
    125 
    126 #------------------------------------------------------------------------------
    127 # EOR
    128 #------------------------------------------------------------------------------
    129 # CHECK: eors r4, r5
    130 
    131 0x6c 0x40
    132 
    133 #------------------------------------------------------------------------------
    134 # LDM
    135 #------------------------------------------------------------------------------
    136 # CHECK: ldm r3, {r0, r1, r2, r3, r4, r5, r6, r7}
    137 # CHECK: ldm r2!, {r1, r3, r4, r5, r7}
    138 # CHECK: ldm r1, {r1}
    139 
    140 0xff 0xcb
    141 0xba 0xca
    142 0x02 0xc9
    143 
    144 
    145 #------------------------------------------------------------------------------
    146 # LDR (immediate)
    147 #------------------------------------------------------------------------------
    148 # CHECK: ldr r1, [r5]
    149 # CHECK: ldr r2, [r6, #32]
    150 # CHECK: ldr r3, [r7, #124]
    151 # CHECK: ldr r1, [sp]
    152 # CHECK: ldr r2, [sp, #24]
    153 # CHECK: ldr r3, [sp, #1020]
    154 
    155 
    156 0x29 0x68
    157 0x32 0x6a
    158 0xfb 0x6f
    159 0x00 0x99
    160 0x06 0x9a
    161 0xff 0x9b
    162 
    163 #------------------------------------------------------------------------------
    164 # LDR (register)
    165 #------------------------------------------------------------------------------
    166 # CHECK: ldr r1, [r2, r3]
    167 
    168 0xd1 0x58
    169 
    170 
    171 #------------------------------------------------------------------------------
    172 # LDRB (immediate)
    173 #------------------------------------------------------------------------------
    174 # CHECK: ldrb r4, [r3]
    175 # CHECK: ldrb r5, [r6]
    176 # CHECK: ldrb r6, [r7, #31]
    177 
    178 0x1c 0x78
    179 0x35 0x78
    180 0xfe 0x7f
    181 
    182 
    183 #------------------------------------------------------------------------------
    184 # LDRB (register)
    185 #------------------------------------------------------------------------------
    186 # CHECK: ldrb r6, [r4, r5]
    187 
    188 0x66 0x5d
    189 
    190 
    191 #------------------------------------------------------------------------------
    192 # LDRH (immediate)
    193 #------------------------------------------------------------------------------
    194 # CHECK: ldrh r3, [r3]
    195 # CHECK: ldrh r4, [r6, #2]
    196 # CHECK: ldrh r5, [r7, #62]
    197 
    198 0x1b 0x88
    199 0x74 0x88
    200 0xfd 0x8f
    201 
    202 #------------------------------------------------------------------------------
    203 # LDRH (register)
    204 #------------------------------------------------------------------------------
    205 # CHECK: ldrh r6, [r2, r6]
    206 
    207 0x96 0x5b
    208 
    209 
    210 #------------------------------------------------------------------------------
    211 # LDRSB/LDRSH
    212 #------------------------------------------------------------------------------
    213 # CHECK: ldrsb r6, [r2, r6]
    214 # CHECK: ldrsh r3, [r7, r1]
    215 
    216 0x96 0x57
    217 0x7b 0x5e
    218 
    219 #------------------------------------------------------------------------------
    220 # LSL (immediate)
    221 #------------------------------------------------------------------------------
    222 # CHECK: movs r4, r5
    223 # CHECK: lsls r4, r5, #4
    224 
    225 0x2c 0x00
    226 0x2c 0x01
    227 
    228 
    229 #------------------------------------------------------------------------------
    230 # LSL (register)
    231 #------------------------------------------------------------------------------
    232 # CHECK: lsls r2, r6
    233 
    234 0xb2 0x40
    235 
    236 
    237 #------------------------------------------------------------------------------
    238 # LSR (immediate)
    239 #------------------------------------------------------------------------------
    240 # CHECK: lsrs r1, r3, #1
    241 # CHECK: lsrs r1, r3, #32
    242 
    243 0x59 0x08
    244 0x19 0x08
    245 
    246 
    247 #------------------------------------------------------------------------------
    248 # LSR (register)
    249 #------------------------------------------------------------------------------
    250 # CHECK: lsrs r2, r6
    251 
    252 0xf2 0x40
    253 
    254 #------------------------------------------------------------------------------
    255 # MOV (immediate)
    256 #------------------------------------------------------------------------------
    257 # CHECK: movs r2, #0
    258 # CHECK: movs r2, #255
    259 # CHECK: movs r2, #23
    260 
    261 0x00 0x22
    262 0xff 0x22
    263 0x17 0x22
    264 
    265 
    266 #------------------------------------------------------------------------------
    267 # MOV (register)
    268 #------------------------------------------------------------------------------
    269 # CHECK: mov r3, r4
    270 # CHECK: movs r1, r3
    271 
    272 0x23 0x46
    273 0x19 0x00
    274 
    275 
    276 #------------------------------------------------------------------------------
    277 # MUL
    278 #------------------------------------------------------------------------------
    279 # CHECK: muls r1, r2, r1
    280 # CHECK: muls r3, r4
    281 
    282 0x51 0x43
    283 0x63 0x43
    284 
    285 
    286 #------------------------------------------------------------------------------
    287 # MVN
    288 #------------------------------------------------------------------------------
    289 # CHECK: mvns r6, r3
    290 
    291 0xde 0x43
    292 
    293 #------------------------------------------------------------------------------
    294 # NEG
    295 #------------------------------------------------------------------------------
    296 # CHECK: rsbs r3, r4, #0
    297 
    298 0x63 0x42
    299 
    300 
    301 #------------------------------------------------------------------------------
    302 # NOP
    303 #------------------------------------------------------------------------------
    304 # CHECK: nop
    305 
    306 0xc0 0x46
    307 
    308 
    309 #------------------------------------------------------------------------------
    310 # ORR
    311 #------------------------------------------------------------------------------
    312 # CHECK: orrs  r3, r4
    313 
    314 0x23 0x43
    315 
    316 #------------------------------------------------------------------------------
    317 # POP
    318 #------------------------------------------------------------------------------
    319 # CHECK: pop {r2, r3, r6}
    320 
    321 0x4c 0xbc
    322 
    323 
    324 #------------------------------------------------------------------------------
    325 # PUSH
    326 #------------------------------------------------------------------------------
    327 # CHECK: push {r1, r2, r7}
    328 
    329 0x86 0xb4
    330 
    331 
    332 #------------------------------------------------------------------------------
    333 # REV/REV16/REVSH
    334 #------------------------------------------------------------------------------
    335 # CHECK: rev r6, r3
    336 # CHECK: rev16 r7, r2
    337 # CHECK: revsh r5, r1
    338 
    339 0x1e 0xba
    340 0x57 0xba
    341 0xcd 0xba
    342 
    343 
    344 #------------------------------------------------------------------------------
    345 # ROR
    346 #------------------------------------------------------------------------------
    347 # CHECK: rors r2, r7
    348 
    349 0xfa 0x41
    350 
    351 #------------------------------------------------------------------------------
    352 # RSB
    353 #------------------------------------------------------------------------------
    354 # CHECK: rsbs r1, r3, #0
    355 
    356 0x59 0x42
    357 
    358 
    359 #------------------------------------------------------------------------------
    360 # SBC
    361 #------------------------------------------------------------------------------
    362 # CHECK: sbcs r4, r3
    363 
    364 0x9c 0x41
    365 
    366 
    367 #------------------------------------------------------------------------------
    368 # SETEND
    369 #------------------------------------------------------------------------------
    370 # CHECK: setend be
    371 # CHECK: setend le
    372 
    373 0x58 0xb6
    374 0x50 0xb6
    375 
    376 #------------------------------------------------------------------------------
    377 # STM
    378 #------------------------------------------------------------------------------
    379 # CHECK: stm r1!, {r2, r6}
    380 # CHECK: stm r1!, {r1, r2, r3, r7}
    381 
    382 0x44 0xc1
    383 0x8e 0xc1
    384 
    385 
    386 #------------------------------------------------------------------------------
    387 # STR (immediate)
    388 #------------------------------------------------------------------------------
    389 # CHECK: str r2, [r7]
    390 # CHECK: str r2, [r7]
    391 # CHECK: str r5, [r1, #4]
    392 # CHECK: str r3, [r7, #124]
    393 # CHECK: str r2, [sp]
    394 # CHECK: str r3, [sp]
    395 # CHECK: str r4, [sp, #20]
    396 # CHECK: str r5, [sp, #1020]
    397 
    398 0x3a 0x60
    399 0x3a 0x60
    400 0x4d 0x60
    401 0xfb 0x67
    402 0x00 0x92
    403 0x00 0x93
    404 0x05 0x94
    405 0xff 0x95
    406 
    407 
    408 #------------------------------------------------------------------------------
    409 # STR (register)
    410 #------------------------------------------------------------------------------
    411 # CHECK: str r2, [r7, r3]
    412 
    413 0xfa 0x50
    414 
    415 
    416 #------------------------------------------------------------------------------
    417 # STRB (immediate)
    418 #------------------------------------------------------------------------------
    419 # CHECK: strb r4, [r3]
    420 # CHECK: strb r5, [r6]
    421 # CHECK: strb r6, [r7, #31]
    422 
    423 0x1c 0x70
    424 0x35 0x70
    425 0xfe 0x77
    426 
    427 
    428 #------------------------------------------------------------------------------
    429 # STRB (register)
    430 #------------------------------------------------------------------------------
    431 # CHECK: strb r6, [r4, r5]
    432 
    433 0x66 0x55
    434 
    435 
    436 #------------------------------------------------------------------------------
    437 # STRH (immediate)
    438 #------------------------------------------------------------------------------
    439 # CHECK: strh r3, [r3]
    440 # CHECK: strh r4, [r6, #2]
    441 # CHECK: strh r5, [r7, #62]
    442 
    443 0x1b 0x80
    444 0x74 0x80
    445 0xfd 0x87
    446 
    447 
    448 #------------------------------------------------------------------------------
    449 # STRH (register)
    450 #------------------------------------------------------------------------------
    451 # CHECK: strh r6, [r2, r6]
    452 
    453 0x96 0x53
    454 
    455 
    456 #------------------------------------------------------------------------------
    457 # SUB (immediate)
    458 #------------------------------------------------------------------------------
    459 # CHECK: subs r1, r2, #3
    460 # CHECK: subs r2, #3
    461 # CHECK: subs r2, #8
    462 
    463 0xd1 0x1e
    464 0x03 0x3a
    465 0x08 0x3a
    466 
    467 #------------------------------------------------------------------------------
    468 # SUB (register)
    469 #------------------------------------------------------------------------------
    470 # CHECK: subs r1, r2, r3
    471 
    472 0xd1 0x1a
    473 
    474 #------------------------------------------------------------------------------
    475 # SUB (SP minus immediate)
    476 #------------------------------------------------------------------------------
    477 # CHECK: sub sp, #12
    478 # CHECK: sub sp, #508
    479 
    480 0x83 0xb0
    481 0xff 0xb0
    482 
    483 #------------------------------------------------------------------------------
    484 # SVC
    485 #------------------------------------------------------------------------------
    486 # CHECK: svc #0
    487 # CHECK: svc #255
    488 
    489 0x00 0xdf
    490 0xff 0xdf
    491 
    492 
    493 #------------------------------------------------------------------------------
    494 # SXTB/SXTH
    495 #------------------------------------------------------------------------------
    496 # CHECK: sxtb r3, r5
    497 # CHECK: sxth r3, r5
    498 
    499 0x6b 0xb2
    500 0x2b 0xb2
    501 
    502 
    503 #------------------------------------------------------------------------------
    504 # TST
    505 #------------------------------------------------------------------------------
    506 # CHECK: tst r6, r1
    507 
    508 0x0e 0x42
    509 
    510 
    511 #------------------------------------------------------------------------------
    512 # UXTB/UXTH
    513 #------------------------------------------------------------------------------
    514 # CHECK: uxtb  r7, r2
    515 # CHECK: uxth  r1, r4
    516 
    517 0xd7 0xb2
    518 0xa1 0xb2
    519 
    520 
    521 #------------------------------------------------------------------------------
    522 # WFE/WFI/YIELD
    523 #------------------------------------------------------------------------------
    524 # CHECK: wfe
    525 # CHECK: wfi
    526 # CHECK: yield
    527 
    528 0x20 0xbf
    529 0x30 0xbf
    530 0x10 0xbf
    531