memory-arm-instructions.txt 13 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
# RUN: llvm-mc -triple=armv7-apple-darwin -disassemble < %s | FileCheck %s

#------------------------------------------------------------------------------
# LDR (immediate)
#------------------------------------------------------------------------------
# CHECK: ldr r5, [r7]
# CHECK: ldr r6, [r3, #63]
# CHECK: ldr r2, [r4, #4095]!
# CHECK: ldr r1, [r2], #30
# CHECK: ldr r3, [r1], #-30

0x00 0x50 0x97 0xe5
0x3f 0x60 0x93 0xe5
0xff 0x2f 0xb4 0xe5
0x1e 0x10 0x92 0xe4
0x1e 0x30 0x11 0xe4

#------------------------------------------------------------------------------
# FIXME: LDR (literal)
#------------------------------------------------------------------------------
# label operands currently assert the show-encoding asm comment helper due
# to the use of non-contiguous bit ranges for fixups in ARM. Once that's
# cleaned up, we can write useful assembly testcases for these sorts of
# instructions.

#------------------------------------------------------------------------------
# LDR (register)
#------------------------------------------------------------------------------
# CHECK: ldr r3, [r8, r1]
# CHECK: ldr r2, [r5, -r3]
# CHECK: ldr r1, [r5, r9]!
# CHECK: ldr r6, [r7, -r8]!
# CHECK: ldr r1, [r0, r2, lsr #3]!
# CHECK: ldr r5, [r9], r2
# CHECK: ldr r4, [r3], -r6
# CHECK: ldr r3, [r8, -r2, lsl #15
# CHECK: ldr r1, [r5], r3, asr #15

0x01 0x30 0x98 0xe7
0x03 0x20 0x15 0xe7
0x09 0x10 0xb5 0xe7
0x08 0x60 0x37 0xe7
0xa2 0x11 0xb0 0xe7
0x02 0x50 0x99 0xe6
0x06 0x40 0x13 0xe6
0x82 0x37 0x18 0xe7
0xc3 0x17 0x95 0xe6


#------------------------------------------------------------------------------
# LDRB (immediate)
#------------------------------------------------------------------------------
# CHECK: ldrb r3, [r8]
# CHECK: ldrb r1, [sp, #63]
# CHECK: ldrb r9, [r3, #4095]!
# CHECK: ldrb r8, [r1], #22
# CHECK: ldrb r2, [r7], #-19

0x00 0x30 0xd8 0xe5
0x3f 0x10 0xdd 0xe5
0xff 0x9f 0xf3 0xe5
0x16 0x80 0xd1 0xe4
0x13 0x20 0x57 0xe4


#------------------------------------------------------------------------------
# LDRB (register)
#------------------------------------------------------------------------------
# CHECK: ldrb r9, [r8, r5]
# CHECK: ldrb r1, [r5, -r1]
# CHECK: ldrb r3, [r5, r2]!
# CHECK: ldrb r6, [r9, -r3]!
# CHECK: ldrb r2, [r1], r4
# CHECK: ldrb r8, [r4], -r5
# CHECK: ldrb r7, [r12, -r1, lsl #15
# CHECK: ldrb r5, [r2], r9, asr #15

0x05 0x90 0xd8 0xe7
0x01 0x10 0x55 0xe7
0x02 0x30 0xf5 0xe7
0x03 0x60 0x79 0xe7
0x04 0x20 0xd1 0xe6
0x05 0x80 0x54 0xe6
0x81 0x77 0x5c 0xe7
0xc9 0x57 0xd2 0xe6


#------------------------------------------------------------------------------
# LDRBT
#------------------------------------------------------------------------------
# FIXME: Optional offset operand.
# CHECK: ldrbt r3, [r1], #4
# CHECK: ldrbt r2, [r8], #-8
# CHECK: ldrbt r8, [r7], r6
# CHECK: ldrbt r1, [r2], -r6, lsl #12


0x04 0x30 0xf1 0xe4
0x08 0x20 0x78 0xe4
0x06 0x80 0xf7 0xe6
0x06 0x16 0x72 0xe6


