Home | History | Annotate | Download | only in AArch64
      1 ; RUN: llvm-mc -triple arm64-apple-darwin -show-encoding < %s | FileCheck %s
      2 
      3 foo:
      4 ;-----------------------------------------------------------------------------
      5 ; Indexed loads
      6 ;-----------------------------------------------------------------------------
      7 
      8   ldr    w5, [x4, #20]
      9   ldr    x4, [x3]
     10   ldr    x2, [sp, #32]
     11   ldr    b5, [sp, #1]
     12   ldr    h6, [sp, #2]
     13   ldr    s7, [sp, #4]
     14   ldr    d8, [sp, #8]
     15   ldr    q9, [sp, #16]
     16   ldrb   w4, [x3]
     17   ldrb   w5, [x4, #20]
     18   ldrb	 w2, [x3, _foo@pageoff]
     19   ldrb   w3, [x2, "+[Test method].var"@PAGEOFF]
     20   ldrsb  w9, [x3]
     21   ldrsb  x2, [sp, #128]
     22   ldrh   w2, [sp, #32]
     23   ldrsh  w3, [sp, #32]
     24   ldrsh  x5, [x9, #24]
     25   ldrsw  x9, [sp, #512]
     26 
     27   prfm   #5, [sp, #32]
     28   prfm   #31, [sp, #32]
     29   prfm   pldl1keep, [x2]
     30   prfm   pldl1strm, [x2]
     31   prfm   pldl2keep, [x2]
     32   prfm   pldl2strm, [x2]
     33   prfm   pldl3keep, [x2]
     34   prfm   pldl3strm, [x2]
     35   prfm   pstl1keep, [x2]
     36   prfm   pstl1strm, [x2]
     37   prfm   pstl2keep, [x2]
     38   prfm   pstl2strm, [x2]
     39   prfm   pstl3keep, [x2]
     40   prfm   pstl3strm, [x2]
     41   prfm  pstl3strm, [x4, x5, lsl #3]
     42 
     43 ; CHECK: ldr    w5, [x4, #20]           ; encoding: [0x85,0x14,0x40,0xb9]
     44 ; CHECK: ldr    x4, [x3]                ; encoding: [0x64,0x00,0x40,0xf9]
     45 ; CHECK: ldr    x2, [sp, #32]           ; encoding: [0xe2,0x13,0x40,0xf9]
     46 ; CHECK: ldr    b5, [sp, #1]            ; encoding: [0xe5,0x07,0x40,0x3d]
     47 ; CHECK: ldr    h6, [sp, #2]            ; encoding: [0xe6,0x07,0x40,0x7d]
     48 ; CHECK: ldr    s7, [sp, #4]            ; encoding: [0xe7,0x07,0x40,0xbd]
     49 ; CHECK: ldr    d8, [sp, #8]            ; encoding: [0xe8,0x07,0x40,0xfd]
     50 ; CHECK: ldr    q9, [sp, #16]           ; encoding: [0xe9,0x07,0xc0,0x3d]
     51 ; CHECK: ldrb   w4, [x3]                ; encoding: [0x64,0x00,0x40,0x39]
     52 ; CHECK: ldrb   w5, [x4, #20]           ; encoding: [0x85,0x50,0x40,0x39]
     53 ; CHECK: ldrb	w2, [x3, _foo@PAGEOFF]  ; encoding: [0x62,0bAAAAAA00,0b01AAAAAA,0x39]
     54 ; CHECK: ldrb	w3, [x2, "+[Test method].var"@PAGEOFF] ; encoding: [0x43,0bAAAAAA00,0b01AAAAAA,0x39]
     55 ; CHECK: ldrsb  w9, [x3]                ; encoding: [0x69,0x00,0xc0,0x39]
     56 ; CHECK: ldrsb  x2, [sp, #128]          ; encoding: [0xe2,0x03,0x82,0x39]
     57 ; CHECK: ldrh   w2, [sp, #32]           ; encoding: [0xe2,0x43,0x40,0x79]
     58 ; CHECK: ldrsh  w3, [sp, #32]           ; encoding: [0xe3,0x43,0xc0,0x79]
     59 ; CHECK: ldrsh  x5, [x9, #24]           ; encoding: [0x25,0x31,0x80,0x79]
     60 ; CHECK: ldrsw  x9, [sp, #512]          ; encoding: [0xe9,0x03,0x82,0xb9]
     61 ; CHECK: prfm   pldl3strm, [sp, #32]    ; encoding: [0xe5,0x13,0x80,0xf9]
     62 ; CHECK: prfm	#31, [sp, #32]          ; encoding: [0xff,0x13,0x80,0xf9]
     63 ; CHECK: prfm   pldl1keep, [x2]         ; encoding: [0x40,0x00,0x80,0xf9]
     64 ; CHECK: prfm   pldl1strm, [x2]         ; encoding: [0x41,0x00,0x80,0xf9]
     65 ; CHECK: prfm   pldl2keep, [x2]         ; encoding: [0x42,0x00,0x80,0xf9]
     66 ; CHECK: prfm   pldl2strm, [x2]         ; encoding: [0x43,0x00,0x80,0xf9]
     67 ; CHECK: prfm   pldl3keep, [x2]         ; encoding: [0x44,0x00,0x80,0xf9]
     68 ; CHECK: prfm   pldl3strm, [x2]         ; encoding: [0x45,0x00,0x80,0xf9]
     69 ; CHECK: prfm   pstl1keep, [x2]         ; encoding: [0x50,0x00,0x80,0xf9]
     70 ; CHECK: prfm   pstl1strm, [x2]         ; encoding: [0x51,0x00,0x80,0xf9]
     71 ; CHECK: prfm   pstl2keep, [x2]         ; encoding: [0x52,0x00,0x80,0xf9]
     72 ; CHECK: prfm   pstl2strm, [x2]         ; encoding: [0x53,0x00,0x80,0xf9]
     73 ; CHECK: prfm   pstl3keep, [x2]         ; encoding: [0x54,0x00,0x80,0xf9]
     74 ; CHECK: prfm   pstl3strm, [x2]         ; encoding: [0x55,0x00,0x80,0xf9]
     75 ; CHECK: prfm	pstl3strm, [x4, x5, lsl #3] ; encoding: [0x95,0x78,0xa5,0xf8]
     76 
     77 ;-----------------------------------------------------------------------------
     78 ; Indexed stores
     79 ;-----------------------------------------------------------------------------
     80 
     81   str   x4, [x3]
     82   str   x2, [sp, #32]
     83   str   w5, [x4, #20]
     84   str   b5, [sp, #1]
     85   str   h6, [sp, #2]
     86   str   s7, [sp, #4]
     87   str   d8, [sp, #8]
     88   str   q9, [sp, #16]
     89   strb  w4, [x3]
     90   strb  w5, [x4, #20]
     91   strh  w2, [sp, #32]
     92 
     93 ; CHECK: str   x4, [x3]                 ; encoding: [0x64,0x00,0x00,0xf9]
     94 ; CHECK: str   x2, [sp, #32]            ; encoding: [0xe2,0x13,0x00,0xf9]
     95 ; CHECK: str   w5, [x4, #20]            ; encoding: [0x85,0x14,0x00,0xb9]
     96 ; CHECK: str   b5, [sp, #1]             ; encoding: [0xe5,0x07,0x00,0x3d]
     97 ; CHECK: str   h6, [sp, #2]             ; encoding: [0xe6,0x07,0x00,0x7d]
     98 ; CHECK: str   s7, [sp, #4]             ; encoding: [0xe7,0x07,0x00,0xbd]
     99 ; CHECK: str   d8, [sp, #8]             ; encoding: [0xe8,0x07,0x00,0xfd]
    100 ; CHECK: str   q9, [sp, #16]            ; encoding: [0xe9,0x07,0x80,0x3d]
    101 ; CHECK: strb  w4, [x3]                 ; encoding: [0x64,0x00,0x00,0x39]
    102 ; CHECK: strb  w5, [x4, #20]            ; encoding: [0x85,0x50,0x00,0x39]
    103 ; CHECK: strh  w2, [sp, #32]            ; encoding: [0xe2,0x43,0x00,0x79]
    104 
    105 ;-----------------------------------------------------------------------------
    106 ; Unscaled immediate loads and stores
    107 ;-----------------------------------------------------------------------------
    108 
    109   ldur    w2, [x3]
    110   ldur    w2, [sp, #24]
    111   ldur    x2, [x3]
    112   ldur    x2, [sp, #24]
    113   ldur    b5, [sp, #1]
    114   ldur    h6, [sp, #2]
    115   ldur    s7, [sp, #4]
    116   ldur    d8, [sp, #8]
    117   ldur    q9, [sp, #16]
    118   ldursb  w9, [x3]
    119   ldursb  x2, [sp, #128]
    120   ldursh  w3, [sp, #32]
    121   ldursh  x5, [x9, #24]
    122   ldursw  x9, [sp, #-128]
    123 
    124 ; CHECK: ldur    w2, [x3]               ; encoding: [0x62,0x00,0x40,0xb8]
    125 ; CHECK: ldur    w2, [sp, #24]          ; encoding: [0xe2,0x83,0x41,0xb8]
    126 ; CHECK: ldur    x2, [x3]               ; encoding: [0x62,0x00,0x40,0xf8]
    127 ; CHECK: ldur    x2, [sp, #24]          ; encoding: [0xe2,0x83,0x41,0xf8]
    128 ; CHECK: ldur    b5, [sp, #1]           ; encoding: [0xe5,0x13,0x40,0x3c]
    129 ; CHECK: ldur    h6, [sp, #2]           ; encoding: [0xe6,0x23,0x40,0x7c]
    130 ; CHECK: ldur    s7, [sp, #4]           ; encoding: [0xe7,0x43,0x40,0xbc]
    131 ; CHECK: ldur    d8, [sp, #8]           ; encoding: [0xe8,0x83,0x40,0xfc]
    132 ; CHECK: ldur    q9, [sp, #16]          ; encoding: [0xe9,0x03,0xc1,0x3c]
    133 ; CHECK: ldursb  w9, [x3]               ; encoding: [0x69,0x00,0xc0,0x38]
    134 ; CHECK: ldursb  x2, [sp, #128]         ; encoding: [0xe2,0x03,0x88,0x38]
    135 ; CHECK: ldursh  w3, [sp, #32]          ; encoding: [0xe3,0x03,0xc2,0x78]
    136 ; CHECK: ldursh  x5, [x9, #24]          ; encoding: [0x25,0x81,0x81,0x78]
    137 ; CHECK: ldursw  x9, [sp, #-128]        ; encoding: [0xe9,0x03,0x98,0xb8]
    138 
    139   stur    w4, [x3]
    140   stur    w2, [sp, #32]
    141   stur    x4, [x3]
    142   stur    x2, [sp, #32]
    143   stur    w5, [x4, #20]
    144   stur    b5, [sp, #1]
    145   stur    h6, [sp, #2]
    146   stur    s7, [sp, #4]
    147   stur    d8, [sp, #8]
    148   stur    q9, [sp, #16]
    149   sturb   w4, [x3]
    150   sturb   w5, [x4, #20]
    151   sturh   w2, [sp, #32]
    152   prfum   #5, [sp, #32]
    153 
    154 ; CHECK: stur    w4, [x3]               ; encoding: [0x64,0x00,0x00,0xb8]
    155 ; CHECK: stur    w2, [sp, #32]          ; encoding: [0xe2,0x03,0x02,0xb8]
    156 ; CHECK: stur    x4, [x3]               ; encoding: [0x64,0x00,0x00,0xf8]
    157 ; CHECK: stur    x2, [sp, #32]          ; encoding: [0xe2,0x03,0x02,0xf8]
    158 ; CHECK: stur    w5, [x4, #20]          ; encoding: [0x85,0x40,0x01,0xb8]
    159 ; CHECK: stur    b5, [sp, #1]           ; encoding: [0xe5,0x13,0x00,0x3c]
    160 ; CHECK: stur    h6, [sp, #2]           ; encoding: [0xe6,0x23,0x00,0x7c]
    161 ; CHECK: stur    s7, [sp, #4]           ; encoding: [0xe7,0x43,0x00,0xbc]
    162 ; CHECK: stur    d8, [sp, #8]           ; encoding: [0xe8,0x83,0x00,0xfc]
    163 ; CHECK: stur    q9, [sp, #16]          ; encoding: [0xe9,0x03,0x81,0x3c]
    164 ; CHECK: sturb   w4, [x3]               ; encoding: [0x64,0x00,0x00,0x38]
    165 ; CHECK: sturb   w5, [x4, #20]          ; encoding: [0x85,0x40,0x01,0x38]
    166 ; CHECK: sturh   w2, [sp, #32]          ; encoding: [0xe2,0x03,0x02,0x78]
    167 ; CHECK: prfum   pldl3strm, [sp, #32]   ; encoding: [0xe5,0x03,0x82,0xf8]
    168 
    169 ;-----------------------------------------------------------------------------
    170 ; Unprivileged loads and stores
    171 ;-----------------------------------------------------------------------------
    172 
    173   ldtr    w3, [x4, #16]
    174   ldtr    x3, [x4, #16]
    175   ldtrb   w3, [x4, #16]
    176   ldtrsb  w9, [x3]
    177   ldtrsb  x2, [sp, #128]
    178   ldtrh   w3, [x4, #16]
    179   ldtrsh  w3, [sp, #32]
    180   ldtrsh  x5, [x9, #24]
    181   ldtrsw  x9, [sp, #-128]
    182 
    183 ; CHECK: ldtr   w3, [x4, #16]           ; encoding: [0x83,0x08,0x41,0xb8]
    184 ; CHECK: ldtr   x3, [x4, #16]           ; encoding: [0x83,0x08,0x41,0xf8]
    185 ; CHECK: ldtrb  w3, [x4, #16]           ; encoding: [0x83,0x08,0x41,0x38]
    186 ; CHECK: ldtrsb w9, [x3]                ; encoding: [0x69,0x08,0xc0,0x38]
    187 ; CHECK: ldtrsb x2, [sp, #128]          ; encoding: [0xe2,0x0b,0x88,0x38]
    188 ; CHECK: ldtrh  w3, [x4, #16]           ; encoding: [0x83,0x08,0x41,0x78]
    189 ; CHECK: ldtrsh w3, [sp, #32]           ; encoding: [0xe3,0x0b,0xc2,0x78]
    190 ; CHECK: ldtrsh x5, [x9, #24]           ; encoding: [0x25,0x89,0x81,0x78]
    191 ; CHECK: ldtrsw x9, [sp, #-128]         ; encoding: [0xe9,0x0b,0x98,0xb8]
    192 
    193   sttr    w5, [x4, #20]
    194   sttr    x4, [x3]
    195   sttr    x2, [sp, #32]
    196   sttrb   w4, [x3]
    197   sttrb   w5, [x4, #20]
    198   sttrh   w2, [sp, #32]
    199 
    200 ; CHECK: sttr   w5, [x4, #20]           ; encoding: [0x85,0x48,0x01,0xb8]
    201 ; CHECK: sttr   x4, [x3]                ; encoding: [0x64,0x08,0x00,0xf8]
    202 ; CHECK: sttr   x2, [sp, #32]           ; encoding: [0xe2,0x0b,0x02,0xf8]
    203 ; CHECK: sttrb  w4, [x3]                ; encoding: [0x64,0x08,0x00,0x38]
    204 ; CHECK: sttrb  w5, [x4, #20]           ; encoding: [0x85,0x48,0x01,0x38]
    205 ; CHECK: sttrh  w2, [sp, #32]           ; encoding: [0xe2,0x0b,0x02,0x78]
    206 
    207 ;-----------------------------------------------------------------------------
    208 ; Pre-indexed loads and stores
    209 ;-----------------------------------------------------------------------------
    210 
    211   ldr   x29, [x7, #8]!
    212   ldr   x30, [x7, #8]!
    213   ldr   b5, [x0, #1]!
    214   ldr   h6, [x0, #2]!
    215   ldr   s7, [x0, #4]!
    216   ldr   d8, [x0, #8]!
    217   ldr   q9, [x0, #16]!
    218 
    219   str   x30, [x7, #-8]!
    220   str   x29, [x7, #-8]!
    221   str   b5, [x0, #-1]!
    222   str   h6, [x0, #-2]!
    223   str   s7, [x0, #-4]!
    224   str   d8, [x0, #-8]!
    225   str   q9, [x0, #-16]!
    226 
    227 ; CHECK: ldr  x29, [x7, #8]!             ; encoding: [0xfd,0x8c,0x40,0xf8]
    228 ; CHECK: ldr  x30, [x7, #8]!             ; encoding: [0xfe,0x8c,0x40,0xf8]
    229 ; CHECK: ldr  b5, [x0, #1]!             ; encoding: [0x05,0x1c,0x40,0x3c]
    230 ; CHECK: ldr  h6, [x0, #2]!             ; encoding: [0x06,0x2c,0x40,0x7c]
    231 ; CHECK: ldr  s7, [x0, #4]!             ; encoding: [0x07,0x4c,0x40,0xbc]
    232 ; CHECK: ldr  d8, [x0, #8]!             ; encoding: [0x08,0x8c,0x40,0xfc]
    233 ; CHECK: ldr  q9, [x0, #16]!            ; encoding: [0x09,0x0c,0xc1,0x3c]
    234 
    235 ; CHECK: str  x30, [x7, #-8]!            ; encoding: [0xfe,0x8c,0x1f,0xf8]
    236 ; CHECK: str  x29, [x7, #-8]!            ; encoding: [0xfd,0x8c,0x1f,0xf8]
    237 ; CHECK: str  b5, [x0, #-1]!            ; encoding: [0x05,0xfc,0x1f,0x3c]
    238 ; CHECK: str  h6, [x0, #-2]!            ; encoding: [0x06,0xec,0x1f,0x7c]
    239 ; CHECK: str  s7, [x0, #-4]!            ; encoding: [0x07,0xcc,0x1f,0xbc]
    240 ; CHECK: str  d8, [x0, #-8]!            ; encoding: [0x08,0x8c,0x1f,0xfc]
    241 ; CHECK: str  q9, [x0, #-16]!           ; encoding: [0x09,0x0c,0x9f,0x3c]
    242 
    243 ;-----------------------------------------------------------------------------
    244 ; post-indexed loads and stores
    245 ;-----------------------------------------------------------------------------
    246   str x30, [x7], #-8
    247   str x29, [x7], #-8
    248   str b5, [x0], #-1
    249   str h6, [x0], #-2
    250   str s7, [x0], #-4
    251   str d8, [x0], #-8
    252   str q9, [x0], #-16
    253 
    254   ldr x29, [x7], #8
    255   ldr x30, [x7], #8
    256   ldr b5, [x0], #1
    257   ldr h6, [x0], #2
    258   ldr s7, [x0], #4
    259   ldr d8, [x0], #8
    260   ldr q9, [x0], #16
    261 
    262 ; CHECK: str x30, [x7], #-8             ; encoding: [0xfe,0x84,0x1f,0xf8]
    263 ; CHECK: str x29, [x7], #-8             ; encoding: [0xfd,0x84,0x1f,0xf8]
    264 ; CHECK: str b5, [x0], #-1             ; encoding: [0x05,0xf4,0x1f,0x3c]
    265 ; CHECK: str h6, [x0], #-2             ; encoding: [0x06,0xe4,0x1f,0x7c]
    266 ; CHECK: str s7, [x0], #-4             ; encoding: [0x07,0xc4,0x1f,0xbc]
    267 ; CHECK: str d8, [x0], #-8             ; encoding: [0x08,0x84,0x1f,0xfc]
    268 ; CHECK: str q9, [x0], #-16            ; encoding: [0x09,0x04,0x9f,0x3c]
    269 
    270 ; CHECK: ldr x29, [x7], #8              ; encoding: [0xfd,0x84,0x40,0xf8]
    271 ; CHECK: ldr x30, [x7], #8              ; encoding: [0xfe,0x84,0x40,0xf8]
    272 ; CHECK: ldr b5, [x0], #1              ; encoding: [0x05,0x14,0x40,0x3c]
    273 ; CHECK: ldr h6, [x0], #2              ; encoding: [0x06,0x24,0x40,0x7c]
    274 ; CHECK: ldr s7, [x0], #4              ; encoding: [0x07,0x44,0x40,0xbc]
    275 ; CHECK: ldr d8, [x0], #8              ; encoding: [0x08,0x84,0x40,0xfc]
    276 ; CHECK: ldr q9, [x0], #16             ; encoding: [0x09,0x04,0xc1,0x3c]
    277 
    278 ;-----------------------------------------------------------------------------
    279 ; Load/Store pair (indexed, offset)
    280 ;-----------------------------------------------------------------------------
    281 
    282   ldp    w3, w2, [x15, #16]
    283   ldp    x4, x9, [sp, #-16]
    284   ldpsw  x2, x3, [x14, #16]
    285   ldpsw  x2, x3, [sp, #-16]
    286   ldp    s10, s1, [x2, #64]
    287   ldp    d10, d1, [x2]
    288   ldp    q2, q3, [x0, #32]
    289 
    290 ; CHECK: ldp    w3, w2, [x15, #16]      ; encoding: [0xe3,0x09,0x42,0x29]
    291 ; CHECK: ldp    x4, x9, [sp, #-16]      ; encoding: [0xe4,0x27,0x7f,0xa9]
    292 ; CHECK: ldpsw  x2, x3, [x14, #16]      ; encoding: [0xc2,0x0d,0x42,0x69]
    293 ; CHECK: ldpsw  x2, x3, [sp, #-16]      ; encoding: [0xe2,0x0f,0x7e,0x69]
    294 ; CHECK: ldp    s10, s1, [x2, #64]      ; encoding: [0x4a,0x04,0x48,0x2d]
    295 ; CHECK: ldp    d10, d1, [x2]           ; encoding: [0x4a,0x04,0x40,0x6d]
    296 ; CHECK: ldp    q2, q3, [x0, #32]       ; encoding: [0x02,0x0c,0x41,0xad]
    297 
    298   stp    w3, w2, [x15, #16]
    299   stp    x4, x9, [sp, #-16]
    300   stp    s10, s1, [x2, #64]
    301   stp    d10, d1, [x2]
    302   stp    q2, q3, [x0, #32]
    303 
    304 ; CHECK: stp    w3, w2, [x15, #16]      ; encoding: [0xe3,0x09,0x02,0x29]
    305 ; CHECK: stp    x4, x9, [sp, #-16]      ; encoding: [0xe4,0x27,0x3f,0xa9]
    306 ; CHECK: stp    s10, s1, [x2, #64]      ; encoding: [0x4a,0x04,0x08,0x2d]
    307 ; CHECK: stp    d10, d1, [x2]           ; encoding: [0x4a,0x04,0x00,0x6d]
    308 ; CHECK: stp    q2, q3, [x0, #32]       ; encoding: [0x02,0x0c,0x01,0xad]
    309 
    310 ;-----------------------------------------------------------------------------
    311 ; Load/Store pair (pre-indexed)
    312 ;-----------------------------------------------------------------------------
    313 
    314   ldp    w3, w2, [x15, #16]!
    315   ldp    x4, x9, [sp, #-16]!
    316   ldpsw  x2, x3, [x14, #16]!
    317   ldpsw  x2, x3, [sp, #-16]!
    318   ldp    s10, s1, [x2, #64]!
    319   ldp    d10, d1, [x2, #16]!
    320 
    321 ; CHECK: ldp  w3, w2, [x15, #16]!       ; encoding: [0xe3,0x09,0xc2,0x29]
    322 ; CHECK: ldp  x4, x9, [sp, #-16]!       ; encoding: [0xe4,0x27,0xff,0xa9]
    323 ; CHECK: ldpsw	x2, x3, [x14, #16]!     ; encoding: [0xc2,0x0d,0xc2,0x69]
    324 ; CHECK: ldpsw	x2, x3, [sp, #-16]!     ; encoding: [0xe2,0x0f,0xfe,0x69]
    325 ; CHECK: ldp  s10, s1, [x2, #64]!       ; encoding: [0x4a,0x04,0xc8,0x2d]
    326 ; CHECK: ldp  d10, d1, [x2, #16]!       ; encoding: [0x4a,0x04,0xc1,0x6d]
    327 
    328   stp    w3, w2, [x15, #16]!
    329   stp    x4, x9, [sp, #-16]!
    330   stp    s10, s1, [x2, #64]!
    331   stp    d10, d1, [x2, #16]!
    332 
    333 ; CHECK: stp  w3, w2, [x15, #16]!       ; encoding: [0xe3,0x09,0x82,0x29]
    334 ; CHECK: stp  x4, x9, [sp, #-16]!       ; encoding: [0xe4,0x27,0xbf,0xa9]
    335 ; CHECK: stp  s10, s1, [x2, #64]!       ; encoding: [0x4a,0x04,0x88,0x2d]
    336 ; CHECK: stp  d10, d1, [x2, #16]!       ; encoding: [0x4a,0x04,0x81,0x6d]
    337 
    338 ;-----------------------------------------------------------------------------
    339 ; Load/Store pair (post-indexed)
    340 ;-----------------------------------------------------------------------------
    341 
    342   ldp    w3, w2, [x15], #16
    343   ldp    x4, x9, [sp], #-16
    344   ldpsw  x2, x3, [x14], #16
    345   ldpsw  x2, x3, [sp], #-16
    346   ldp    s10, s1, [x2], #64
    347   ldp    d10, d1, [x2], #16
    348 
    349 ; CHECK: ldp  w3, w2, [x15], #16        ; encoding: [0xe3,0x09,0xc2,0x28]
    350 ; CHECK: ldp  x4, x9, [sp], #-16        ; encoding: [0xe4,0x27,0xff,0xa8]
    351 ; CHECK: ldpsw	x2, x3, [x14], #16      ; encoding: [0xc2,0x0d,0xc2,0x68]
    352 ; CHECK: ldpsw	x2, x3, [sp], #-16      ; encoding: [0xe2,0x0f,0xfe,0x68]
    353 ; CHECK: ldp  s10, s1, [x2], #64        ; encoding: [0x4a,0x04,0xc8,0x2c]
    354 ; CHECK: ldp  d10, d1, [x2], #16        ; encoding: [0x4a,0x04,0xc1,0x6c]
    355 
    356   stp    w3, w2, [x15], #16
    357   stp    x4, x9, [sp], #-16
    358   stp    s10, s1, [x2], #64
    359   stp    d10, d1, [x2], #16
    360 
    361 ; CHECK: stp  w3, w2, [x15], #16        ; encoding: [0xe3,0x09,0x82,0x28]
    362 ; CHECK: stp  x4, x9, [sp], #-16        ; encoding: [0xe4,0x27,0xbf,0xa8]
    363 ; CHECK: stp  s10, s1, [x2], #64        ; encoding: [0x4a,0x04,0x88,0x2c]
    364 ; CHECK: stp  d10, d1, [x2], #16        ; encoding: [0x4a,0x04,0x81,0x6c]
    365 
    366 ;-----------------------------------------------------------------------------
    367 ; Load/Store pair (no-allocate)
    368 ;-----------------------------------------------------------------------------
    369 
    370   ldnp  w3, w2, [x15, #16]
    371   ldnp  x4, x9, [sp, #-16]
    372   ldnp  s10, s1, [x2, #64]
    373   ldnp  d10, d1, [x2]
    374 
    375 ; CHECK: ldnp  w3, w2, [x15, #16]       ; encoding: [0xe3,0x09,0x42,0x28]
    376 ; CHECK: ldnp  x4, x9, [sp, #-16]       ; encoding: [0xe4,0x27,0x7f,0xa8]
    377 ; CHECK: ldnp  s10, s1, [x2, #64]       ; encoding: [0x4a,0x04,0x48,0x2c]
    378 ; CHECK: ldnp  d10, d1, [x2]            ; encoding: [0x4a,0x04,0x40,0x6c]
    379 
    380   stnp  w3, w2, [x15, #16]
    381   stnp  x4, x9, [sp, #-16]
    382   stnp  s10, s1, [x2, #64]
    383   stnp  d10, d1, [x2]
    384 
    385 ; CHECK: stnp  w3, w2, [x15, #16]       ; encoding: [0xe3,0x09,0x02,0x28]
    386 ; CHECK: stnp  x4, x9, [sp, #-16]       ; encoding: [0xe4,0x27,0x3f,0xa8]
    387 ; CHECK: stnp  s10, s1, [x2, #64]       ; encoding: [0x4a,0x04,0x08,0x2c]
    388 ; CHECK: stnp  d10, d1, [x2]            ; encoding: [0x4a,0x04,0x00,0x6c]
    389 
    390 ;-----------------------------------------------------------------------------
    391 ; Load/Store register offset
    392 ;-----------------------------------------------------------------------------
    393 
    394   ldr  w0, [x0, x0]
    395   ldr  w0, [x0, x0, lsl #2]
    396   ldr  x0, [x0, x0]
    397   ldr  x0, [x0, x0, lsl #3]
    398   ldr  x0, [x0, x0, sxtx]
    399 
    400 ; CHECK: ldr  w0, [x0, x0]              ; encoding: [0x00,0x68,0x60,0xb8]
    401 ; CHECK: ldr  w0, [x0, x0, lsl #2]      ; encoding: [0x00,0x78,0x60,0xb8]
    402 ; CHECK: ldr  x0, [x0, x0]              ; encoding: [0x00,0x68,0x60,0xf8]
    403 ; CHECK: ldr  x0, [x0, x0, lsl #3]      ; encoding: [0x00,0x78,0x60,0xf8]
    404 ; CHECK: ldr  x0, [x0, x0, sxtx]        ; encoding: [0x00,0xe8,0x60,0xf8]
    405 
    406   ldr  b1, [x1, x2]
    407   ldr  b1, [x1, x2, lsl #0]
    408   ldr  h1, [x1, x2]
    409   ldr  h1, [x1, x2, lsl #1]
    410   ldr  s1, [x1, x2]
    411   ldr  s1, [x1, x2, lsl #2]
    412   ldr  d1, [x1, x2]
    413   ldr  d1, [x1, x2, lsl #3]
    414   ldr  q1, [x1, x2]
    415   ldr  q1, [x1, x2, lsl #4]
    416 
    417 ; CHECK: ldr  b1, [x1, x2]              ; encoding: [0x21,0x68,0x62,0x3c]
    418 ; CHECK: ldr  b1, [x1, x2, lsl #0]      ; encoding: [0x21,0x78,0x62,0x3c]
    419 ; CHECK: ldr  h1, [x1, x2]              ; encoding: [0x21,0x68,0x62,0x7c]
    420 ; CHECK: ldr  h1, [x1, x2, lsl #1]      ; encoding: [0x21,0x78,0x62,0x7c]
    421 ; CHECK: ldr  s1, [x1, x2]              ; encoding: [0x21,0x68,0x62,0xbc]
    422 ; CHECK: ldr  s1, [x1, x2, lsl #2]      ; encoding: [0x21,0x78,0x62,0xbc]
    423 ; CHECK: ldr  d1, [x1, x2]              ; encoding: [0x21,0x68,0x62,0xfc]
    424 ; CHECK: ldr  d1, [x1, x2, lsl #3]      ; encoding: [0x21,0x78,0x62,0xfc]
    425 ; CHECK: ldr  q1, [x1, x2]              ; encoding: [0x21,0x68,0xe2,0x3c]
    426 ; CHECK: ldr  q1, [x1, x2, lsl #4]      ; encoding: [0x21,0x78,0xe2,0x3c]
    427 
    428   str  d1, [sp, x3]
    429   str  d1, [sp, w3, uxtw #3]
    430   str  q1, [sp, x3]
    431   str  q1, [sp, w3, uxtw #4]
    432 
    433 ; CHECK: str  d1, [sp, x3]              ; encoding: [0xe1,0x6b,0x23,0xfc]
    434 ; CHECK: str  d1, [sp, w3, uxtw #3]     ; encoding: [0xe1,0x5b,0x23,0xfc]
    435 ; CHECK: str  q1, [sp, x3]              ; encoding: [0xe1,0x6b,0xa3,0x3c]
    436 ; CHECK: str  q1, [sp, w3, uxtw #4]     ; encoding: [0xe1,0x5b,0xa3,0x3c]
    437 
    438 ;-----------------------------------------------------------------------------
    439 ; Load literal
    440 ;-----------------------------------------------------------------------------
    441 
    442   ldr    w5, foo
    443   ldr    x4, foo
    444   ldrsw  x9, foo
    445   prfm   #5, foo
    446 
    447 ; CHECK: ldr    w5, foo                 ; encoding: [0bAAA00101,A,A,0x18]
    448 ; CHECK: ldr    x4, foo                 ; encoding: [0bAAA00100,A,A,0x58]
    449 ; CHECK: ldrsw  x9, foo                 ; encoding: [0bAAA01001,A,A,0x98]
    450 ; CHECK: prfm   pldl3strm, foo          ; encoding: [0bAAA00101,A,A,0xd8]
    451 
    452 ;-----------------------------------------------------------------------------
    453 ; Load/Store exclusive
    454 ;-----------------------------------------------------------------------------
    455 
    456   ldxr   w6, [x1]
    457   ldxr   x6, [x1]
    458   ldxrb  w6, [x1]
    459   ldxrh  w6, [x1]
    460   ldxp   w7, w3, [x9]
    461   ldxp   x7, x3, [x9]
    462 
    463 ; CHECK: ldxrb  w6, [x1]                ; encoding: [0x26,0x7c,0x5f,0x08]
    464 ; CHECK: ldxrh  w6, [x1]                ; encoding: [0x26,0x7c,0x5f,0x48]
    465 ; CHECK: ldxp   w7, w3, [x9]            ; encoding: [0x27,0x0d,0x7f,0x88]
    466 ; CHECK: ldxp   x7, x3, [x9]            ; encoding: [0x27,0x0d,0x7f,0xc8]
    467 
    468   stxr   w1, x4, [x3]
    469   stxr   w1, w4, [x3]
    470   stxrb  w1, w4, [x3]
    471   stxrh  w1, w4, [x3]
    472   stxp   w1, x2, x6, [x1]
    473   stxp   w1, w2, w6, [x1]
    474 
    475 ; CHECK: stxr   w1, x4, [x3]            ; encoding: [0x64,0x7c,0x01,0xc8]
    476 ; CHECK: stxr   w1, w4, [x3]            ; encoding: [0x64,0x7c,0x01,0x88]
    477 ; CHECK: stxrb  w1, w4, [x3]            ; encoding: [0x64,0x7c,0x01,0x08]
    478 ; CHECK: stxrh  w1, w4, [x3]            ; encoding: [0x64,0x7c,0x01,0x48]
    479 ; CHECK: stxp   w1, x2, x6, [x1]        ; encoding: [0x22,0x18,0x21,0xc8]
    480 ; CHECK: stxp   w1, w2, w6, [x1]        ; encoding: [0x22,0x18,0x21,0x88]
    481 
    482 ;-----------------------------------------------------------------------------
    483 ; Load-acquire/Store-release non-exclusive
    484 ;-----------------------------------------------------------------------------
    485 
    486   ldar   w4, [sp]
    487   ldar   x4, [sp, #0]
    488   ldarb  w4, [sp]
    489   ldarh  w4, [sp]
    490 
    491 ; CHECK: ldar   w4, [sp]                ; encoding: [0xe4,0xff,0xdf,0x88]
    492 ; CHECK: ldar   x4, [sp]                ; encoding: [0xe4,0xff,0xdf,0xc8]
    493 ; CHECK: ldarb  w4, [sp]                ; encoding: [0xe4,0xff,0xdf,0x08]
    494 ; CHECK: ldarh  w4, [sp]                ; encoding: [0xe4,0xff,0xdf,0x48]
    495 
    496   stlr   w3, [x6]
    497   stlr   x3, [x6]
    498   stlrb  w3, [x6]
    499   stlrh  w3, [x6]
    500 
    501 ; CHECK: stlr   w3, [x6]                ; encoding: [0xc3,0xfc,0x9f,0x88]
    502 ; CHECK: stlr   x3, [x6]                ; encoding: [0xc3,0xfc,0x9f,0xc8]
    503 ; CHECK: stlrb  w3, [x6]                ; encoding: [0xc3,0xfc,0x9f,0x08]
    504 ; CHECK: stlrh  w3, [x6]                ; encoding: [0xc3,0xfc,0x9f,0x48]
    505 
    506 ;-----------------------------------------------------------------------------
    507 ; Load-acquire/Store-release exclusive
    508 ;-----------------------------------------------------------------------------
    509 
    510   ldaxr   w2, [x4]
    511   ldaxr   x2, [x4]
    512   ldaxrb  w2, [x4, #0]
    513   ldaxrh  w2, [x4]
    514   ldaxp   w2, w6, [x1]
    515   ldaxp   x2, x6, [x1]
    516 
    517 ; CHECK: ldaxr   w2, [x4]               ; encoding: [0x82,0xfc,0x5f,0x88]
    518 ; CHECK: ldaxr   x2, [x4]               ; encoding: [0x82,0xfc,0x5f,0xc8]
    519 ; CHECK: ldaxrb  w2, [x4]               ; encoding: [0x82,0xfc,0x5f,0x08]
    520 ; CHECK: ldaxrh  w2, [x4]               ; encoding: [0x82,0xfc,0x5f,0x48]
    521 ; CHECK: ldaxp   w2, w6, [x1]           ; encoding: [0x22,0x98,0x7f,0x88]
    522 ; CHECK: ldaxp   x2, x6, [x1]           ; encoding: [0x22,0x98,0x7f,0xc8]
    523 
    524   stlxr   w8, x7, [x1]
    525   stlxr   w8, w7, [x1]
    526   stlxrb  w8, w7, [x1]
    527   stlxrh  w8, w7, [x1]
    528   stlxp   w1, x2, x6, [x1]
    529   stlxp   w1, w2, w6, [x1]
    530 
    531 ; CHECK: stlxr  w8, x7, [x1]            ; encoding: [0x27,0xfc,0x08,0xc8]
    532 ; CHECK: stlxr  w8, w7, [x1]            ; encoding: [0x27,0xfc,0x08,0x88]
    533 ; CHECK: stlxrb w8, w7, [x1]            ; encoding: [0x27,0xfc,0x08,0x08]
    534 ; CHECK: stlxrh w8, w7, [x1]            ; encoding: [0x27,0xfc,0x08,0x48]
    535 ; CHECK: stlxp  w1, x2, x6, [x1]        ; encoding: [0x22,0x98,0x21,0xc8]
    536 ; CHECK: stlxp  w1, w2, w6, [x1]        ; encoding: [0x22,0x98,0x21,0x88]
    537 
    538 
    539 ;-----------------------------------------------------------------------------
    540 ; LDUR/STUR aliases for negative and unaligned LDR/STR instructions.
    541 ;
    542 ; According to the ARM ISA documentation:
    543 ; "A programmer-friendly assembler should also generate these instructions
    544 ; in response to the standard LDR/STR mnemonics when the immediate offset is
    545 ; unambiguous, i.e. negative or unaligned."
    546 ;-----------------------------------------------------------------------------
    547 
    548   ldr x11, [x29, #-8]
    549   ldr x11, [x29, #7]
    550   ldr w0, [x0, #2]
    551   ldr w0, [x0, #-256]
    552   ldr b2, [x1, #-2]
    553   ldr h3, [x2, #3]
    554   ldr h3, [x3, #-4]
    555   ldr s3, [x4, #3]
    556   ldr s3, [x5, #-4]
    557   ldr d4, [x6, #4]
    558   ldr d4, [x7, #-8]
    559   ldr q5, [x8, #8]
    560   ldr q5, [x9, #-16]
    561 
    562 ; CHECK: ldur	x11, [x29, #-8]          ; encoding: [0xab,0x83,0x5f,0xf8]
    563 ; CHECK: ldur	x11, [x29, #7]           ; encoding: [0xab,0x73,0x40,0xf8]
    564 ; CHECK: ldur	w0, [x0, #2]            ; encoding: [0x00,0x20,0x40,0xb8]
    565 ; CHECK: ldur	w0, [x0, #-256]         ; encoding: [0x00,0x00,0x50,0xb8]
    566 ; CHECK: ldur	b2, [x1, #-2]           ; encoding: [0x22,0xe0,0x5f,0x3c]
    567 ; CHECK: ldur	h3, [x2, #3]            ; encoding: [0x43,0x30,0x40,0x7c]
    568 ; CHECK: ldur	h3, [x3, #-4]           ; encoding: [0x63,0xc0,0x5f,0x7c]
    569 ; CHECK: ldur	s3, [x4, #3]            ; encoding: [0x83,0x30,0x40,0xbc]
    570 ; CHECK: ldur	s3, [x5, #-4]           ; encoding: [0xa3,0xc0,0x5f,0xbc]
    571 ; CHECK: ldur	d4, [x6, #4]            ; encoding: [0xc4,0x40,0x40,0xfc]
    572 ; CHECK: ldur	d4, [x7, #-8]           ; encoding: [0xe4,0x80,0x5f,0xfc]
    573 ; CHECK: ldur	q5, [x8, #8]            ; encoding: [0x05,0x81,0xc0,0x3c]
    574 ; CHECK: ldur	q5, [x9, #-16]          ; encoding: [0x25,0x01,0xdf,0x3c]
    575 
    576   str x11, [x29, #-8]
    577   str x11, [x29, #7]
    578   str w0, [x0, #2]
    579   str w0, [x0, #-256]
    580   str b2, [x1, #-2]
    581   str h3, [x2, #3]
    582   str h3, [x3, #-4]
    583   str s3, [x4, #3]
    584   str s3, [x5, #-4]
    585   str d4, [x6, #4]
    586   str d4, [x7, #-8]
    587   str q5, [x8, #8]
    588   str q5, [x9, #-16]
    589 
    590 ; CHECK: stur	x11, [x29, #-8]          ; encoding: [0xab,0x83,0x1f,0xf8]
    591 ; CHECK: stur	x11, [x29, #7]           ; encoding: [0xab,0x73,0x00,0xf8]
    592 ; CHECK: stur	w0, [x0, #2]            ; encoding: [0x00,0x20,0x00,0xb8]
    593 ; CHECK: stur	w0, [x0, #-256]         ; encoding: [0x00,0x00,0x10,0xb8]
    594 ; CHECK: stur	b2, [x1, #-2]           ; encoding: [0x22,0xe0,0x1f,0x3c]
    595 ; CHECK: stur	h3, [x2, #3]            ; encoding: [0x43,0x30,0x00,0x7c]
    596 ; CHECK: stur	h3, [x3, #-4]           ; encoding: [0x63,0xc0,0x1f,0x7c]
    597 ; CHECK: stur	s3, [x4, #3]            ; encoding: [0x83,0x30,0x00,0xbc]
    598 ; CHECK: stur	s3, [x5, #-4]           ; encoding: [0xa3,0xc0,0x1f,0xbc]
    599 ; CHECK: stur	d4, [x6, #4]            ; encoding: [0xc4,0x40,0x00,0xfc]
    600 ; CHECK: stur	d4, [x7, #-8]           ; encoding: [0xe4,0x80,0x1f,0xfc]
    601 ; CHECK: stur	q5, [x8, #8]            ; encoding: [0x05,0x81,0x80,0x3c]
    602 ; CHECK: stur	q5, [x9, #-16]          ; encoding: [0x25,0x01,0x9f,0x3c]
    603 
    604   ldrb w3, [x1, #-1]
    605   ldrh w4, [x2, #1]
    606   ldrh w5, [x3, #-1]
    607   ldrsb w6, [x4, #-1]
    608   ldrsb x7, [x5, #-1]
    609   ldrsh w8, [x6, #1]
    610   ldrsh w9, [x7, #-1]
    611   ldrsh x1, [x8, #1]
    612   ldrsh x2, [x9, #-1]
    613   ldrsw x3, [x10, #10]
    614   ldrsw x4, [x11, #-1]
    615 
    616 ; CHECK: ldurb	w3, [x1, #-1]           ; encoding: [0x23,0xf0,0x5f,0x38]
    617 ; CHECK: ldurh	w4, [x2, #1]            ; encoding: [0x44,0x10,0x40,0x78]
    618 ; CHECK: ldurh	w5, [x3, #-1]           ; encoding: [0x65,0xf0,0x5f,0x78]
    619 ; CHECK: ldursb	w6, [x4, #-1]           ; encoding: [0x86,0xf0,0xdf,0x38]
    620 ; CHECK: ldursb	x7, [x5, #-1]           ; encoding: [0xa7,0xf0,0x9f,0x38]
    621 ; CHECK: ldursh	w8, [x6, #1]            ; encoding: [0xc8,0x10,0xc0,0x78]
    622 ; CHECK: ldursh	w9, [x7, #-1]           ; encoding: [0xe9,0xf0,0xdf,0x78]
    623 ; CHECK: ldursh	x1, [x8, #1]            ; encoding: [0x01,0x11,0x80,0x78]
    624 ; CHECK: ldursh	x2, [x9, #-1]           ; encoding: [0x22,0xf1,0x9f,0x78]
    625 ; CHECK: ldursw	x3, [x10, #10]          ; encoding: [0x43,0xa1,0x80,0xb8]
    626 ; CHECK: ldursw	x4, [x11, #-1]          ; encoding: [0x64,0xf1,0x9f,0xb8]
    627 
    628   strb w3, [x1, #-1]
    629   strh w4, [x2, #1]
    630   strh w5, [x3, #-1]
    631 
    632 ; CHECK: sturb	w3, [x1, #-1]           ; encoding: [0x23,0xf0,0x1f,0x38]
    633 ; CHECK: sturh	w4, [x2, #1]            ; encoding: [0x44,0x10,0x00,0x78]
    634 ; CHECK: sturh	w5, [x3, #-1]           ; encoding: [0x65,0xf0,0x1f,0x78]
    635