Home | History | Annotate | Download | only in ARM
      1 # RUN: llvm-mc -triple=armv7-apple-darwin -disassemble < %s | FileCheck %s
      2 
      3 #------------------------------------------------------------------------------
      4 # LDR (immediate)
      5 #------------------------------------------------------------------------------
      6 # CHECK: ldr r5, [r7]
      7 # CHECK: ldr r6, [r3, #63]
      8 # CHECK: ldr r2, [r4, #4095]!
      9 # CHECK: ldr r1, [r2], #30
     10 # CHECK: ldr r3, [r1], #-30
     11 
     12 0x00 0x50 0x97 0xe5
     13 0x3f 0x60 0x93 0xe5
     14 0xff 0x2f 0xb4 0xe5
     15 0x1e 0x10 0x92 0xe4
     16 0x1e 0x30 0x11 0xe4
     17 
     18 #------------------------------------------------------------------------------
     19 # FIXME: LDR (literal)
     20 #------------------------------------------------------------------------------
     21 # label operands currently assert the show-encoding asm comment helper due
     22 # to the use of non-contiguous bit ranges for fixups in ARM. Once that's
     23 # cleaned up, we can write useful assembly testcases for these sorts of
     24 # instructions.
     25 
     26 #------------------------------------------------------------------------------
     27 # LDR (register)
     28 #------------------------------------------------------------------------------
     29 # CHECK: ldr r3, [r8, r1]
     30 # CHECK: ldr r2, [r5, -r3]
     31 # CHECK: ldr r1, [r5, r9]!
     32 # CHECK: ldr r6, [r7, -r8]!
     33 # CHECK: ldr r1, [r0, r2, lsr #3]!
     34 # CHECK: ldr r5, [r9], r2
     35 # CHECK: ldr r4, [r3], -r6
     36 # CHECK: ldr r3, [r8, -r2, lsl #15
     37 # CHECK: ldr r1, [r5], r3, asr #15
     38 
     39 0x01 0x30 0x98 0xe7
     40 0x03 0x20 0x15 0xe7
     41 0x09 0x10 0xb5 0xe7
     42 0x08 0x60 0x37 0xe7
     43 0xa2 0x11 0xb0 0xe7
     44 0x02 0x50 0x99 0xe6
     45 0x06 0x40 0x13 0xe6
     46 0x82 0x37 0x18 0xe7
     47 0xc3 0x17 0x95 0xe6
     48 
     49 
     50 #------------------------------------------------------------------------------
     51 # LDRB (immediate)
     52 #------------------------------------------------------------------------------
     53 # CHECK: ldrb r3, [r8]
     54 # CHECK: ldrb r1, [sp, #63]
     55 # CHECK: ldrb r9, [r3, #4095]!
     56 # CHECK: ldrb r8, [r1], #22
     57 # CHECK: ldrb r2, [r7], #-19
     58 
     59 0x00 0x30 0xd8 0xe5
     60 0x3f 0x10 0xdd 0xe5
     61 0xff 0x9f 0xf3 0xe5
     62 0x16 0x80 0xd1 0xe4
     63 0x13 0x20 0x57 0xe4
     64 
     65 
     66 #------------------------------------------------------------------------------
     67 # LDRB (register)
     68 #------------------------------------------------------------------------------
     69 # CHECK: ldrb r9, [r8, r5]
     70 # CHECK: ldrb r1, [r5, -r1]
     71 # CHECK: ldrb r3, [r5, r2]!
     72 # CHECK: ldrb r6, [r9, -r3]!
     73 # CHECK: ldrb r2, [r1], r4
     74 # CHECK: ldrb r8, [r4], -r5
     75 # CHECK: ldrb r7, [r12, -r1, lsl #15
     76 # CHECK: ldrb r5, [r2], r9, asr #15
     77 
     78 0x05 0x90 0xd8 0xe7
     79 0x01 0x10 0x55 0xe7
     80 0x02 0x30 0xf5 0xe7
     81 0x03 0x60 0x79 0xe7
     82 0x04 0x20 0xd1 0xe6
     83 0x05 0x80 0x54 0xe6
     84 0x81 0x77 0x5c 0xe7
     85 0xc9 0x57 0xd2 0xe6
     86 
     87 
     88 #------------------------------------------------------------------------------
     89 # LDRBT
     90 #------------------------------------------------------------------------------
     91 # FIXME: Optional offset operand.
     92 # CHECK: ldrbt r3, [r1], #4
     93 # CHECK: ldrbt r2, [r8], #-8
     94 # CHECK: ldrbt r8, [r7], r6
     95 # CHECK: ldrbt r1, [r2], -r6, lsl #12
     96 
     97 
     98 0x04 0x30 0xf1 0xe4
     99 0x08 0x20 0x78 0xe4
    100 0x06 0x80 0xf7 0xe6
    101 0x06 0x16 0x72 0xe6
    102 
    103 
    104 #------------------------------------------------------------------------------
    105 # LDRD (immediate)
    106 #------------------------------------------------------------------------------
    107 # CHECK: ldrd r0, r1, [r5]
    108 # CHECK: ldrd r8, r9, [r2, #15]
    109 # CHECK: ldrd r2, r3, [r9, #32]!
    110 # CHECK: ldrd r6, r7, [r1], #8
    111 # CHECK: ldrd r2, r3, [r8], #0
    112 # CHECK: ldrd r2, r3, [r8], #0
    113 # CHECK: ldrd r2, r3, [r8], #-0
    114 
    115 0xd0 0x00 0xc5 0xe1
    116 0xdf 0x80 0xc2 0xe1
    117 0xd0 0x22 0xe9 0xe1
    118 0xd8 0x60 0xc1 0xe0
    119 0xd0 0x20 0xc8 0xe0
    120 0xd0 0x20 0xc8 0xe0
    121 0xd0 0x20 0x48 0xe0
    122 
    123 
    124 #------------------------------------------------------------------------------
    125 # FIXME: LDRD (label)
    126 #------------------------------------------------------------------------------
    127 
    128 #------------------------------------------------------------------------------
    129 # LDRD (register)
    130 #------------------------------------------------------------------------------
    131 # CHECK: ldrd r4, r5, [r1, r3]
    132 # CHECK: ldrd r4, r5, [r7, r2]!
    133 # CHECK: ldrd r0, r1, [r8], r12
    134 # CHECK: ldrd r0, r1, [r8], -r12
    135 
    136 0xd3 0x40 0x81 0xe1
    137 0xd2 0x40 0xa7 0xe1
    138 0xdc 0x00 0x88 0xe0
    139 0xdc 0x00 0x08 0xe0
    140 
    141 
    142 #------------------------------------------------------------------------------
    143 # LDRH (immediate)
    144 #------------------------------------------------------------------------------
    145 # CHECK: ldrh r3, [r4
    146 # CHECK: ldrh r2, [r7, #4
    147 # CHECK: ldrh r1, [r8, #64]!
    148 # CHECK: ldrh r12, [sp], #4
    149 
    150 0xb0 0x30 0xd4 0xe1
    151 0xb4 0x20 0xd7 0xe1
    152 0xb0 0x14 0xf8 0xe1
    153 0xb4 0xc0 0xdd 0xe0
    154 
    155 
    156 #------------------------------------------------------------------------------
    157 # FIXME: LDRH (label)
    158 #------------------------------------------------------------------------------
    159 
    160 
    161 #------------------------------------------------------------------------------
    162 # LDRH (register)
    163 #------------------------------------------------------------------------------
    164 # CHECK: ldrh r6, [r5, r4
    165 # CHECK: ldrh r3, [r8, r11]!
    166 # CHECK: ldrh r1, [r2, -r1]!
    167 # CHECK: ldrh r9, [r7], r2
    168 # CHECK: ldrh r4, [r3], -r2
    169 
    170 0xb4 0x60 0x95 0xe1
    171 0xbb 0x30 0xb8 0xe1
    172 0xb1 0x10 0x32 0xe1
    173 0xb2 0x90 0x97 0xe0
    174 0xb2 0x40 0x13 0xe0
    175 
    176 
    177 #------------------------------------------------------------------------------
    178 # LDRHT
    179 #------------------------------------------------------------------------------
    180 # CHECK: ldrht r9, [r7], #128
    181 # CHECK: ldrht r4, [r3], #-75
    182 # CHECK: ldrht r9, [r7], r2
    183 # CHECK: ldrht r4, [r3], -r2
    184 
    185 0xb0 0x98 0xf7 0xe0
    186 0xbb 0x44 0x73 0xe0
    187 0xb2 0x90 0xb7 0xe0
    188 0xb2 0x40 0x33 0xe0
    189 
    190 
    191 #------------------------------------------------------------------------------
    192 # LDRSB (immediate)
    193 #------------------------------------------------------------------------------
    194 # CHECK: ldrsb r3, [r4
    195 # CHECK: ldrsb r2, [r7, #17
    196 # CHECK: ldrsb r1, [r8, #255]!
    197 # CHECK: ldrsb r12, [sp], #9
    198 
    199 0xd0 0x30 0xd4 0xe1
    200 0xd1 0x21 0xd7 0xe1
    201 0xdf 0x1f 0xf8 0xe1
    202 0xd9 0xc0 0xdd 0xe0
    203 
    204 
    205 #------------------------------------------------------------------------------
    206 # FIXME: LDRSB (label)
    207 #------------------------------------------------------------------------------
    208 
    209 
    210 #------------------------------------------------------------------------------
    211 # LDRSB (register)
    212 #------------------------------------------------------------------------------
    213 # CHECK: ldrsb r6, [r5, r4
    214 # CHECK: ldrsb r3, [r8, r11]!
    215 # CHECK: ldrsb r1, [r2, -r1]!
    216 # CHECK: ldrsb r9, [r7], r2
    217 # CHECK: ldrsb r4, [r3], -r2
    218 
    219 
    220 0xd4 0x60 0x95 0xe1
    221 0xdb 0x30 0xb8 0xe1
    222 0xd1 0x10 0x32 0xe1
    223 0xd2 0x90 0x97 0xe0
    224 0xd2 0x40 0x13 0xe0
    225 
    226 
    227 #------------------------------------------------------------------------------
    228 # LDRSBT
    229 #------------------------------------------------------------------------------
    230 # CHECK: ldrsbt r5, [r6], #1
    231 # CHECK: ldrsbt r3, [r8], #-12
    232 # CHECK: ldrsbt r8, [r9], r5
    233 # CHECK: ldrsbt r2, [r1], -r4
    234 
    235 0xd1 0x50 0xf6 0xe0
    236 0xdc 0x30 0x78 0xe0
    237 0xd5 0x80 0xb9 0xe0
    238 0xd4 0x20 0x31 0xe0
    239 
    240 
    241 #------------------------------------------------------------------------------
    242 # LDRSH (immediate)
    243 #------------------------------------------------------------------------------
    244 # CHECK: ldrsh r5, [r9
    245 # CHECK: ldrsh r4, [r5, #7
    246 # CHECK: ldrsh r3, [r6, #55]!
    247 # CHECK: ldrsh r2, [r7], #-9
    248 
    249 0xf0 0x50 0xd9 0xe1
    250 0xf7 0x40 0xd5 0xe1
    251 0xf7 0x33 0xf6 0xe1
    252 0xf9 0x20 0x57 0xe0
    253 
    254 
    255 #------------------------------------------------------------------------------
    256 # FIXME: LDRSH (label)
    257 #------------------------------------------------------------------------------
    258 
    259 
    260 #------------------------------------------------------------------------------
    261 # LDRSH (register)
    262 #------------------------------------------------------------------------------
    263 # CHECK: ldrsh r3, [r1, r5
    264 # CHECK: ldrsh r4, [r6, r1]!
    265 # CHECK: ldrsh r5, [r3, -r6]!
    266 # CHECK: ldrsh r6, [r9], r8
    267 # CHECK: ldrsh r7, [r8], -r3
    268 
    269 0xf5 0x30 0x91 0xe1
    270 0xf1 0x40 0xb6 0xe1
    271 0xf6 0x50 0x33 0xe1
    272 0xf8 0x60 0x99 0xe0
    273 0xf3 0x70 0x18 0xe0
    274 
    275 
    276 #------------------------------------------------------------------------------
    277 # LDRSHT
    278 #------------------------------------------------------------------------------
    279 # CHECK: ldrsht r5, [r6], #1
    280 # CHECK: ldrsht r3, [r8], #-12
    281 # CHECK: ldrsht r8, [r9], r5
    282 # CHECK: ldrsht r2, [r1], -r4
    283 
    284 0xf1 0x50 0xf6 0xe0
    285 0xfc 0x30 0x78 0xe0
    286 0xf5 0x80 0xb9 0xe0
    287 0xf4 0x20 0x31 0xe0
    288 
    289 
    290 #------------------------------------------------------------------------------
    291 # STR (immediate)
    292 #------------------------------------------------------------------------------
    293 # CHECK: str r8, [r12
    294 # CHECK: str r7, [r1, #12
    295 # CHECK: str r3, [r5, #40]!
    296 # CHECK: str r9, [sp], #4095
    297 # CHECK: str r1, [r7], #-128
    298 
    299 0x00 0x80 0x8c 0xe5
    300 0x0c 0x70 0x81 0xe5
    301 0x28 0x30 0xa5 0xe5
    302 0xff 0x9f 0x8d 0xe4
    303 0x80 0x10 0x07 0xe4
    304 
    305 
    306 #------------------------------------------------------------------------------
    307 # FIXME: STR (literal)
    308 #------------------------------------------------------------------------------
    309 
    310 #------------------------------------------------------------------------------
    311 # STR (register)
    312 #------------------------------------------------------------------------------
    313 # CHECK: str r9, [r6, r3
    314 # CHECK: str r8, [r0, -r2
    315 # CHECK: str r7, [r1, r6]!
    316 # CHECK: str r6, [sp, -r1]!
    317 # CHECK: str r5, [r3], r9
    318 # CHECK: str r4, [r2], -r5
    319 # CHECK: str r3, [r4, -r2, lsl #2
    320 # CHECK: str r2, [r7], r3, asr #24
    321 
    322 0x03 0x90 0x86 0xe7
    323 0x02 0x80 0x00 0xe7
    324 0x06 0x70 0xa1 0xe7
    325 0x01 0x60 0x2d 0xe7
    326 0x09 0x50 0x83 0xe6
    327 0x05 0x40 0x02 0xe6
    328 0x02 0x31 0x04 0xe7
    329 0x43 0x2c 0x87 0xe6
    330 
    331 
    332 #------------------------------------------------------------------------------
    333 # STRB (immediate)
    334 #------------------------------------------------------------------------------
    335 # CHECK: strb r9, [r2
    336 # CHECK: strb r7, [r1, #3
    337 # CHECK: strb r6, [r4, #405]!
    338 # CHECK: strb r5, [r7], #72
    339 # CHECK: strb r1, [sp], #-1
    340 
    341 0x00 0x90 0xc2 0xe5
    342 0x03 0x70 0xc1 0xe5
    343 0x95 0x61 0xe4 0xe5
    344 0x48 0x50 0xc7 0xe4
    345 0x01 0x10 0x4d 0xe4
    346 
    347 #------------------------------------------------------------------------------
    348 # FIXME: STRB (literal)
    349 #------------------------------------------------------------------------------
    350 
    351 #------------------------------------------------------------------------------
    352 # STRB (register)
    353 #------------------------------------------------------------------------------
    354 # CHECK: strb r1, [r2, r9
    355 # CHECK: strb r2, [r3, -r8
    356 # CHECK: strb r3, [r4, r7]!
    357 # CHECK: strb r4, [r5, -r6]!
    358 # CHECK: strb r5, [r6], r5
    359 # CHECK: strb r6, [r2], -r4
    360 # CHECK: strb r7, [r12, -r3, lsl #5
    361 # CHECK: strb sp, [r7], r2, asr #12
    362 
    363 0x09 0x10 0xc2 0xe7
    364 0x08 0x20 0x43 0xe7
    365 0x07 0x30 0xe4 0xe7
    366 0x06 0x40 0x65 0xe7
    367 0x05 0x50 0xc6 0xe6
    368 0x04 0x60 0x42 0xe6
    369 0x83 0x72 0x4c 0xe7
    370 0x42 0xd6 0xc7 0xe6
    371 
    372 
    373 #------------------------------------------------------------------------------
    374 # STRBT
    375 #------------------------------------------------------------------------------
    376 # FIXME: Optional offset operand.
    377 # CHECK: strbt r6, [r2], #12
    378 # CHECK: strbt r5, [r6], #-13
    379 # CHECK: strbt r4, [r9], r5
    380 # CHECK: strbt r3, [r8], -r2, lsl #3
    381 
    382 0x0c 0x60 0xe2 0xe4
    383 0x0d 0x50 0x66 0xe4
    384 0x05 0x40 0xe9 0xe6
    385 0x82 0x31 0x68 0xe6
    386 
    387 
    388 #------------------------------------------------------------------------------
    389 # STRD (immediate)
    390 #------------------------------------------------------------------------------
    391 # CHECK: strd r0, r1, [r4]
    392 # CHECK: strd r2, r3, [r6, #1]
    393 # CHECK: strd r2, r3, [r7, #22]!
    394 # CHECK: strd r4, r5, [r8], #7
    395 # CHECK: strd r4, r5, [sp], #0
    396 # CHECK: strd r6, r7, [lr], #0
    397 # CHECK: strd r6, r7, [r9], #-0
    398 
    399 0xf0 0x00 0xc4 0xe1
    400 0xf1 0x20 0xc6 0xe1
    401 0xf6 0x21 0xe7 0xe1
    402 0xf7 0x40 0xc8 0xe0
    403 0xf0 0x40 0xcd 0xe0
    404 0xf0 0x60 0xce 0xe0
    405 0xf0 0x60 0x49 0xe0
    406 
    407 
    408 #------------------------------------------------------------------------------
    409 # FIXME: STRD (label)
    410 #------------------------------------------------------------------------------
    411 
    412 #------------------------------------------------------------------------------
    413 # STRD (register)
    414 #------------------------------------------------------------------------------
    415 # CHECK: strd r8, r9, [r4, r1]
    416 # CHECK: strd r6, r7, [r3, r9]!
    417 # CHECK: strd r6, r7, [r5], r8
    418 # CHECK: strd r4, r5, [r12], -r10
    419 
    420 0xf1 0x80 0x84 0xe1
    421 0xf9 0x60 0xa3 0xe1
    422 0xf8 0x60 0x85 0xe0
    423 0xfa 0x40 0x0c 0xe0
    424 
    425 #------------------------------------------------------------------------------
    426 # STRH (immediate)
    427 #------------------------------------------------------------------------------
    428 # CHECK: strh r3, [r4
    429 # CHECK: strh r2, [r7, #4
    430 # CHECK: strh r1, [r8, #64]!
    431 # CHECK: strh r12, [sp], #4
    432 
    433 0xb0 0x30 0xc4 0xe1
    434 0xb4 0x20 0xc7 0xe1
    435 0xb0 0x14 0xe8 0xe1
    436 0xb4 0xc0 0xcd 0xe0
    437 
    438 
    439 #------------------------------------------------------------------------------
    440 # FIXME: STRH (label)
    441 #------------------------------------------------------------------------------
    442 
    443 
    444 #------------------------------------------------------------------------------
    445 # STRH (register)
    446 #------------------------------------------------------------------------------
    447 # CHECK: strh r6, [r5, r4
    448 # CHECK: strh r3, [r8, r11]!
    449 # CHECK: strh r1, [r2, -r1]!
    450 # CHECK: strh r9, [r7], r2
    451 # CHECK: strh r4, [r3], -r2
    452 
    453 0xb4 0x60 0x85 0xe1
    454 0xbb 0x30 0xa8 0xe1
    455 0xb1 0x10 0x22 0xe1
    456 0xb2 0x90 0x87 0xe0
    457 0xb2 0x40 0x03 0xe0
    458 
    459 #------------------------------------------------------------------------------
    460 # STRHT
    461 #------------------------------------------------------------------------------
    462 # CHECK: strht r2, [r5], #76
    463 # CHECK: strht r8, [r1], #-25
    464 # CHECK: strht r5, [r3], r4
    465 # CHECK: strht r6, [r8], -r0
    466 
    467 0xbc 0x24 0xe5 0xe0
    468 0xb9 0x81 0x61 0xe0
    469 0xb4 0x50 0xa3 0xe0
    470 0xb0 0x60 0x28 0xe0
    471