1# RUN: llvm-mc -triple=thumbv6-apple-darwin -disassemble < %s | FileCheck %s 2 3#------------------------------------------------------------------------------ 4# ADC (register) 5#------------------------------------------------------------------------------ 6# CHECK: adcs r4, r6 7 80x74 0x41 9 10 11#------------------------------------------------------------------------------ 12# ADD (immediate) 13#------------------------------------------------------------------------------ 14# CHECK: adds r1, r2, #3 15# CHECK: adds r2, r2, #3 16# CHECK: adds r2, #8 17 180xd1 0x1c 190xd2 0x1c 200x08 0x32 21 22#------------------------------------------------------------------------------ 23# ADD (register) 24#------------------------------------------------------------------------------ 25# CHECK: adds r1, r2, r3 26# CHECK: add r2, r8 27 280xd1 0x18 290x42 0x44 30 31#------------------------------------------------------------------------------ 32# ADD (SP plus immediate) 33#------------------------------------------------------------------------------ 34# CHECK: add sp, #508 35# CHECK: add sp, #4 36# CHECK: add r2, sp, #8 37# CHECK: add r2, sp, #1020 38 390x7f 0xb0 400x01 0xb0 410x02 0xaa 420xff 0xaa 43 44 45#------------------------------------------------------------------------------ 46# ADD (SP plus register) 47#------------------------------------------------------------------------------ 48# CHECK: add sp, r3 49# CHECK: add r2, sp, r2 50 510x9d 0x44 520x6a 0x44 53 54#------------------------------------------------------------------------------ 55# ADR 56#------------------------------------------------------------------------------ 57# CHECK: adr r2, #3 580x03 0xa2 59 60#------------------------------------------------------------------------------ 61# ASR (immediate) 62#------------------------------------------------------------------------------ 63# CHECK: asrs r2, r3, #32 64# CHECK: asrs r2, r3, #5 65# CHECK: asrs r2, r3, #1 66 670x1a 0x10 680x5a 0x11 690x5a 0x10 70 71#------------------------------------------------------------------------------ 72# ASR (register) 73#------------------------------------------------------------------------------ 74# CHECK: asrs r5, r2 75 760x15 0x41 77 78#------------------------------------------------------------------------------ 79# BICS 80#------------------------------------------------------------------------------ 81# CHECK: bics r1, r6 82 830xb1 0x43 84 85#------------------------------------------------------------------------------ 86# BKPT 87#------------------------------------------------------------------------------ 88# CHECK: bkpt #0 89# CHECK: bkpt #255 90 910x00 0xbe 920xff 0xbe 93 94#------------------------------------------------------------------------------ 95# BLX (register) 96#------------------------------------------------------------------------------ 97# CHECK: blx r4 98 990xa0 0x47 100 101#------------------------------------------------------------------------------ 102# BX 103#------------------------------------------------------------------------------ 104# CHECK: bx r2 105 1060x10 0x47 107 108#------------------------------------------------------------------------------ 109# CMN 110#------------------------------------------------------------------------------ 111# CHECK: cmn r5, r1 112 1130xcd 0x42 114 115#------------------------------------------------------------------------------ 116# CMP 117#------------------------------------------------------------------------------ 118# CHECK: cmp r6, #32 119# CHECK: cmp r3, r4 120# CHECK: cmp r8, r1 121 1220x20 0x2e 1230xa3 0x42 1240x88 0x45 125 126#------------------------------------------------------------------------------ 127# EOR 128#------------------------------------------------------------------------------ 129# CHECK: eors r4, r5 130 1310x6c 0x40 132 133#------------------------------------------------------------------------------ 134# LDM 135#------------------------------------------------------------------------------ 136# CHECK: ldm r3, {r0, r1, r2, r3, r4, r5, r6, r7} 137# CHECK: ldm r2!, {r1, r3, r4, r5, r7} 138# CHECK: ldm r1, {r1} 139 1400xff 0xcb 1410xba 0xca 1420x02 0xc9 143 144 145#------------------------------------------------------------------------------ 146# LDR (immediate) 147#------------------------------------------------------------------------------ 148# CHECK: ldr r1, [r5] 149# CHECK: ldr r2, [r6, #32] 150# CHECK: ldr r3, [r7, #124] 151# CHECK: ldr r1, [sp] 152# CHECK: ldr r2, [sp, #24] 153# CHECK: ldr r3, [sp, #1020] 154 155 1560x29 0x68 1570x32 0x6a 1580xfb 0x6f 1590x00 0x99 1600x06 0x9a 1610xff 0x9b 162 163#------------------------------------------------------------------------------ 164# LDR (register) 165#------------------------------------------------------------------------------ 166# CHECK: ldr r1, [r2, r3] 167 1680xd1 0x58 169 170 171#------------------------------------------------------------------------------ 172# LDRB (immediate) 173#------------------------------------------------------------------------------ 174# CHECK: ldrb r4, [r3] 175# CHECK: ldrb r5, [r6] 176# CHECK: ldrb r6, [r7, #31] 177 1780x1c 0x78 1790x35 0x78 1800xfe 0x7f 181 182 183#------------------------------------------------------------------------------ 184# LDRB (register) 185#------------------------------------------------------------------------------ 186# CHECK: ldrb r6, [r4, r5] 187 1880x66 0x5d 189 190 191#------------------------------------------------------------------------------ 192# LDRH (immediate) 193#------------------------------------------------------------------------------ 194# CHECK: ldrh r3, [r3] 195# CHECK: ldrh r4, [r6, #2] 196# CHECK: ldrh r5, [r7, #62] 197 1980x1b 0x88 1990x74 0x88 2000xfd 0x8f 201 202#------------------------------------------------------------------------------ 203# LDRH (register) 204#------------------------------------------------------------------------------ 205# CHECK: ldrh r6, [r2, r6] 206 2070x96 0x5b 208 209 210#------------------------------------------------------------------------------ 211# LDRSB/LDRSH 212#------------------------------------------------------------------------------ 213# CHECK: ldrsb r6, [r2, r6] 214# CHECK: ldrsh r3, [r7, r1] 215 2160x96 0x57 2170x7b 0x5e 218 219#------------------------------------------------------------------------------ 220# LSL (immediate) 221#------------------------------------------------------------------------------ 222# CHECK: movs r4, r5 223# CHECK: lsls r4, r5, #4 224 2250x2c 0x00 2260x2c 0x01 227 228 229#------------------------------------------------------------------------------ 230# LSL (register) 231#------------------------------------------------------------------------------ 232# CHECK: lsls r2, r6 233 2340xb2 0x40 235 236 237#------------------------------------------------------------------------------ 238# LSR (immediate) 239#------------------------------------------------------------------------------ 240# CHECK: lsrs r1, r3, #1 241# CHECK: lsrs r1, r3, #32 242 2430x59 0x08 2440x19 0x08 245 246 247#------------------------------------------------------------------------------ 248# LSR (register) 249#------------------------------------------------------------------------------ 250# CHECK: lsrs r2, r6 251 2520xf2 0x40 253 254#------------------------------------------------------------------------------ 255# MOV (immediate) 256#------------------------------------------------------------------------------ 257# CHECK: movs r2, #0 258# CHECK: movs r2, #255 259# CHECK: movs r2, #23 260 2610x00 0x22 2620xff 0x22 2630x17 0x22 264 265 266#------------------------------------------------------------------------------ 267# MOV (register) 268#------------------------------------------------------------------------------ 269# CHECK: mov r3, r4 270# CHECK: movs r1, r3 271 2720x23 0x46 2730x19 0x00 274 275 276#------------------------------------------------------------------------------ 277# MUL 278#------------------------------------------------------------------------------ 279# CHECK: muls r1, r2, r1 280# CHECK: muls r3, r4 281 2820x51 0x43 2830x63 0x43 284 285 286#------------------------------------------------------------------------------ 287# MVN 288#------------------------------------------------------------------------------ 289# CHECK: mvns r6, r3 290 2910xde 0x43 292 293#------------------------------------------------------------------------------ 294# NEG 295#------------------------------------------------------------------------------ 296# CHECK: rsbs r3, r4, #0 297 2980x63 0x42 299 300 301#------------------------------------------------------------------------------ 302# NOP 303#------------------------------------------------------------------------------ 304# CHECK: nop 305 3060xc0 0x46 307 308 309#------------------------------------------------------------------------------ 310# ORR 311#------------------------------------------------------------------------------ 312# CHECK: orrs r3, r4 313 3140x23 0x43 315 316#------------------------------------------------------------------------------ 317# POP 318#------------------------------------------------------------------------------ 319# CHECK: pop {r2, r3, r6} 320 3210x4c 0xbc 322 323 324#------------------------------------------------------------------------------ 325# PUSH 326#------------------------------------------------------------------------------ 327# CHECK: push {r1, r2, r7} 328 3290x86 0xb4 330 331 332#------------------------------------------------------------------------------ 333# REV/REV16/REVSH 334#------------------------------------------------------------------------------ 335# CHECK: rev r6, r3 336# CHECK: rev16 r7, r2 337# CHECK: revsh r5, r1 338 3390x1e 0xba 3400x57 0xba 3410xcd 0xba 342 343 344#------------------------------------------------------------------------------ 345# ROR 346#------------------------------------------------------------------------------ 347# CHECK: rors r2, r7 348 3490xfa 0x41 350 351#------------------------------------------------------------------------------ 352# RSB 353#------------------------------------------------------------------------------ 354# CHECK: rsbs r1, r3, #0 355 3560x59 0x42 357 358 359#------------------------------------------------------------------------------ 360# SBC 361#------------------------------------------------------------------------------ 362# CHECK: sbcs r4, r3 363 3640x9c 0x41 365 366 367#------------------------------------------------------------------------------ 368# SETEND 369#------------------------------------------------------------------------------ 370# CHECK: setend be 371# CHECK: setend le 372 3730x58 0xb6 3740x50 0xb6 375 376#------------------------------------------------------------------------------ 377# STM 378#------------------------------------------------------------------------------ 379# CHECK: stm r1!, {r2, r6} 380# CHECK: stm r1!, {r1, r2, r3, r7} 381 3820x44 0xc1 3830x8e 0xc1 384 385 386#------------------------------------------------------------------------------ 387# STR (immediate) 388#------------------------------------------------------------------------------ 389# CHECK: str r2, [r7] 390# CHECK: str r2, [r7] 391# CHECK: str r5, [r1, #4] 392# CHECK: str r3, [r7, #124] 393# CHECK: str r2, [sp] 394# CHECK: str r3, [sp] 395# CHECK: str r4, [sp, #20] 396# CHECK: str r5, [sp, #1020] 397 3980x3a 0x60 3990x3a 0x60 4000x4d 0x60 4010xfb 0x67 4020x00 0x92 4030x00 0x93 4040x05 0x94 4050xff 0x95 406 407 408#------------------------------------------------------------------------------ 409# STR (register) 410#------------------------------------------------------------------------------ 411# CHECK: str r2, [r7, r3] 412 4130xfa 0x50 414 415 416#------------------------------------------------------------------------------ 417# STRB (immediate) 418#------------------------------------------------------------------------------ 419# CHECK: strb r4, [r3] 420# CHECK: strb r5, [r6] 421# CHECK: strb r6, [r7, #31] 422 4230x1c 0x70 4240x35 0x70 4250xfe 0x77 426 427 428#------------------------------------------------------------------------------ 429# STRB (register) 430#------------------------------------------------------------------------------ 431# CHECK: strb r6, [r4, r5] 432 4330x66 0x55 434 435 436#------------------------------------------------------------------------------ 437# STRH (immediate) 438#------------------------------------------------------------------------------ 439# CHECK: strh r3, [r3] 440# CHECK: strh r4, [r6, #2] 441# CHECK: strh r5, [r7, #62] 442 4430x1b 0x80 4440x74 0x80 4450xfd 0x87 446 447 448#------------------------------------------------------------------------------ 449# STRH (register) 450#------------------------------------------------------------------------------ 451# CHECK: strh r6, [r2, r6] 452 4530x96 0x53 454 455 456#------------------------------------------------------------------------------ 457# SUB (immediate) 458#------------------------------------------------------------------------------ 459# CHECK: subs r1, r2, #3 460# CHECK: subs r2, #3 461# CHECK: subs r2, #8 462 4630xd1 0x1e 4640x03 0x3a 4650x08 0x3a 466 467#------------------------------------------------------------------------------ 468# SUB (register) 469#------------------------------------------------------------------------------ 470# CHECK: subs r1, r2, r3 471 4720xd1 0x1a 473 474#------------------------------------------------------------------------------ 475# SUB (SP minus immediate) 476#------------------------------------------------------------------------------ 477# CHECK: sub sp, #12 478# CHECK: sub sp, #508 479 4800x83 0xb0 4810xff 0xb0 482 483#------------------------------------------------------------------------------ 484# SVC 485#------------------------------------------------------------------------------ 486# CHECK: svc #0 487# CHECK: svc #255 488 4890x00 0xdf 4900xff 0xdf 491 492 493#------------------------------------------------------------------------------ 494# SXTB/SXTH 495#------------------------------------------------------------------------------ 496# CHECK: sxtb r3, r5 497# CHECK: sxth r3, r5 498 4990x6b 0xb2 5000x2b 0xb2 501 502 503#------------------------------------------------------------------------------ 504# TST 505#------------------------------------------------------------------------------ 506# CHECK: tst r6, r1 507 5080x0e 0x42 509 510 511#------------------------------------------------------------------------------ 512# UXTB/UXTH 513#------------------------------------------------------------------------------ 514# CHECK: uxtb r7, r2 515# CHECK: uxth r1, r4 516 5170xd7 0xb2 5180xa1 0xb2 519 520 521#------------------------------------------------------------------------------ 522# WFE/WFI/YIELD 523#------------------------------------------------------------------------------ 524# CHECK: wfe 525# CHECK: wfi 526# CHECK: yield 527 5280x20 0xbf 5290x30 0xbf 5300x10 0xbf 531