#------------------------------------------------------------------------------
# LDRD (immediate)
#------------------------------------------------------------------------------
# CHECK: ldrd r0, r1, [r5]
# CHECK: ldrd r8, r9, [r2, #15]
# CHECK: ldrd r2, r3, [r9, #32]!
# CHECK: ldrd r6, r7, [r1], #8
# CHECK: ldrd r2, r3, [r8], #0
# CHECK: ldrd r2, r3, [r8], #0
# CHECK: ldrd r2, r3, [r8], #-0

0xd0 0x00 0xc5 0xe1
0xdf 0x80 0xc2 0xe1
0xd0 0x22 0xe9 0xe1
0xd8 0x60 0xc1 0xe0
0xd0 0x20 0xc8 0xe0
0xd0 0x20 0xc8 0xe0
0xd0 0x20 0x48 0xe0


#------------------------------------------------------------------------------
# FIXME: LDRD (label)
#------------------------------------------------------------------------------

#------------------------------------------------------------------------------
# LDRD (register)
#------------------------------------------------------------------------------
# CHECK: ldrd r4, r5, [r1, r3]
# CHECK: ldrd r4, r5, [r7, r2]!
# CHECK: ldrd r0, r1, [r8], r12
# CHECK: ldrd r0, r1, [r8], -r12

0xd3 0x40 0x81 0xe1
0xd2 0x40 0xa7 0xe1
0xdc 0x00 0x88 0xe0
0xdc 0x00 0x08 0xe0


#------------------------------------------------------------------------------
# LDRH (immediate)
#------------------------------------------------------------------------------
# CHECK: ldrh r3, [r4
# CHECK: ldrh r2, [r7, #4
# CHECK: ldrh r1, [r8, #64]!
# CHECK: ldrh r12, [sp], #4

0xb0 0x30 0xd4 0xe1
0xb4 0x20 0xd7 0xe1
0xb0 0x14 0xf8 0xe1
0xb4 0xc0 0xdd 0xe0


#------------------------------------------------------------------------------
# FIXME: LDRH (label)
#------------------------------------------------------------------------------


#------------------------------------------------------------------------------
# LDRH (register)
#------------------------------------------------------------------------------
# CHECK: ldrh r6, [r5, r4
# CHECK: ldrh r3, [r8, r11]!
# CHECK: ldrh r1, [r2, -r1]!
# CHECK: ldrh r9, [r7], r2
# CHECK: ldrh r4, [r3], -r2

0xb4 0x60 0x95 0xe1
0xbb 0x30 0xb8 0xe1
0xb1 0x10 0x32 0xe1
0xb2 0x90 0x97 0xe0
0xb2 0x40 0x13 0xe0


#------------------------------------------------------------------------------
# LDRHT
#------------------------------------------------------------------------------
# CHECK: ldrht r9, [r7], #128
# CHECK: ldrht r4, [r3], #-75
# CHECK: ldrht r9, [r7], r2
# CHECK: ldrht r4, [r3], -r2

0xb0 0x98 0xf7 0xe0
0xbb 0x44 0x73 0xe0
0xb2 0x90 0xb7 0xe0
0xb2 0x40 0x33 0xe0


#------------------------------------------------------------------------------
# LDRSB (immediate)
#------------------------------------------------------------------------------
# CHECK: ldrsb r3, [r4
# CHECK: ldrsb r2, [r7, #17
# CHECK: ldrsb r1, [r8, #255]!
# CHECK: ldrsb r12, [sp], #9

0xd0 0x30 0xd4 0xe1
0xd1 0x21 0xd7 0xe1
0xdf 0x1f 0xf8 0xe1
0xd9 0xc0 0xdd 0xe0


#------------------------------------------------------------------------------
# FIXME: LDRSB (label)
#------------------------------------------------------------------------------


#------------------------------------------------------------------------------
# LDRSB (register)
#------------------------------------------------------------------------------
# CHECK: ldrsb r6, [r5, r4
# CHECK: ldrsb r3, [r8, r11]!
# CHECK: ldrsb r1, [r2, -r1]!
# CHECK: ldrsb r9, [r7], r2
# CHECK: ldrsb r4, [r3], -r2


0xd4 0x60 0x95 0xe1
0xdb 0x30 0xb8 0xe1
0xd1 0x10 0x32 0xe1
0xd2 0x90 0x97 0xe0
0xd2 0x40 0x13 0xe0


