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