basic-thumb2-instructions.s revision 8bb5a861a0efae6b9c8f07936ad9bb3508ada23e
1@ RUN: llvm-mc -triple=thumbv7-apple-darwin -show-encoding < %s | FileCheck %s 2 .syntax unified 3 .globl _func 4 5@ Check that the assembler can handle the documented syntax from the ARM ARM. 6@ For complex constructs like shifter operands, check more thoroughly for them 7@ once then spot check that following instructions accept the form generally. 8@ This gives us good coverage while keeping the overall size of the test 9@ more reasonable. 10 11 12@ FIXME: Some 3-operand instructions have a 2-operand assembly syntax. 13 14_func: 15@ CHECK: _func 16 17@------------------------------------------------------------------------------ 18@ ADC (immediate) 19@------------------------------------------------------------------------------ 20 adc r0, r1, #4 21 adcs r0, r1, #0 22 adc r1, r2, #255 23 adc r3, r7, #0x00550055 24 adc r8, r12, #0xaa00aa00 25 adc r9, r7, #0xa5a5a5a5 26 adc r5, r3, #0x87000000 27 adc r4, r2, #0x7f800000 28 adc r4, r2, #0x00000680 29 30@ CHECK: adc r0, r1, #4 @ encoding: [0x41,0xf1,0x04,0x00] 31@ CHECK: adcs r0, r1, #0 @ encoding: [0x51,0xf1,0x00,0x00] 32@ CHECK: adc r1, r2, #255 @ encoding: [0x42,0xf1,0xff,0x01] 33@ CHECK: adc r3, r7, #5570645 @ encoding: [0x47,0xf1,0x55,0x13] 34@ CHECK: adc r8, r12, #2852170240 @ encoding: [0x4c,0xf1,0xaa,0x28] 35@ CHECK: adc r9, r7, #2779096485 @ encoding: [0x47,0xf1,0xa5,0x39] 36@ CHECK: adc r5, r3, #2264924160 @ encoding: [0x43,0xf1,0x07,0x45] 37@ CHECK: adc r4, r2, #2139095040 @ encoding: [0x42,0xf1,0xff,0x44] 38@ CHECK: adc r4, r2, #1664 @ encoding: [0x42,0xf5,0xd0,0x64] 39 40@------------------------------------------------------------------------------ 41@ ADC (register) 42@------------------------------------------------------------------------------ 43 adc r4, r5, r6 44 adcs r4, r5, r6 45 adc.w r9, r1, r3 46 adcs.w r9, r1, r3 47 adc r0, r1, r3, ror #4 48 adcs r0, r1, r3, lsl #7 49 adc.w r0, r1, r3, lsr #31 50 adcs.w r0, r1, r3, asr #32 51 52@ CHECK: adc.w r4, r5, r6 @ encoding: [0x45,0xeb,0x06,0x04] 53@ CHECK: adcs.w r4, r5, r6 @ encoding: [0x55,0xeb,0x06,0x04] 54@ CHECK: adc.w r9, r1, r3 @ encoding: [0x41,0xeb,0x03,0x09] 55@ CHECK: adcs.w r9, r1, r3 @ encoding: [0x51,0xeb,0x03,0x09] 56@ CHECK: adc.w r0, r1, r3, ror #4 @ encoding: [0x41,0xeb,0x33,0x10] 57@ CHECK: adcs.w r0, r1, r3, lsl #7 @ encoding: [0x51,0xeb,0xc3,0x10] 58@ CHECK: adc.w r0, r1, r3, lsr #31 @ encoding: [0x41,0xeb,0xd3,0x70] 59@ CHECK: adcs.w r0, r1, r3, asr #32 @ encoding: [0x51,0xeb,0x23,0x00] 60 61 62@------------------------------------------------------------------------------ 63@ ADD (immediate) 64@------------------------------------------------------------------------------ 65 itet eq 66 addeq r1, r2, #4 67 addwne r5, r3, #1023 68 addeq r4, r5, #293 69 add r2, sp, #1024 70 add r2, r8, #0xff00 71 add r2, r3, #257 72 addw r2, r3, #257 73 add r12, r6, #0x100 74 addw r12, r6, #0x100 75 adds r1, r2, #0x1f0 76 77@ CHECK: itet eq @ encoding: [0x0a,0xbf] 78@ CHECK: addeq r1, r2, #4 @ encoding: [0x11,0x1d] 79@ CHECK: addwne r5, r3, #1023 @ encoding: [0x03,0xf2,0xff,0x35] 80@ CHECK: addweq r4, r5, #293 @ encoding: [0x05,0xf2,0x25,0x14] 81@ CHECK: add.w r2, sp, #1024 @ encoding: [0x0d,0xf5,0x80,0x62] 82@ CHECK: add.w r2, r8, #65280 @ encoding: [0x08,0xf5,0x7f,0x42] 83@ CHECK: addw r2, r3, #257 @ encoding: [0x03,0xf2,0x01,0x12] 84@ CHECK: addw r2, r3, #257 @ encoding: [0x03,0xf2,0x01,0x12] 85@ CHECK: add.w r12, r6, #256 @ encoding: [0x06,0xf5,0x80,0x7c] 86@ CHECK: addw r12, r6, #256 @ encoding: [0x06,0xf2,0x00,0x1c] 87@ CHECK: adds.w r1, r2, #496 @ encoding: [0x12,0xf5,0xf8,0x71] 88 89 90@------------------------------------------------------------------------------ 91@ ADD (register) 92@------------------------------------------------------------------------------ 93 add r1, r2, r8 94 add r5, r9, r2, asr #32 95 adds r7, r3, r1, lsl #31 96 adds.w r0, r3, r6, lsr #25 97 add.w r4, r8, r1, ror #12 98 99@ CHECK: add.w r1, r2, r8 @ encoding: [0x02,0xeb,0x08,0x01] 100@ CHECK: add.w r5, r9, r2, asr #32 @ encoding: [0x09,0xeb,0x22,0x05] 101@ CHECK: adds.w r7, r3, r1, lsl #31 @ encoding: [0x13,0xeb,0xc1,0x77] 102@ CHECK: adds.w r0, r3, r6, lsr #25 @ encoding: [0x13,0xeb,0x56,0x60] 103@ CHECK: add.w r4, r8, r1, ror #12 @ encoding: [0x08,0xeb,0x31,0x34] 104 105 106@------------------------------------------------------------------------------ 107@ FIXME: ADR 108@------------------------------------------------------------------------------ 109 110@------------------------------------------------------------------------------ 111@ AND (immediate) 112@------------------------------------------------------------------------------ 113 and r2, r5, #0xff000 114 ands r3, r12, #0xf 115 and r1, #0xff 116 and r1, r1, #0xff 117 118@ CHECK: and r2, r5, #1044480 @ encoding: [0x05,0xf4,0x7f,0x22] 119@ CHECK: ands r3, r12, #15 @ encoding: [0x1c,0xf0,0x0f,0x03] 120@ CHECK: and r1, r1, #255 @ encoding: [0x01,0xf0,0xff,0x01] 121@ CHECK: and r1, r1, #255 @ encoding: [0x01,0xf0,0xff,0x01] 122 123 124@------------------------------------------------------------------------------ 125@ AND (register) 126@------------------------------------------------------------------------------ 127 and r4, r9, r8 128 and r1, r4, r8, asr #3 129 ands r2, r1, r7, lsl #1 130 ands.w r4, r5, r2, lsr #20 131 and.w r9, r12, r1, ror #17 132 133@ CHECK: and.w r4, r9, r8 @ encoding: [0x09,0xea,0x08,0x04] 134@ CHECK: and.w r1, r4, r8, asr #3 @ encoding: [0x04,0xea,0xe8,0x01] 135@ CHECK: ands.w r2, r1, r7, lsl #1 @ encoding: [0x11,0xea,0x47,0x02] 136@ CHECK: ands.w r4, r5, r2, lsr #20 @ encoding: [0x15,0xea,0x12,0x54] 137@ CHECK: and.w r9, r12, r1, ror #17 @ encoding: [0x0c,0xea,0x71,0x49] 138 139@------------------------------------------------------------------------------ 140@ ASR (immediate) 141@------------------------------------------------------------------------------ 142 asr r2, r3, #12 143 asrs r8, r3, #32 144 asrs.w r2, r3, #1 145 asr r2, r3, #4 146 asrs r2, r12, #15 147 148 asr r3, #19 149 asrs r8, #2 150 asrs.w r7, #5 151 asr.w r12, #21 152 153@ CHECK: asr.w r2, r3, #12 @ encoding: [0x4f,0xea,0x23,0x32] 154@ CHECK: asrs.w r8, r3, #32 @ encoding: [0x5f,0xea,0x23,0x08] 155@ CHECK: asrs.w r2, r3, #1 @ encoding: [0x5f,0xea,0x63,0x02] 156@ CHECK: asr.w r2, r3, #4 @ encoding: [0x4f,0xea,0x23,0x12] 157@ CHECK: asrs.w r2, r12, #15 @ encoding: [0x5f,0xea,0xec,0x32] 158 159@ CHECK: asr.w r3, r3, #19 @ encoding: [0x4f,0xea,0xe3,0x43] 160@ CHECK: asrs.w r8, r8, #2 @ encoding: [0x5f,0xea,0xa8,0x08] 161@ CHECK: asrs.w r7, r7, #5 @ encoding: [0x5f,0xea,0x67,0x17] 162@ CHECK: asr.w r12, r12, #21 @ encoding: [0x4f,0xea,0x6c,0x5c] 163 164 165@------------------------------------------------------------------------------ 166@ ASR (register) 167@------------------------------------------------------------------------------ 168 asr r3, r4, r2 169 asr.w r1, r2 170 asrs r3, r4, r8 171 172@ CHECK: asr.w r3, r4, r2 @ encoding: [0x44,0xfa,0x02,0xf3] 173@ CHECK: asr.w r1, r1, r2 @ encoding: [0x41,0xfa,0x02,0xf1] 174@ CHECK: asrs.w r3, r4, r8 @ encoding: [0x54,0xfa,0x08,0xf3] 175 176 177@------------------------------------------------------------------------------ 178@ B 179@------------------------------------------------------------------------------ 180 b.w _bar 181 beq.w _bar 182 it eq 183 beq.w _bar 184 bmi.w #-183396 185 186@ CHECK: b.w _bar @ encoding: [A,0xf0'A',A,0x90'A'] 187 @ fixup A - offset: 0, value: _bar, kind: fixup_t2_uncondbranch 188@ CHECK: beq.w _bar @ encoding: [A,0xf0'A',A,0x80'A'] 189 @ fixup A - offset: 0, value: _bar, kind: fixup_t2_condbranch 190@ CHECK: it eq @ encoding: [0x08,0xbf] 191@ CHECK: b.w _bar @ encoding: [A,0xf0'A',A,0x90'A'] 192 @ fixup A - offset: 0, value: _bar, kind: fixup_t2_uncondbranch 193@ CHECK: bmi.w #-183396 @ encoding: [0x13,0xf5,0xce,0xa9] 194 195 196@------------------------------------------------------------------------------ 197@ BFC 198@------------------------------------------------------------------------------ 199 bfc r5, #3, #17 200 it lo 201 bfccc r5, #3, #17 202 203@ CHECK: bfc r5, #3, #17 @ encoding: [0x6f,0xf3,0xd3,0x05] 204@ CHECK: it lo @ encoding: [0x38,0xbf] 205@ CHECK: bfclo r5, #3, #17 @ encoding: [0x6f,0xf3,0xd3,0x05] 206 207 208@------------------------------------------------------------------------------ 209@ BFI 210@------------------------------------------------------------------------------ 211 bfi r5, r2, #3, #17 212 it ne 213 bfine r5, r2, #3, #17 214 215@ CHECK: bfi r5, r2, #3, #17 @ encoding: [0x62,0xf3,0xd3,0x05] 216@ CHECK: it ne @ encoding: [0x18,0xbf] 217@ CHECK: bfine r5, r2, #3, #17 @ encoding: [0x62,0xf3,0xd3,0x05] 218 219 220@------------------------------------------------------------------------------ 221@ BIC 222@------------------------------------------------------------------------------ 223 bic r10, r1, #0xf 224 bic r12, r3, r6 225 bic r11, r2, r6, lsl #12 226 bic r8, r4, r1, lsr #11 227 bic r7, r5, r7, lsr #15 228 bic r6, r7, r9, asr #32 229 bic r5, r6, r8, ror #1 230 231 @ destination register is optional 232 bic r1, #0xf 233 bic r1, r1 234 bic r4, r2, lsl #31 235 bic r6, r3, lsr #12 236 bic r7, r4, lsr #7 237 bic r8, r5, asr #15 238 bic r12, r6, ror #29 239 240@ CHECK: bic r10, r1, #15 @ encoding: [0x21,0xf0,0x0f,0x0a] 241@ CHECK: bic.w r12, r3, r6 @ encoding: [0x23,0xea,0x06,0x0c] 242@ CHECK: bic.w r11, r2, r6, lsl #12 @ encoding: [0x22,0xea,0x06,0x3b] 243@ CHECK: bic.w r8, r4, r1, lsr #11 @ encoding: [0x24,0xea,0xd1,0x28] 244@ CHECK: bic.w r7, r5, r7, lsr #15 @ encoding: [0x25,0xea,0xd7,0x37] 245@ CHECK: bic.w r6, r7, r9, asr #32 @ encoding: [0x27,0xea,0x29,0x06] 246@ CHECK: bic.w r5, r6, r8, ror #1 @ encoding: [0x26,0xea,0x78,0x05] 247 248@ CHECK: bic r1, r1, #15 @ encoding: [0x21,0xf0,0x0f,0x01] 249@ CHECK: bic.w r1, r1, r1 @ encoding: [0x21,0xea,0x01,0x01] 250@ CHECK: bic.w r4, r4, r2, lsl #31 @ encoding: [0x24,0xea,0xc2,0x74] 251@ CHECK: bic.w r6, r6, r3, lsr #12 @ encoding: [0x26,0xea,0x13,0x36] 252@ CHECK: bic.w r7, r7, r4, lsr #7 @ encoding: [0x27,0xea,0xd4,0x17] 253@ CHECK: bic.w r8, r8, r5, asr #15 @ encoding: [0x28,0xea,0xe5,0x38] 254@ CHECK: bic.w r12, r12, r6, ror #29 @ encoding: [0x2c,0xea,0x76,0x7c] 255 256 257@------------------------------------------------------------------------------ 258@ BXJ 259@------------------------------------------------------------------------------ 260 bxj r5 261 it ne 262 bxjne r7 263 264@ CHECK: bxj r5 @ encoding: [0xc5,0xf3,0x00,0x8f] 265@ CHECK: it ne @ encoding: [0x18,0xbf] 266@ CHECK: bxjne r7 @ encoding: [0xc7,0xf3,0x00,0x8f] 267 268 269@------------------------------------------------------------------------------ 270@ CBZ/CBNZ 271@------------------------------------------------------------------------------ 272 cbnz r7, #6 273 cbnz r7, #12 274 cbz r6, _bar 275 cbnz r6, _bar 276 277@ CHECK: cbnz r7, #6 @ encoding: [0x1f,0xb9] 278@ CHECK: cbnz r7, #12 @ encoding: [0x37,0xb9] 279@ CHECK: cbz r6, _bar @ encoding: [0x06'A',0xb1'A'] 280 @ fixup A - offset: 0, value: _bar, kind: fixup_arm_thumb_cb 281@ CHECK: cbnz r6, _bar @ encoding: [0x06'A',0xb9'A'] 282 @ fixup A - offset: 0, value: _bar, kind: fixup_arm_thumb_cb 283 284 285@------------------------------------------------------------------------------ 286@ CDP/CDP2 287@------------------------------------------------------------------------------ 288 cdp p7, #1, c1, c1, c1, #4 289 cdp2 p7, #1, c1, c1, c1, #4 290 291@ CHECK: cdp p7, #1, c1, c1, c1, #4 @ encoding: [0x11,0xee,0x81,0x17] 292@ CHECK: cdp2 p7, #1, c1, c1, c1, #4 @ encoding: [0x11,0xfe,0x81,0x17] 293 294 295@------------------------------------------------------------------------------ 296@ CLREX 297@------------------------------------------------------------------------------ 298 clrex 299 it ne 300 clrexne 301 302@ CHECK: clrex @ encoding: [0xbf,0xf3,0x2f,0x8f] 303@ CHECK: it ne @ encoding: [0x18,0xbf] 304@ CHECK: clrexne @ encoding: [0xbf,0xf3,0x2f,0x8f] 305 306 307@------------------------------------------------------------------------------ 308@ CLZ 309@------------------------------------------------------------------------------ 310 clz r1, r2 311 it eq 312 clzeq r1, r2 313 314@ CHECK: clz r1, r2 @ encoding: [0xb2,0xfa,0x82,0xf1] 315@ CHECK: it eq @ encoding: [0x08,0xbf] 316@ CHECK: clzeq r1, r2 @ encoding: [0xb2,0xfa,0x82,0xf1] 317 318 319@------------------------------------------------------------------------------ 320@ CMN 321@------------------------------------------------------------------------------ 322 cmn r1, #0xf 323 cmn r8, r6 324 cmn r1, r6, lsl #10 325 cmn r1, r6, lsr #10 326 cmn sp, r6, lsr #10 327 cmn r1, r6, asr #10 328 cmn r1, r6, ror #10 329 330@ CHECK: cmn.w r1, #15 @ encoding: [0x11,0xf1,0x0f,0x0f] 331@ CHECK: cmn.w r8, r6 @ encoding: [0x18,0xeb,0x06,0x0f] 332@ CHECK: cmn.w r1, r6, lsl #10 @ encoding: [0x11,0xeb,0x86,0x2f] 333@ CHECK: cmn.w r1, r6, lsr #10 @ encoding: [0x11,0xeb,0x96,0x2f] 334@ CHECK: cmn.w sp, r6, lsr #10 @ encoding: [0x1d,0xeb,0x96,0x2f] 335@ CHECK: cmn.w r1, r6, asr #10 @ encoding: [0x11,0xeb,0xa6,0x2f] 336@ CHECK: cmn.w r1, r6, ror #10 @ encoding: [0x11,0xeb,0xb6,0x2f] 337 338 339@------------------------------------------------------------------------------ 340@ CMP 341@------------------------------------------------------------------------------ 342 cmp r5, #0xff00 343 cmp.w r4, r12 344 cmp r9, r6, lsl #12 345 cmp r3, r7, lsr #31 346 cmp sp, r6, lsr #1 347 cmp r2, r5, asr #24 348 cmp r1, r4, ror #15 349 350@ CHECK: cmp.w r5, #65280 @ encoding: [0xb5,0xf5,0x7f,0x4f] 351@ CHECK: cmp.w r4, r12 @ encoding: [0xb4,0xeb,0x0c,0x0f] 352@ CHECK: cmp.w r9, r6, lsl #12 @ encoding: [0xb9,0xeb,0x06,0x3f] 353@ CHECK: cmp.w r3, r7, lsr #31 @ encoding: [0xb3,0xeb,0xd7,0x7f] 354@ CHECK: cmp.w sp, r6, lsr #1 @ encoding: [0xbd,0xeb,0x56,0x0f] 355@ CHECK: cmp.w r2, r5, asr #24 @ encoding: [0xb2,0xeb,0x25,0x6f] 356@ CHECK: cmp.w r1, r4, ror #15 @ encoding: [0xb1,0xeb,0xf4,0x3f] 357 358 359@------------------------------------------------------------------------------ 360@ DBG 361@------------------------------------------------------------------------------ 362 dbg #5 363 dbg #0 364 dbg #15 365 366@ CHECK: dbg #5 @ encoding: [0xaf,0xf3,0xf5,0x80] 367@ CHECK: dbg #0 @ encoding: [0xaf,0xf3,0xf0,0x80] 368@ CHECK: dbg #15 @ encoding: [0xaf,0xf3,0xff,0x80] 369 370 371@------------------------------------------------------------------------------ 372@ DMB 373@------------------------------------------------------------------------------ 374 dmb sy 375 dmb st 376 dmb sh 377 dmb ish 378 dmb shst 379 dmb ishst 380 dmb un 381 dmb nsh 382 dmb unst 383 dmb nshst 384 dmb osh 385 dmb oshst 386 dmb 387 388@ CHECK: dmb sy @ encoding: [0xbf,0xf3,0x5f,0x8f] 389@ CHECK: dmb st @ encoding: [0xbf,0xf3,0x5e,0x8f] 390@ CHECK: dmb ish @ encoding: [0xbf,0xf3,0x5b,0x8f] 391@ CHECK: dmb ish @ encoding: [0xbf,0xf3,0x5b,0x8f] 392@ CHECK: dmb ishst @ encoding: [0xbf,0xf3,0x5a,0x8f] 393@ CHECK: dmb ishst @ encoding: [0xbf,0xf3,0x5a,0x8f] 394@ CHECK: dmb nsh @ encoding: [0xbf,0xf3,0x57,0x8f] 395@ CHECK: dmb nsh @ encoding: [0xbf,0xf3,0x57,0x8f] 396@ CHECK: dmb nshst @ encoding: [0xbf,0xf3,0x56,0x8f] 397@ CHECK: dmb nshst @ encoding: [0xbf,0xf3,0x56,0x8f] 398@ CHECK: dmb osh @ encoding: [0xbf,0xf3,0x53,0x8f] 399@ CHECK: dmb oshst @ encoding: [0xbf,0xf3,0x52,0x8f] 400@ CHECK: dmb sy @ encoding: [0xbf,0xf3,0x5f,0x8f] 401 402 403@------------------------------------------------------------------------------ 404@ DSB 405@------------------------------------------------------------------------------ 406 dsb sy 407 dsb st 408 dsb sh 409 dsb ish 410 dsb shst 411 dsb ishst 412 dsb un 413 dsb nsh 414 dsb unst 415 dsb nshst 416 dsb osh 417 dsb oshst 418 dsb 419 420@ CHECK: dsb sy @ encoding: [0xbf,0xf3,0x4f,0x8f] 421@ CHECK: dsb st @ encoding: [0xbf,0xf3,0x4e,0x8f] 422@ CHECK: dsb ish @ encoding: [0xbf,0xf3,0x4b,0x8f] 423@ CHECK: dsb ish @ encoding: [0xbf,0xf3,0x4b,0x8f] 424@ CHECK: dsb ishst @ encoding: [0xbf,0xf3,0x4a,0x8f] 425@ CHECK: dsb ishst @ encoding: [0xbf,0xf3,0x4a,0x8f] 426@ CHECK: dsb nsh @ encoding: [0xbf,0xf3,0x47,0x8f] 427@ CHECK: dsb nsh @ encoding: [0xbf,0xf3,0x47,0x8f] 428@ CHECK: dsb nshst @ encoding: [0xbf,0xf3,0x46,0x8f] 429@ CHECK: dsb nshst @ encoding: [0xbf,0xf3,0x46,0x8f] 430@ CHECK: dsb osh @ encoding: [0xbf,0xf3,0x43,0x8f] 431@ CHECK: dsb oshst @ encoding: [0xbf,0xf3,0x42,0x8f] 432@ CHECK: dsb sy @ encoding: [0xbf,0xf3,0x4f,0x8f] 433 434 435@------------------------------------------------------------------------------ 436@ EOR 437@------------------------------------------------------------------------------ 438 eor r4, r5, #0xf000 439 eor r4, r5, r6 440 eor r4, r5, r6, lsl #5 441 eor r4, r5, r6, lsr #5 442 eor r4, r5, r6, lsr #5 443 eor r4, r5, r6, asr #5 444 eor r4, r5, r6, ror #5 445 446@ CHECK: eor r4, r5, #61440 @ encoding: [0x85,0xf4,0x70,0x44] 447@ CHECK: eor.w r4, r5, r6 @ encoding: [0x85,0xea,0x06,0x04] 448@ CHECK: eor.w r4, r5, r6, lsl #5 @ encoding: [0x85,0xea,0x46,0x14] 449@ CHECK: eor.w r4, r5, r6, lsr #5 @ encoding: [0x85,0xea,0x56,0x14] 450@ CHECK: eor.w r4, r5, r6, lsr #5 @ encoding: [0x85,0xea,0x56,0x14] 451@ CHECK: eor.w r4, r5, r6, asr #5 @ encoding: [0x85,0xea,0x66,0x14] 452@ CHECK: eor.w r4, r5, r6, ror #5 @ encoding: [0x85,0xea,0x76,0x14] 453 454 455@------------------------------------------------------------------------------ 456@ ISB 457@------------------------------------------------------------------------------ 458 isb sy 459 isb 460 461@ CHECK: isb sy @ encoding: [0xbf,0xf3,0x6f,0x8f] 462@ CHECK: isb sy @ encoding: [0xbf,0xf3,0x6f,0x8f] 463 464 465@------------------------------------------------------------------------------ 466@ LDMIA 467@------------------------------------------------------------------------------ 468 ldmia.w r4, {r4, r5, r8, r9} 469 ldmia.w r4, {r5, r6} 470 ldmia.w r5!, {r3, r8} 471 ldm.w r4, {r4, r5, r8, r9} 472 ldm.w r4, {r5, r6} 473 ldm.w r5!, {r3, r8} 474 ldm.w r5!, {r1, r2} 475 ldm.w r2, {r1, r2} 476 477 ldmia r4, {r4, r5, r8, r9} 478 ldmia r4, {r5, r6} 479 ldmia r5!, {r3, r8} 480 ldm r4, {r4, r5, r8, r9} 481 ldm r4, {r5, r6} 482 ldm r5!, {r3, r8} 483 ldmfd r5!, {r3, r8} 484 485@ CHECK: ldm.w r4, {r4, r5, r8, r9} @ encoding: [0x94,0xe8,0x30,0x03] 486@ CHECK: ldm.w r4, {r5, r6} @ encoding: [0x94,0xe8,0x60,0x00] 487@ CHECK: ldm.w r5!, {r3, r8} @ encoding: [0xb5,0xe8,0x08,0x01] 488@ CHECK: ldm.w r4, {r4, r5, r8, r9} @ encoding: [0x94,0xe8,0x30,0x03] 489@ CHECK: ldm.w r4, {r5, r6} @ encoding: [0x94,0xe8,0x60,0x00] 490@ CHECK: ldm.w r5!, {r3, r8} @ encoding: [0xb5,0xe8,0x08,0x01] 491@ CHECK: ldm.w r5!, {r1, r2} @ encoding: [0xb5,0xe8,0x06,0x00] 492@ CHECK: ldm.w r2, {r1, r2} @ encoding: [0x92,0xe8,0x06,0x00] 493 494@ CHECK: ldm.w r4, {r4, r5, r8, r9} @ encoding: [0x94,0xe8,0x30,0x03] 495@ CHECK: ldm.w r4, {r5, r6} @ encoding: [0x94,0xe8,0x60,0x00] 496@ CHECK: ldm.w r5!, {r3, r8} @ encoding: [0xb5,0xe8,0x08,0x01] 497@ CHECK: ldm.w r4, {r4, r5, r8, r9} @ encoding: [0x94,0xe8,0x30,0x03] 498@ CHECK: ldm.w r4, {r5, r6} @ encoding: [0x94,0xe8,0x60,0x00] 499@ CHECK: ldm.w r5!, {r3, r8} @ encoding: [0xb5,0xe8,0x08,0x01] 500@ CHECK: ldm.w r5!, {r3, r8} @ encoding: [0xb5,0xe8,0x08,0x01] 501 502 503@------------------------------------------------------------------------------ 504@ LDMDB 505@------------------------------------------------------------------------------ 506 ldmdb r4, {r4, r5, r8, r9} 507 ldmdb r4, {r5, r6} 508 ldmdb r5!, {r3, r8} 509 ldmea r5!, {r3, r8} 510 511@ CHECK: ldmdb r4, {r4, r5, r8, r9} @ encoding: [0x14,0xe9,0x30,0x03] 512@ CHECK: ldmdb r4, {r5, r6} @ encoding: [0x14,0xe9,0x60,0x00] 513@ CHECK: ldmdb r5!, {r3, r8} @ encoding: [0x35,0xe9,0x08,0x01] 514@ CHECK: ldmdb r5!, {r3, r8} @ encoding: [0x35,0xe9,0x08,0x01] 515 516 517@------------------------------------------------------------------------------ 518@ LDR(immediate) 519@------------------------------------------------------------------------------ 520 ldr r5, [r5, #-4] 521 ldr r5, [r6, #32] 522 ldr r5, [r6, #33] 523 ldr r5, [r6, #257] 524 ldr.w pc, [r7, #257] 525 526@ CHECK: ldr r5, [r5, #-4] @ encoding: [0x55,0xf8,0x04,0x5c] 527@ CHECK: ldr r5, [r6, #32] @ encoding: [0x35,0x6a] 528@ CHECK: ldr.w r5, [r6, #33] @ encoding: [0xd6,0xf8,0x21,0x50] 529@ CHECK: ldr.w r5, [r6, #257] @ encoding: [0xd6,0xf8,0x01,0x51] 530@ CHECK: ldr.w pc, [r7, #257] @ encoding: [0xd7,0xf8,0x01,0xf1] 531 532 533@------------------------------------------------------------------------------ 534@ LDR(literal) 535@------------------------------------------------------------------------------ 536 ldr.w r5, _foo 537 538@ CHECK: ldr.w r5, _foo @ encoding: [0x5f'A',0xf8'A',A,0x50'A'] 539 @ fixup A - offset: 0, value: _foo, kind: fixup_t2_ldst_pcrel_12 540 541 542@------------------------------------------------------------------------------ 543@ LDRB(immediate) 544@------------------------------------------------------------------------------ 545 ldrb r5, [r5, #-4] 546 ldrb r5, [r6, #32] 547 ldrb r5, [r6, #33] 548 ldrb r5, [r6, #257] 549 ldrb.w lr, [r7, #257] 550 551@ CHECK: ldrb r5, [r5, #-4] @ encoding: [0x15,0xf8,0x04,0x5c] 552@ CHECK: ldrb.w r5, [r6, #32] @ encoding: [0x96,0xf8,0x20,0x50] 553@ CHECK: ldrb.w r5, [r6, #33] @ encoding: [0x96,0xf8,0x21,0x50] 554@ CHECK: ldrb.w r5, [r6, #257] @ encoding: [0x96,0xf8,0x01,0x51] 555@ CHECK: ldrb.w lr, [r7, #257] @ encoding: [0x97,0xf8,0x01,0xe1] 556 557 558@------------------------------------------------------------------------------ 559@ IT 560@------------------------------------------------------------------------------ 561@ Test encodings of a few full IT blocks, not just the IT instruction 562 563 iteet eq 564 addeq r0, r1, r2 565 nopne 566 subne r5, r6, r7 567 addeq r1, r2, #4 568 569@ CHECK: iteet eq @ encoding: [0x0d,0xbf] 570@ CHECK: addeq r0, r1, r2 @ encoding: [0x88,0x18] 571@ CHECK: nopne @ encoding: [0x00,0xbf] 572@ CHECK: subne r5, r6, r7 @ encoding: [0xf5,0x1b] 573@ CHECK: addeq r1, r2, #4 @ encoding: [0x11,0x1d] 574