#------------------------------------------------------------------------------
# LDRSBT
#------------------------------------------------------------------------------
# CHECK: ldrsbt r5, [r6], #1
# CHECK: ldrsbt r3, [r8], #-12
# CHECK: ldrsbt r8, [r9], r5
# CHECK: ldrsbt r2, [r1], -r4

0xd1 0x50 0xf6 0xe0
0xdc 0x30 0x78 0xe0
0xd5 0x80 0xb9 0xe0
0xd4 0x20 0x31 0xe0


#------------------------------------------------------------------------------
# LDRSH (immediate)
#------------------------------------------------------------------------------
# CHECK: ldrsh r5, [r9
# CHECK: ldrsh r4, [r5, #7
# CHECK: ldrsh r3, [r6, #55]!
# CHECK: ldrsh r2, [r7], #-9

0xf0 0x50 0xd9 0xe1
0xf7 0x40 0xd5 0xe1
0xf7 0x33 0xf6 0xe1
0xf9 0x20 0x57 0xe0


#------------------------------------------------------------------------------
# FIXME: LDRSH (label)
#------------------------------------------------------------------------------


#------------------------------------------------------------------------------
# LDRSH (register)
#------------------------------------------------------------------------------
# CHECK: ldrsh r3, [r1, r5
# CHECK: ldrsh r4, [r6, r1]!
# CHECK: ldrsh r5, [r3, -r6]!
# CHECK: ldrsh r6, [r9], r8
# CHECK: ldrsh r7, [r8], -r3

0xf5 0x30 0x91 0xe1
0xf1 0x40 0xb6 0xe1
0xf6 0x50 0x33 0xe1
0xf8 0x60 0x99 0xe0
0xf3 0x70 0x18 0xe0


#------------------------------------------------------------------------------
# LDRSHT
#------------------------------------------------------------------------------
# CHECK: ldrsht r5, [r6], #1
# CHECK: ldrsht r3, [r8], #-12
# CHECK: ldrsht r8, [r9], r5
# CHECK: ldrsht r2, [r1], -r4

0xf1 0x50 0xf6 0xe0
0xfc 0x30 0x78 0xe0
0xf5 0x80 0xb9 0xe0
0xf4 0x20 0x31 0xe0


#------------------------------------------------------------------------------
# STR (immediate)
#------------------------------------------------------------------------------
# CHECK: str r8, [r12
# CHECK: str r7, [r1, #12
# CHECK: str r3, [r5, #40]!
# CHECK: str r9, [sp], #4095
# CHECK: str r1, [r7], #-128

0x00 0x80 0x8c 0xe5
0x0c 0x70 0x81 0xe5
0x28 0x30 0xa5 0xe5
0xff 0x9f 0x8d 0xe4
0x80 0x10 0x07 0xe4


#------------------------------------------------------------------------------
# FIXME: STR (literal)
#------------------------------------------------------------------------------

#------------------------------------------------------------------------------
# STR (register)
#------------------------------------------------------------------------------
# CHECK: str r9, [r6, r3
# CHECK: str r8, [r0, -r2
# CHECK: str r7, [r1, r6]!
# CHECK: str r6, [sp, -r1]!
# CHECK: str r5, [r3], r9
# CHECK: str r4, [r2], -r5
# CHECK: str r3, [r4, -r2, lsl #2
# CHECK: str r2, [r7], r3, asr #24

0x03 0x90 0x86 0xe7
0x02 0x80 0x00 0xe7
0x06 0x70 0xa1 0xe7
0x01 0x60 0x2d 0xe7
0x09 0x50 0x83 0xe6
0x05 0x40 0x02 0xe6
0x02 0x31 0x04 0xe7
0x43 0x2c 0x87 0xe6


#------------------------------------------------------------------------------
# STRB (immediate)
#------------------------------------------------------------------------------
# CHECK: strb r9, [r2
# CHECK: strb r7, [r1, #3
# CHECK: strb r6, [r4, #405]!
# CHECK: strb r5, [r7], #72
# CHECK: strb r1, [sp], #-1

0x00 0x90 0xc2 0xe5
0x03 0x70 0xc1 0xe5
0x95 0x61 0xe4 0xe5
0x48 0x50 0xc7 0xe4
0x01 0x10 0x4d 0xe4

#------------------------------------------------------------------------------
# FIXME: STRB (literal)
#------------------------------------------------------------------------------

