arm64-memory.s 26.9 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634
; RUN: llvm-mc -triple arm64-apple-darwin -show-encoding < %s | FileCheck %s

foo:
;-----------------------------------------------------------------------------
; Indexed loads
;-----------------------------------------------------------------------------

  ldr    w5, [x4, #20]
  ldr    x4, [x3]
  ldr    x2, [sp, #32]
  ldr    b5, [sp, #1]
  ldr    h6, [sp, #2]
  ldr    s7, [sp, #4]
  ldr    d8, [sp, #8]
  ldr    q9, [sp, #16]
  ldrb   w4, [x3]
  ldrb   w5, [x4, #20]
  ldrb	 w2, [x3, _foo@pageoff]
  ldrb   w3, [x2, "+[Test method].var"@PAGEOFF]
  ldrsb  w9, [x3]
  ldrsb  x2, [sp, #128]
  ldrh   w2, [sp, #32]
  ldrsh  w3, [sp, #32]
  ldrsh  x5, [x9, #24]
  ldrsw  x9, [sp, #512]

  prfm   #5, [sp, #32]
  prfm   #31, [sp, #32]
  prfm   pldl1keep, [x2]
  prfm   pldl1strm, [x2]
  prfm   pldl2keep, [x2]
  prfm   pldl2strm, [x2]
  prfm   pldl3keep, [x2]
  prfm   pldl3strm, [x2]
  prfm   pstl1keep, [x2]
  prfm   pstl1strm, [x2]
  prfm   pstl2keep, [x2]
  prfm   pstl2strm, [x2]
  prfm   pstl3keep, [x2]
  prfm   pstl3strm, [x2]
  prfm  pstl3strm, [x4, x5, lsl #3]

; CHECK: ldr    w5, [x4, #20]           ; encoding: [0x85,0x14,0x40,0xb9]
; CHECK: ldr    x4, [x3]                ; encoding: [0x64,0x00,0x40,0xf9]
; CHECK: ldr    x2, [sp, #32]           ; encoding: [0xe2,0x13,0x40,0xf9]
; CHECK: ldr    b5, [sp, #1]            ; encoding: [0xe5,0x07,0x40,0x3d]
; CHECK: ldr    h6, [sp, #2]            ; encoding: [0xe6,0x07,0x40,0x7d]
; CHECK: ldr    s7, [sp, #4]            ; encoding: [0xe7,0x07,0x40,0xbd]
; CHECK: ldr    d8, [sp, #8]            ; encoding: [0xe8,0x07,0x40,0xfd]
; CHECK: ldr    q9, [sp, #16]           ; encoding: [0xe9,0x07,0xc0,0x3d]
; CHECK: ldrb   w4, [x3]                ; encoding: [0x64,0x00,0x40,0x39]
; CHECK: ldrb   w5, [x4, #20]           ; encoding: [0x85,0x50,0x40,0x39]
; CHECK: ldrb	w2, [x3, _foo@PAGEOFF]  ; encoding: [0x62,0bAAAAAA00,0b01AAAAAA,0x39]
; CHECK: ldrb	w3, [x2, "+[Test method].var"@PAGEOFF] ; encoding: [0x43,0bAAAAAA00,0b01AAAAAA,0x39]
; CHECK: ldrsb  w9, [x3]                ; encoding: [0x69,0x00,0xc0,0x39]
; CHECK: ldrsb  x2, [sp, #128]          ; encoding: [0xe2,0x03,0x82,0x39]
; CHECK: ldrh   w2, [sp, #32]           ; encoding: [0xe2,0x43,0x40,0x79]
; CHECK: ldrsh  w3, [sp, #32]           ; encoding: [0xe3,0x43,0xc0,0x79]
; CHECK: ldrsh  x5, [x9, #24]           ; encoding: [0x25,0x31,0x80,0x79]
; CHECK: ldrsw  x9, [sp, #512]          ; encoding: [0xe9,0x03,0x82,0xb9]
; CHECK: prfm   pldl3strm, [sp, #32]    ; encoding: [0xe5,0x13,0x80,0xf9]
; CHECK: prfm	#31, [sp, #32]          ; encoding: [0xff,0x13,0x80,0xf9]
; CHECK: prfm   pldl1keep, [x2]         ; encoding: [0x40,0x00,0x80,0xf9]
; CHECK: prfm   pldl1strm, [x2]         ; encoding: [0x41,0x00,0x80,0xf9]
; CHECK: prfm   pldl2keep, [x2]         ; encoding: [0x42,0x00,0x80,0xf9]
; CHECK: prfm   pldl2strm, [x2]         ; encoding: [0x43,0x00,0x80,0xf9]
; CHECK: prfm   pldl3keep, [x2]         ; encoding: [0x44,0x00,0x80,0xf9]
; CHECK: prfm   pldl3strm, [x2]         ; encoding: [0x45,0x00,0x80,0xf9]
; CHECK: prfm   pstl1keep, [x2]         ; encoding: [0x50,0x00,0x80,0xf9]
; CHECK: prfm   pstl1strm, [x2]         ; encoding: [0x51,0x00,0x80,0xf9]
; CHECK: prfm   pstl2keep, [x2]         ; encoding: [0x52,0x00,0x80,0xf9]
; CHECK: prfm   pstl2strm, [x2]         ; encoding: [0x53,0x00,0x80,0xf9]
; CHECK: prfm   pstl3keep, [x2]         ; encoding: [0x54,0x00,0x80,0xf9]
; CHECK: prfm   pstl3strm, [x2]         ; encoding: [0x55,0x00,0x80,0xf9]
; CHECK: prfm	pstl3strm, [x4, x5, lsl #3] ; encoding: [0x95,0x78,0xa5,0xf8]

;-----------------------------------------------------------------------------
; Indexed stores
;-----------------------------------------------------------------------------

  str   x4, [x3]
  str   x2, [sp, #32]
  str   w5, [x4, #20]
  str   b5, [sp, #1]
  str   h6, [sp, #2]
  str   s7, [sp, #4]
  str   d8, [sp, #8]
  str   q9, [sp, #16]
  strb  w4, [x3]
  strb  w5, [x4, #20]
  strh  w2, [sp, #32]

; CHECK: str   x4, [x3]                 ; encoding: [0x64,0x00,0x00,0xf9]
; CHECK: str   x2, [sp, #32]            ; encoding: [0xe2,0x13,0x00,0xf9]
; CHECK: str   w5, [x4, #20]            ; encoding: [0x85,0x14,0x00,0xb9]
; CHECK: str   b5, [sp, #1]             ; encoding: [0xe5,0x07,0x00,0x3d]
; CHECK: str   h6, [sp, #2]             ; encoding: [0xe6,0x07,0x00,0x7d]
; CHECK: str   s7, [sp, #4]             ; encoding: [0xe7,0x07,0x00,0xbd]
; CHECK: str   d8, [sp, #8]             ; encoding: [0xe8,0x07,0x00,0xfd]
; CHECK: str   q9, [sp, #16]            ; encoding: [0xe9,0x07,0x80,0x3d]
; CHECK: strb  w4, [x3]                 ; encoding: [0x64,0x00,0x00,0x39]
; CHECK: strb  w5, [x4, #20]            ; encoding: [0x85,0x50,0x00,0x39]
; CHECK: strh  w2, [sp, #32]            ; encoding: [0xe2,0x43,0x00,0x79]

;-----------------------------------------------------------------------------
; Unscaled immediate loads and stores
;-----------------------------------------------------------------------------

  ldur    w2, [x3]
  ldur    w2, [sp, #24]
  ldur    x2, [x3]
  ldur    x2, [sp, #24]
  ldur    b5, [sp, #1]
  ldur    h6, [sp, #2]
  ldur    s7, [sp, #4]
  ldur    d8, [sp, #8]
  ldur    q9, [sp, #16]
  ldursb  w9, [x3]
  ldursb  x2, [sp, #128]
  ldursh  w3, [sp, #32]
  ldursh  x5, [x9, #24]
  ldursw  x9, [sp, #-128]

; CHECK: ldur    w2, [x3]               ; encoding: [0x62,0x00,0x40,0xb8]
; CHECK: ldur    w2, [sp, #24]          ; encoding: [0xe2,0x83,0x41,0xb8]
; CHECK: ldur    x2, [x3]               ; encoding: [0x62,0x00,0x40,0xf8]
; CHECK: ldur    x2, [sp, #24]          ; encoding: [0xe2,0x83,0x41,0xf8]
; CHECK: ldur    b5, [sp, #1]           ; encoding: [0xe5,0x13,0x40,0x3c]
; CHECK: ldur    h6, [sp, #2]           ; encoding: [0xe6,0x23,0x40,0x7c]
; CHECK: ldur    s7, [sp, #4]           ; encoding: [0xe7,0x43,0x40,0xbc]
; CHECK: ldur    d8, [sp, #8]           ; encoding: [0xe8,0x83,0x40,0xfc]
; CHECK: ldur    q9, [sp, #16]          ; encoding: [0xe9,0x03,0xc1,0x3c]
; CHECK: ldursb  w9, [x3]               ; encoding: [0x69,0x00,0xc0,0x38]
; CHECK: ldursb  x2, [sp, #128]         ; encoding: [0xe2,0x03,0x88,0x38]
; CHECK: ldursh  w3, [sp, #32]          ; encoding: [0xe3,0x03,0xc2,0x78]
; CHECK: ldursh  x5, [x9, #24]          ; encoding: [0x25,0x81,0x81,0x78]
; CHECK: ldursw  x9, [sp, #-128]        ; encoding: [0xe9,0x03,0x98,0xb8]

  stur    w4, [x3]
  stur    w2, [sp, #32]
  stur    x4, [x3]
  stur    x2, [sp, #32]
  stur    w5, [x4, #20]
  stur    b5, [sp, #1]
  stur    h6, [sp, #2]
  stur    s7, [sp, #4]
  stur    d8, [sp, #8]
  stur    q9, [sp, #16]
  sturb   w4, [x3]
  sturb   w5, [x4, #20]
  sturh   w2, [sp, #32]
  prfum   #5, [sp, #32]

; CHECK: stur    w4, [x3]               ; encoding: [0x64,0x00,0x00,0xb8]
; CHECK: stur    w2, [sp, #32]          ; encoding: [0xe2,0x03,0x02,0xb8]
; CHECK: stur    x4, [x3]               ; encoding: [0x64,0x00,0x00,0xf8]
; CHECK: stur    x2, [sp, #32]          ; encoding: [0xe2,0x03,0x02,0xf8]
; CHECK: stur    w5, [x4, #20]          ; encoding: [0x85,0x40,0x01,0xb8]
; CHECK: stur    b5, [sp, #1]           ; encoding: [0xe5,0x13,0x00,0x3c]
; CHECK: stur    h6, [sp, #2]           ; encoding: [0xe6,0x23,0x00,0x7c]
; CHECK: stur    s7, [sp, #4]           ; encoding: [0xe7,0x43,0x00,0xbc]
; CHECK: stur    d8, [sp, #8]           ; encoding: [0xe8,0x83,0x00,0xfc]
; CHECK: stur    q9, [sp, #16]          ; encoding: [0xe9,0x03,0x81,0x3c]
; CHECK: sturb   w4, [x3]               ; encoding: [0x64,0x00,0x00,0x38]
; CHECK: sturb   w5, [x4, #20]          ; encoding: [0x85,0x40,0x01,0x38]
; CHECK: sturh   w2, [sp, #32]          ; encoding: [0xe2,0x03,0x02,0x78]
; CHECK: prfum   pldl3strm, [sp, #32]   ; encoding: [0xe5,0x03,0x82,0xf8]

;-----------------------------------------------------------------------------
; Unprivileged loads and stores
;-----------------------------------------------------------------------------

  ldtr    w3, [x4, #16]
  ldtr    x3, [x4, #16]
  ldtrb   w3, [x4, #16]
  ldtrsb  w9, [x3]
  ldtrsb  x2, [sp, #128]
  ldtrh   w3, [x4, #16]
  ldtrsh  w3, [sp, #32]
  ldtrsh  x5, [x9, #24]
  ldtrsw  x9, [sp, #-128]

; CHECK: ldtr   w3, [x4, #16]           ; encoding: [0x83,0x08,0x41,0xb8]
; CHECK: ldtr   x3, [x4, #16]           ; encoding: [0x83,0x08,0x41,0xf8]
; CHECK: ldtrb  w3, [x4, #16]           ; encoding: [0x83,0x08,0x41,0x38]
; CHECK: ldtrsb w9, [x3]                ; encoding: [0x69,0x08,0xc0,0x38]
; CHECK: ldtrsb x2, [sp, #128]          ; encoding: [0xe2,0x0b,0x88,0x38]
; CHECK: ldtrh  w3, [x4, #16]           ; encoding: [0x83,0x08,0x41,0x78]
; CHECK: ldtrsh w3, [sp, #32]           ; encoding: [0xe3,0x0b,0xc2,0x78]
; CHECK: ldtrsh x5, [x9, #24]           ; encoding: [0x25,0x89,0x81,0x78]
; CHECK: ldtrsw x9, [sp, #-128]         ; encoding: [0xe9,0x0b,0x98,0xb8]

  sttr    w5, [x4, #20]
  sttr    x4, [x3]
  sttr    x2, [sp, #32]
  sttrb   w4, [x3]
  sttrb   w5, [x4, #20]
  sttrh   w2, [sp, #32]

; CHECK: sttr   w5, [x4, #20]           ; encoding: [0x85,0x48,0x01,0xb8]
; CHECK: sttr   x4, [x3]                ; encoding: [0x64,0x08,0x00,0xf8]
; CHECK: sttr   x2, [sp, #32]           ; encoding: [0xe2,0x0b,0x02,0xf8]
; CHECK: sttrb  w4, [x3]                ; encoding: [0x64,0x08,0x00,0x38]
; CHECK: sttrb  w5, [x4, #20]           ; encoding: [0x85,0x48,0x01,0x38]
; CHECK: sttrh  w2, [sp, #32]           ; encoding: [0xe2,0x0b,0x02,0x78]

;-----------------------------------------------------------------------------
; Pre-indexed loads and stores
;-----------------------------------------------------------------------------

  ldr   x29, [x7, #8]!
  ldr   x30, [x7, #8]!
  ldr   b5, [x0, #1]!
  ldr   h6, [x0, #2]!
  ldr   s7, [x0, #4]!
  ldr   d8, [x0, #8]!
  ldr   q9, [x0, #16]!

  str   x30, [x7, #-8]!
  str   x29, [x7, #-8]!
  str   b5, [x0, #-1]!
  str   h6, [x0, #-2]!
  str   s7, [x0, #-4]!
  str   d8, [x0, #-8]!
  str   q9, [x0, #-16]!

; CHECK: ldr  x29, [x7, #8]!             ; encoding: [0xfd,0x8c,0x40,0xf8]
; CHECK: ldr  x30, [x7, #8]!             ; encoding: [0xfe,0x8c,0x40,0xf8]
; CHECK: ldr  b5, [x0, #1]!             ; encoding: [0x05,0x1c,0x40,0x3c]
; CHECK: ldr  h6, [x0, #2]!             ; encoding: [0x06,0x2c,0x40,0x7c]
; CHECK: ldr  s7, [x0, #4]!             ; encoding: [0x07,0x4c,0x40,0xbc]
; CHECK: ldr  d8, [x0, #8]!             ; encoding: [0x08,0x8c,0x40,0xfc]
; CHECK: ldr  q9, [x0, #16]!            ; encoding: [0x09,0x0c,0xc1,0x3c]

; CHECK: str  x30, [x7, #-8]!            ; encoding: [0xfe,0x8c,0x1f,0xf8]
; CHECK: str  x29, [x7, #-8]!            ; encoding: [0xfd,0x8c,0x1f,0xf8]
; CHECK: str  b5, [x0, #-1]!            ; encoding: [0x05,0xfc,0x1f,0x3c]
; CHECK: str  h6, [x0, #-2]!            ; encoding: [0x06,0xec,0x1f,0x7c]
; CHECK: str  s7, [x0, #-4]!            ; encoding: [0x07,0xcc,0x1f,0xbc]
; CHECK: str  d8, [x0, #-8]!            ; encoding: [0x08,0x8c,0x1f,0xfc]
; CHECK: str  q9, [x0, #-16]!           ; encoding: [0x09,0x0c,0x9f,0x3c]

;-----------------------------------------------------------------------------
; post-indexed loads and stores
;-----------------------------------------------------------------------------
  str x30, [x7], #-8
  str x29, [x7], #-8
  str b5, [x0], #-1
  str h6, [x0], #-2
  str s7, [x0], #-4
  str d8, [x0], #-8
  str q9, [x0], #-16

  ldr x29, [x7], #8
  ldr x30, [x7], #8
  ldr b5, [x0], #1
  ldr h6, [x0], #2
  ldr s7, [x0], #4
  ldr d8, [x0], #8
  ldr q9, [x0], #16

; CHECK: str x30, [x7], #-8             ; encoding: [0xfe,0x84,0x1f,0xf8]
; CHECK: str x29, [x7], #-8             ; encoding: [0xfd,0x84,0x1f,0xf8]
; CHECK: str b5, [x0], #-1             ; encoding: [0x05,0xf4,0x1f,0x3c]
; CHECK: str h6, [x0], #-2             ; encoding: [0x06,0xe4,0x1f,0x7c]
; CHECK: str s7, [x0], #-4             ; encoding: [0x07,0xc4,0x1f,0xbc]
; CHECK: str d8, [x0], #-8             ; encoding: [0x08,0x84,0x1f,0xfc]
; CHECK: str q9, [x0], #-16            ; encoding: [0x09,0x04,0x9f,0x3c]

; CHECK: ldr x29, [x7], #8              ; encoding: [0xfd,0x84,0x40,0xf8]
; CHECK: ldr x30, [x7], #8              ; encoding: [0xfe,0x84,0x40,0xf8]
; CHECK: ldr b5, [x0], #1              ; encoding: [0x05,0x14,0x40,0x3c]
; CHECK: ldr h6, [x0], #2              ; encoding: [0x06,0x24,0x40,0x7c]
; CHECK: ldr s7, [x0], #4              ; encoding: [0x07,0x44,0x40,0xbc]
; CHECK: ldr d8, [x0], #8              ; encoding: [0x08,0x84,0x40,0xfc]
; CHECK: ldr q9, [x0], #16             ; encoding: [0x09,0x04,0xc1,0x3c]

;-----------------------------------------------------------------------------
; Load/Store pair (indexed, offset)
;-----------------------------------------------------------------------------

  ldp    w3, w2, [x15, #16]
  ldp    x4, x9, [sp, #-16]
  ldpsw  x2, x3, [x14, #16]
  ldpsw  x2, x3, [sp, #-16]
  ldp    s10, s1, [x2, #64]
  ldp    d10, d1, [x2]
  ldp    q2, q3, [x0, #32]

; CHECK: ldp    w3, w2, [x15, #16]      ; encoding: [0xe3,0x09,0x42,0x29]
; CHECK: ldp    x4, x9, [sp, #-16]      ; encoding: [0xe4,0x27,0x7f,0xa9]
; CHECK: ldpsw  x2, x3, [x14, #16]      ; encoding: [0xc2,0x0d,0x42,0x69]
; CHECK: ldpsw  x2, x3, [sp, #-16]      ; encoding: [0xe2,0x0f,0x7e,0x69]
; CHECK: ldp    s10, s1, [x2, #64]      ; encoding: [0x4a,0x04,0x48,0x2d]
; CHECK: ldp    d10, d1, [x2]           ; encoding: [0x4a,0x04,0x40,0x6d]
; CHECK: ldp    q2, q3, [x0, #32]       ; encoding: [0x02,0x0c,0x41,0xad]

  stp    w3, w2, [x15, #16]
  stp    x4, x9, [sp, #-16]
  stp    s10, s1, [x2, #64]
  stp    d10, d1, [x2]
  stp    q2, q3, [x0, #32]

; CHECK: stp    w3, w2, [x15, #16]      ; encoding: [0xe3,0x09,0x02,0x29]
; CHECK: stp    x4, x9, [sp, #-16]      ; encoding: [0xe4,0x27,0x3f,0xa9]
; CHECK: stp    s10, s1, [x2, #64]      ; encoding: [0x4a,0x04,0x08,0x2d]
; CHECK: stp    d10, d1, [x2]           ; encoding: [0x4a,0x04,0x00,0x6d]
; CHECK: stp    q2, q3, [x0, #32]       ; encoding: [0x02,0x0c,0x01,0xad]

;-----------------------------------------------------------------------------
; Load/Store pair (pre-indexed)
;-----------------------------------------------------------------------------

  ldp    w3, w2, [x15, #16]!
  ldp    x4, x9, [sp, #-16]!
  ldpsw  x2, x3, [x14, #16]!
  ldpsw  x2, x3, [sp, #-16]!
  ldp    s10, s1, [x2, #64]!
  ldp    d10, d1, [x2, #16]!

; CHECK: ldp  w3, w2, [x15, #16]!       ; encoding: [0xe3,0x09,0xc2,0x29]
; CHECK: ldp  x4, x9, [sp, #-16]!       ; encoding: [0xe4,0x27,0xff,0xa9]
; CHECK: ldpsw	x2, x3, [x14, #16]!     ; encoding: [0xc2,0x0d,0xc2,0x69]
; CHECK: ldpsw	x2, x3, [sp, #-16]!     ; encoding: [0xe2,0x0f,0xfe,0x69]
; CHECK: ldp  s10, s1, [x2, #64]!       ; encoding: [0x4a,0x04,0xc8,0x2d]
; CHECK: ldp  d10, d1, [x2, #16]!       ; encoding: [0x4a,0x04,0xc1,0x6d]

  stp    w3, w2, [x15, #16]!
  stp    x4, x9, [sp, #-16]!
  stp    s10, s1, [x2, #64]!
  stp    d10, d1, [x2, #16]!

; CHECK: stp  w3, w2, [x15, #16]!       ; encoding: [0xe3,0x09,0x82,0x29]
; CHECK: stp  x4, x9, [sp, #-16]!       ; encoding: [0xe4,0x27,0xbf,0xa9]
; CHECK: stp  s10, s1, [x2, #64]!       ; encoding: [0x4a,0x04,0x88,0x2d]
; CHECK: stp  d10, d1, [x2, #16]!       ; encoding: [0x4a,0x04,0x81,0x6d]

;-----------------------------------------------------------------------------
; Load/Store pair (post-indexed)
;-----------------------------------------------------------------------------

  ldp    w3, w2, [x15], #16
  ldp    x4, x9, [sp], #-16
  ldpsw  x2, x3, [x14], #16
  ldpsw  x2, x3, [sp], #-16
  ldp    s10, s1, [x2], #64
  ldp    d10, d1, [x2], #16

; CHECK: ldp  w3, w2, [x15], #16        ; encoding: [0xe3,0x09,0xc2,0x28]
; CHECK: ldp  x4, x9, [sp], #-16        ; encoding: [0xe4,0x27,0xff,0xa8]
; CHECK: ldpsw	x2, x3, [x14], #16      ; encoding: [0xc2,0x0d,0xc2,0x68]
; CHECK: ldpsw	x2, x3, [sp], #-16      ; encoding: [0xe2,0x0f,0xfe,0x68]
; CHECK: ldp  s10, s1, [x2], #64        ; encoding: [0x4a,0x04,0xc8,0x2c]
; CHECK: ldp  d10, d1, [x2], #16        ; encoding: [0x4a,0x04,0xc1,0x6c]

  stp    w3, w2, [x15], #16
  stp    x4, x9, [sp], #-16
  stp    s10, s1, [x2], #64
  stp    d10, d1, [x2], #16

; CHECK: stp  w3, w2, [x15], #16        ; encoding: [0xe3,0x09,0x82,0x28]
; CHECK: stp  x4, x9, [sp], #-16        ; encoding: [0xe4,0x27,0xbf,0xa8]
; CHECK: stp  s10, s1, [x2], #64        ; encoding: [0x4a,0x04,0x88,0x2c]
; CHECK: stp  d10, d1, [x2], #16        ; encoding: [0x4a,0x04,0x81,0x6c]

;-----------------------------------------------------------------------------
; Load/Store pair (no-allocate)
;-----------------------------------------------------------------------------

  ldnp  w3, w2, [x15, #16]
  ldnp  x4, x9, [sp, #-16]
  ldnp  s10, s1, [x2, #64]
  ldnp  d10, d1, [x2]

; CHECK: ldnp  w3, w2, [x15, #16]       ; encoding: [0xe3,0x09,0x42,0x28]
; CHECK: ldnp  x4, x9, [sp, #-16]       ; encoding: [0xe4,0x27,0x7f,0xa8]
; CHECK: ldnp  s10, s1, [x2, #64]       ; encoding: [0x4a,0x04,0x48,0x2c]
; CHECK: ldnp  d10, d1, [x2]            ; encoding: [0x4a,0x04,0x40,0x6c]

  stnp  w3, w2, [x15, #16]
  stnp  x4, x9, [sp, #-16]
  stnp  s10, s1, [x2, #64]
  stnp  d10, d1, [x2]

; CHECK: stnp  w3, w2, [x15, #16]       ; encoding: [0xe3,0x09,0x02,0x28]
; CHECK: stnp  x4, x9, [sp, #-16]       ; encoding: [0xe4,0x27,0x3f,0xa8]
; CHECK: stnp  s10, s1, [x2, #64]       ; encoding: [0x4a,0x04,0x08,0x2c]
; CHECK: stnp  d10, d1, [x2]            ; encoding: [0x4a,0x04,0x00,0x6c]

;-----------------------------------------------------------------------------
; Load/Store register offset
;-----------------------------------------------------------------------------

  ldr  w0, [x0, x0]
  ldr  w0, [x0, x0, lsl #2]
  ldr  x0, [x0, x0]
  ldr  x0, [x0, x0, lsl #3]
  ldr  x0, [x0, x0, sxtx]

; CHECK: ldr  w0, [x0, x0]              ; encoding: [0x00,0x68,0x60,0xb8]
; CHECK: ldr  w0, [x0, x0, lsl #2]      ; encoding: [0x00,0x78,0x60,0xb8]
; CHECK: ldr  x0, [x0, x0]              ; encoding: [0x00,0x68,0x60,0xf8]
; CHECK: ldr  x0, [x0, x0, lsl #3]      ; encoding: [0x00,0x78,0x60,0xf8]
; CHECK: ldr  x0, [x0, x0, sxtx]        ; encoding: [0x00,0xe8,0x60,0xf8]

  ldr  b1, [x1, x2]
  ldr  b1, [x1, x2, lsl #0]
  ldr  h1, [x1, x2]
  ldr  h1, [x1, x2, lsl #1]
  ldr  s1, [x1, x2]
  ldr  s1, [x1, x2, lsl #2]
  ldr  d1, [x1, x2]
  ldr  d1, [x1, x2, lsl #3]
  ldr  q1, [x1, x2]
  ldr  q1, [x1, x2, lsl #4]

; CHECK: ldr  b1, [x1, x2]              ; encoding: [0x21,0x68,0x62,0x3c]
; CHECK: ldr  b1, [x1, x2, lsl #0]      ; encoding: [0x21,0x78,0x62,0x3c]
; CHECK: ldr  h1, [x1, x2]              ; encoding: [0x21,0x68,0x62,0x7c]
; CHECK: ldr  h1, [x1, x2, lsl #1]      ; encoding: [0x21,0x78,0x62,0x7c]
; CHECK: ldr  s1, [x1, x2]              ; encoding: [0x21,0x68,0x62,0xbc]
; CHECK: ldr  s1, [x1, x2, lsl #2]      ; encoding: [0x21,0x78,0x62,0xbc]
; CHECK: ldr  d1, [x1, x2]              ; encoding: [0x21,0x68,0x62,0xfc]
; CHECK: ldr  d1, [x1, x2, lsl #3]      ; encoding: [0x21,0x78,0x62,0xfc]
; CHECK: ldr  q1, [x1, x2]              ; encoding: [0x21,0x68,0xe2,0x3c]
; CHECK: ldr  q1, [x1, x2, lsl #4]      ; encoding: [0x21,0x78,0xe2,0x3c]

  str  d1, [sp, x3]
  str  d1, [sp, w3, uxtw #3]
  str  q1, [sp, x3]
  str  q1, [sp, w3, uxtw #4]

; CHECK: str  d1, [sp, x3]              ; encoding: [0xe1,0x6b,0x23,0xfc]
; CHECK: str  d1, [sp, w3, uxtw #3]     ; encoding: [0xe1,0x5b,0x23,0xfc]
; CHECK: str  q1, [sp, x3]              ; encoding: [0xe1,0x6b,0xa3,0x3c]
; CHECK: str  q1, [sp, w3, uxtw #4]     ; encoding: [0xe1,0x5b,0xa3,0x3c]

;-----------------------------------------------------------------------------
; Load literal
;-----------------------------------------------------------------------------

  ldr    w5, foo
  ldr    x4, foo
  ldrsw  x9, foo
  prfm   #5, foo

; CHECK: ldr    w5, foo                 ; encoding: [0bAAA00101,A,A,0x18]
; CHECK: ldr    x4, foo                 ; encoding: [0bAAA00100,A,A,0x58]
; CHECK: ldrsw  x9, foo                 ; encoding: [0bAAA01001,A,A,0x98]
; CHECK: prfm   pldl3strm, foo          ; encoding: [0bAAA00101,A,A,0xd8]

;-----------------------------------------------------------------------------
; Load/Store exclusive
;-----------------------------------------------------------------------------

  ldxr   w6, [x1]
  ldxr   x6, [x1]
  ldxrb  w6, [x1]
  ldxrh  w6, [x1]
  ldxp   w7, w3, [x9]
  ldxp   x7, x3, [x9]

; CHECK: ldxrb  w6, [x1]                ; encoding: [0x26,0x7c,0x5f,0x08]
; CHECK: ldxrh  w6, [x1]                ; encoding: [0x26,0x7c,0x5f,0x48]
; CHECK: ldxp   w7, w3, [x9]            ; encoding: [0x27,0x0d,0x7f,0x88]
; CHECK: ldxp   x7, x3, [x9]            ; encoding: [0x27,0x0d,0x7f,0xc8]

  stxr   w1, x4, [x3]
  stxr   w1, w4, [x3]
  stxrb  w1, w4, [x3]
  stxrh  w1, w4, [x3]
  stxp   w1, x2, x6, [x7]
  stxp   w1, w2, w6, [x9]

; CHECK: stxr   w1, x4, [x3]            ; encoding: [0x64,0x7c,0x01,0xc8]
; CHECK: stxr   w1, w4, [x3]            ; encoding: [0x64,0x7c,0x01,0x88]
; CHECK: stxrb  w1, w4, [x3]            ; encoding: [0x64,0x7c,0x01,0x08]
; CHECK: stxrh  w1, w4, [x3]            ; encoding: [0x64,0x7c,0x01,0x48]
; CHECK: stxp   w1, x2, x6, [x7]        ; encoding: [0xe2,0x18,0x21,0xc8]
; CHECK: stxp   w1, w2, w6, [x9]        ; encoding: [0x22,0x19,0x21,0x88]

;-----------------------------------------------------------------------------
; Load-acquire/Store-release non-exclusive
;-----------------------------------------------------------------------------

  ldar   w4, [sp]
  ldar   x4, [sp, #0]
  ldarb  w4, [sp]
  ldarh  w4, [sp]

; CHECK: ldar   w4, [sp]                ; encoding: [0xe4,0xff,0xdf,0x88]
; CHECK: ldar   x4, [sp]                ; encoding: [0xe4,0xff,0xdf,0xc8]
; CHECK: ldarb  w4, [sp]                ; encoding: [0xe4,0xff,0xdf,0x08]
; CHECK: ldarh  w4, [sp]                ; encoding: [0xe4,0xff,0xdf,0x48]

  stlr   w3, [x6]
  stlr   x3, [x6]
  stlrb  w3, [x6]
  stlrh  w3, [x6]

; CHECK: stlr   w3, [x6]                ; encoding: [0xc3,0xfc,0x9f,0x88]
; CHECK: stlr   x3, [x6]                ; encoding: [0xc3,0xfc,0x9f,0xc8]
; CHECK: stlrb  w3, [x6]                ; encoding: [0xc3,0xfc,0x9f,0x08]
; CHECK: stlrh  w3, [x6]                ; encoding: [0xc3,0xfc,0x9f,0x48]

;-----------------------------------------------------------------------------
; Load-acquire/Store-release exclusive
;-----------------------------------------------------------------------------

  ldaxr   w2, [x4]
  ldaxr   x2, [x4]
  ldaxrb  w2, [x4, #0]
  ldaxrh  w2, [x4]
  ldaxp   w2, w6, [x1]
  ldaxp   x2, x6, [x1]

; CHECK: ldaxr   w2, [x4]               ; encoding: [0x82,0xfc,0x5f,0x88]
; CHECK: ldaxr   x2, [x4]               ; encoding: [0x82,0xfc,0x5f,0xc8]
; CHECK: ldaxrb  w2, [x4]               ; encoding: [0x82,0xfc,0x5f,0x08]
; CHECK: ldaxrh  w2, [x4]               ; encoding: [0x82,0xfc,0x5f,0x48]
; CHECK: ldaxp   w2, w6, [x1]           ; encoding: [0x22,0x98,0x7f,0x88]
; CHECK: ldaxp   x2, x6, [x1]           ; encoding: [0x22,0x98,0x7f,0xc8]

  stlxr   w8, x7, [x1]
  stlxr   w8, w7, [x1]
  stlxrb  w8, w7, [x1]
  stlxrh  w8, w7, [x1]
  stlxp   w1, x2, x6, [x7]
  stlxp   w1, w2, w6, [x9]

; CHECK: stlxr  w8, x7, [x1]            ; encoding: [0x27,0xfc,0x08,0xc8]
; CHECK: stlxr  w8, w7, [x1]            ; encoding: [0x27,0xfc,0x08,0x88]
; CHECK: stlxrb w8, w7, [x1]            ; encoding: [0x27,0xfc,0x08,0x08]
; CHECK: stlxrh w8, w7, [x1]            ; encoding: [0x27,0xfc,0x08,0x48]
; CHECK: stlxp  w1, x2, x6, [x7]        ; encoding: [0xe2,0x98,0x21,0xc8]
; CHECK: stlxp  w1, w2, w6, [x9]        ; encoding: [0x22,0x99,0x21,0x88]


;-----------------------------------------------------------------------------
; LDUR/STUR aliases for negative and unaligned LDR/STR instructions.
;
; According to the ARM ISA documentation:
; "A programmer-friendly assembler should also generate these instructions
; in response to the standard LDR/STR mnemonics when the immediate offset is
; unambiguous, i.e. negative or unaligned."
;-----------------------------------------------------------------------------

  ldr x11, [x29, #-8]
  ldr x11, [x29, #7]
  ldr w0, [x0, #2]
  ldr w0, [x0, #-256]
  ldr b2, [x1, #-2]
  ldr h3, [x2, #3]
  ldr h3, [x3, #-4]
  ldr s3, [x4, #3]
  ldr s3, [x5, #-4]
  ldr d4, [x6, #4]
  ldr d4, [x7, #-8]
  ldr q5, [x8, #8]
  ldr q5, [x9, #-16]

; CHECK: ldur	x11, [x29, #-8]          ; encoding: [0xab,0x83,0x5f,0xf8]
; CHECK: ldur	x11, [x29, #7]           ; encoding: [0xab,0x73,0x40,0xf8]
; CHECK: ldur	w0, [x0, #2]            ; encoding: [0x00,0x20,0x40,0xb8]
; CHECK: ldur	w0, [x0, #-256]         ; encoding: [0x00,0x00,0x50,0xb8]
; CHECK: ldur	b2, [x1, #-2]           ; encoding: [0x22,0xe0,0x5f,0x3c]
; CHECK: ldur	h3, [x2, #3]            ; encoding: [0x43,0x30,0x40,0x7c]
; CHECK: ldur	h3, [x3, #-4]           ; encoding: [0x63,0xc0,0x5f,0x7c]
; CHECK: ldur	s3, [x4, #3]            ; encoding: [0x83,0x30,0x40,0xbc]
; CHECK: ldur	s3, [x5, #-4]           ; encoding: [0xa3,0xc0,0x5f,0xbc]
; CHECK: ldur	d4, [x6, #4]            ; encoding: [0xc4,0x40,0x40,0xfc]
; CHECK: ldur	d4, [x7, #-8]           ; encoding: [0xe4,0x80,0x5f,0xfc]
; CHECK: ldur	q5, [x8, #8]            ; encoding: [0x05,0x81,0xc0,0x3c]
; CHECK: ldur	q5, [x9, #-16]          ; encoding: [0x25,0x01,0xdf,0x3c]

  str x11, [x29, #-8]
  str x11, [x29, #7]
  str w0, [x0, #2]
  str w0, [x0, #-256]
  str b2, [x1, #-2]
  str h3, [x2, #3]
  str h3, [x3, #-4]
  str s3, [x4, #3]
  str s3, [x5, #-4]
  str d4, [x6, #4]
  str d4, [x7, #-8]
  str q5, [x8, #8]
  str q5, [x9, #-16]

; CHECK: stur	x11, [x29, #-8]          ; encoding: [0xab,0x83,0x1f,0xf8]
; CHECK: stur	x11, [x29, #7]           ; encoding: [0xab,0x73,0x00,0xf8]
; CHECK: stur	w0, [x0, #2]            ; encoding: [0x00,0x20,0x00,0xb8]
; CHECK: stur	w0, [x0, #-256]         ; encoding: [0x00,0x00,0x10,0xb8]
; CHECK: stur	b2, [x1, #-2]           ; encoding: [0x22,0xe0,0x1f,0x3c]
; CHECK: stur	h3, [x2, #3]            ; encoding: [0x43,0x30,0x00,0x7c]
; CHECK: stur	h3, [x3, #-4]           ; encoding: [0x63,0xc0,0x1f,0x7c]
; CHECK: stur	s3, [x4, #3]            ; encoding: [0x83,0x30,0x00,0xbc]
; CHECK: stur	s3, [x5, #-4]           ; encoding: [0xa3,0xc0,0x1f,0xbc]
; CHECK: stur	d4, [x6, #4]            ; encoding: [0xc4,0x40,0x00,0xfc]
; CHECK: stur	d4, [x7, #-8]           ; encoding: [0xe4,0x80,0x1f,0xfc]
; CHECK: stur	q5, [x8, #8]            ; encoding: [0x05,0x81,0x80,0x3c]
; CHECK: stur	q5, [x9, #-16]          ; encoding: [0x25,0x01,0x9f,0x3c]

  ldrb w3, [x1, #-1]
  ldrh w4, [x2, #1]
  ldrh w5, [x3, #-1]
  ldrsb w6, [x4, #-1]
  ldrsb x7, [x5, #-1]
  ldrsh w8, [x6, #1]
  ldrsh w9, [x7, #-1]
  ldrsh x1, [x8, #1]
  ldrsh x2, [x9, #-1]
  ldrsw x3, [x10, #10]
  ldrsw x4, [x11, #-1]

; CHECK: ldurb	w3, [x1, #-1]           ; encoding: [0x23,0xf0,0x5f,0x38]
; CHECK: ldurh	w4, [x2, #1]            ; encoding: [0x44,0x10,0x40,0x78]
; CHECK: ldurh	w5, [x3, #-1]           ; encoding: [0x65,0xf0,0x5f,0x78]
; CHECK: ldursb	w6, [x4, #-1]           ; encoding: [0x86,0xf0,0xdf,0x38]
; CHECK: ldursb	x7, [x5, #-1]           ; encoding: [0xa7,0xf0,0x9f,0x38]
; CHECK: ldursh	w8, [x6, #1]            ; encoding: [0xc8,0x10,0xc0,0x78]
; CHECK: ldursh	w9, [x7, #-1]           ; encoding: [0xe9,0xf0,0xdf,0x78]
; CHECK: ldursh	x1, [x8, #1]            ; encoding: [0x01,0x11,0x80,0x78]
; CHECK: ldursh	x2, [x9, #-1]           ; encoding: [0x22,0xf1,0x9f,0x78]
; CHECK: ldursw	x3, [x10, #10]          ; encoding: [0x43,0xa1,0x80,0xb8]
; CHECK: ldursw	x4, [x11, #-1]          ; encoding: [0x64,0xf1,0x9f,0xb8]

  strb w3, [x1, #-1]
  strh w4, [x2, #1]
  strh w5, [x3, #-1]

; CHECK: sturb	w3, [x1, #-1]           ; encoding: [0x23,0xf0,0x1f,0x38]
; CHECK: sturh	w4, [x2, #1]            ; encoding: [0x44,0x10,0x00,0x78]
; CHECK: sturh	w5, [x3, #-1]           ; encoding: [0x65,0xf0,0x1f,0x78]