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 120x00 0x50 0x97 0xe5 130x3f 0x60 0x93 0xe5 140xff 0x2f 0xb4 0xe5 150x1e 0x10 0x92 0xe4 160x1e 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 390x01 0x30 0x98 0xe7 400x03 0x20 0x15 0xe7 410x09 0x10 0xb5 0xe7 420x08 0x60 0x37 0xe7 430xa2 0x11 0xb0 0xe7 440x02 0x50 0x99 0xe6 450x06 0x40 0x13 0xe6 460x82 0x37 0x18 0xe7 470xc3 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 590x00 0x30 0xd8 0xe5 600x3f 0x10 0xdd 0xe5 610xff 0x9f 0xf3 0xe5 620x16 0x80 0xd1 0xe4 630x13 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 780x05 0x90 0xd8 0xe7 790x01 0x10 0x55 0xe7 800x02 0x30 0xf5 0xe7 810x03 0x60 0x79 0xe7 820x04 0x20 0xd1 0xe6 830x05 0x80 0x54 0xe6 840x81 0x77 0x5c 0xe7 850xc9 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 980x04 0x30 0xf1 0xe4 990x08 0x20 0x78 0xe4 1000x06 0x80 0xf7 0xe6 1010x06 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 1150xd0 0x00 0xc5 0xe1 1160xdf 0x80 0xc2 0xe1 1170xd0 0x22 0xe9 0xe1 1180xd8 0x60 0xc1 0xe0 1190xd0 0x20 0xc8 0xe0 1200xd0 0x20 0xc8 0xe0 1210xd0 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 1360xd3 0x40 0x81 0xe1 1370xd2 0x40 0xa7 0xe1 1380xdc 0x00 0x88 0xe0 1390xdc 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 1500xb0 0x30 0xd4 0xe1 1510xb4 0x20 0xd7 0xe1 1520xb0 0x14 0xf8 0xe1 1530xb4 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 1700xb4 0x60 0x95 0xe1 1710xbb 0x30 0xb8 0xe1 1720xb1 0x10 0x32 0xe1 1730xb2 0x90 0x97 0xe0 1740xb2 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 1850xb0 0x98 0xf7 0xe0 1860xbb 0x44 0x73 0xe0 1870xb2 0x90 0xb7 0xe0 1880xb2 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 1990xd0 0x30 0xd4 0xe1 2000xd1 0x21 0xd7 0xe1 2010xdf 0x1f 0xf8 0xe1 2020xd9 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 2200xd4 0x60 0x95 0xe1 2210xdb 0x30 0xb8 0xe1 2220xd1 0x10 0x32 0xe1 2230xd2 0x90 0x97 0xe0 2240xd2 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 2350xd1 0x50 0xf6 0xe0 2360xdc 0x30 0x78 0xe0 2370xd5 0x80 0xb9 0xe0 2380xd4 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 2490xf0 0x50 0xd9 0xe1 2500xf7 0x40 0xd5 0xe1 2510xf7 0x33 0xf6 0xe1 2520xf9 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 2690xf5 0x30 0x91 0xe1 2700xf1 0x40 0xb6 0xe1 2710xf6 0x50 0x33 0xe1 2720xf8 0x60 0x99 0xe0 2730xf3 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 2840xf1 0x50 0xf6 0xe0 2850xfc 0x30 0x78 0xe0 2860xf5 0x80 0xb9 0xe0 2870xf4 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 2990x00 0x80 0x8c 0xe5 3000x0c 0x70 0x81 0xe5 3010x28 0x30 0xa5 0xe5 3020xff 0x9f 0x8d 0xe4 3030x80 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 3220x03 0x90 0x86 0xe7 3230x02 0x80 0x00 0xe7 3240x06 0x70 0xa1 0xe7 3250x01 0x60 0x2d 0xe7 3260x09 0x50 0x83 0xe6 3270x05 0x40 0x02 0xe6 3280x02 0x31 0x04 0xe7 3290x43 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 3410x00 0x90 0xc2 0xe5 3420x03 0x70 0xc1 0xe5 3430x95 0x61 0xe4 0xe5 3440x48 0x50 0xc7 0xe4 3450x01 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 3630x09 0x10 0xc2 0xe7 3640x08 0x20 0x43 0xe7 3650x07 0x30 0xe4 0xe7 3660x06 0x40 0x65 0xe7 3670x05 0x50 0xc6 0xe6 3680x04 0x60 0x42 0xe6 3690x83 0x72 0x4c 0xe7 3700x42 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 3820x0c 0x60 0xe2 0xe4 3830x0d 0x50 0x66 0xe4 3840x05 0x40 0xe9 0xe6 3850x82 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 3990xf0 0x00 0xc4 0xe1 4000xf1 0x20 0xc6 0xe1 4010xf6 0x21 0xe7 0xe1 4020xf7 0x40 0xc8 0xe0 4030xf0 0x40 0xcd 0xe0 4040xf0 0x60 0xce 0xe0 4050xf0 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 4200xf1 0x80 0x84 0xe1 4210xf9 0x60 0xa3 0xe1 4220xf8 0x60 0x85 0xe0 4230xfa 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 4330xb0 0x30 0xc4 0xe1 4340xb4 0x20 0xc7 0xe1 4350xb0 0x14 0xe8 0xe1 4360xb4 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 4530xb4 0x60 0x85 0xe1 4540xbb 0x30 0xa8 0xe1 4550xb1 0x10 0x22 0xe1 4560xb2 0x90 0x87 0xe0 4570xb2 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 4670xbc 0x24 0xe5 0xe0 4680xb9 0x81 0x61 0xe0 4690xb4 0x50 0xa3 0xe0 4700xb0 0x60 0x28 0xe0 471