#------------------------------------------------------------------------------
# STRB (register)
#------------------------------------------------------------------------------
# CHECK: strb r1, [r2, r9
# CHECK: strb r2, [r3, -r8
# CHECK: strb r3, [r4, r7]!
# CHECK: strb r4, [r5, -r6]!
# CHECK: strb r5, [r6], r5
# CHECK: strb r6, [r2], -r4
# CHECK: strb r7, [r12, -r3, lsl #5
# CHECK: strb sp, [r7], r2, asr #12

0x09 0x10 0xc2 0xe7
0x08 0x20 0x43 0xe7
0x07 0x30 0xe4 0xe7
0x06 0x40 0x65 0xe7
0x05 0x50 0xc6 0xe6
0x04 0x60 0x42 0xe6
0x83 0x72 0x4c 0xe7
0x42 0xd6 0xc7 0xe6


#------------------------------------------------------------------------------
# STRBT
#------------------------------------------------------------------------------
# FIXME: Optional offset operand.
# CHECK: strbt r6, [r2], #12
# CHECK: strbt r5, [r6], #-13
# CHECK: strbt r4, [r9], r5
# CHECK: strbt r3, [r8], -r2, lsl #3

0x0c 0x60 0xe2 0xe4
0x0d 0x50 0x66 0xe4
0x05 0x40 0xe9 0xe6
0x82 0x31 0x68 0xe6


#------------------------------------------------------------------------------
# STRD (immediate)
#------------------------------------------------------------------------------
# CHECK: strd r0, r1, [r4]
# CHECK: strd r2, r3, [r6, #1]
# CHECK: strd r2, r3, [r7, #22]!
# CHECK: strd r4, r5, [r8], #7
# CHECK: strd r4, r5, [sp], #0
# CHECK: strd r6, r7, [lr], #0
# CHECK: strd r6, r7, [r9], #-0

0xf0 0x00 0xc4 0xe1
0xf1 0x20 0xc6 0xe1
0xf6 0x21 0xe7 0xe1
0xf7 0x40 0xc8 0xe0
0xf0 0x40 0xcd 0xe0
0xf0 0x60 0xce 0xe0
0xf0 0x60 0x49 0xe0


#------------------------------------------------------------------------------
# FIXME: STRD (label)
#------------------------------------------------------------------------------

#------------------------------------------------------------------------------
# STRD (register)
#------------------------------------------------------------------------------
# CHECK: strd r8, r9, [r4, r1]
# CHECK: strd r6, r7, [r3, r9]!
# CHECK: strd r6, r7, [r5], r8
# CHECK: strd r4, r5, [r12], -r10

0xf1 0x80 0x84 0xe1
0xf9 0x60 0xa3 0xe1
0xf8 0x60 0x85 0xe0
0xfa 0x40 0x0c 0xe0

#------------------------------------------------------------------------------
# STRH (immediate)
#------------------------------------------------------------------------------
# CHECK: strh r3, [r4
# CHECK: strh r2, [r7, #4
# CHECK: strh r1, [r8, #64]!
# CHECK: strh r12, [sp], #4

0xb0 0x30 0xc4 0xe1
0xb4 0x20 0xc7 0xe1
0xb0 0x14 0xe8 0xe1
0xb4 0xc0 0xcd 0xe0


#------------------------------------------------------------------------------
# FIXME: STRH (label)
#------------------------------------------------------------------------------


#------------------------------------------------------------------------------
# STRH (register)
#------------------------------------------------------------------------------
# CHECK: strh r6, [r5, r4
# CHECK: strh r3, [r8, r11]!
# CHECK: strh r1, [r2, -r1]!
# CHECK: strh r9, [r7], r2
# CHECK: strh r4, [r3], -r2

0xb4 0x60 0x85 0xe1
0xbb 0x30 0xa8 0xe1
0xb1 0x10 0x22 0xe1
0xb2 0x90 0x87 0xe0
0xb2 0x40 0x03 0xe0

#------------------------------------------------------------------------------
# STRHT
#------------------------------------------------------------------------------
# CHECK: strht r2, [r5], #76
# CHECK: strht r8, [r1], #-25
# CHECK: strht r5, [r3], r4
# CHECK: strht r6, [r8], -r0

0xbc 0x24 0xe5 0xe0
0xb9 0x81 0x61 0xe0
0xb4 0x50 0xa3 0xe0
0xb0 0x60 0x28 0xe0