Home | History | Annotate | Download | only in ARM
      1 @ RUN: not llvm-mc -triple=thumbv6-apple-darwin < %s 2> %t
      2 @ RUN: FileCheck --check-prefix=CHECK-ERRORS < %t %s
      3 @ RUN: not llvm-mc -triple=thumbv5-apple-darwin < %s 2> %t
      4 @ RUN: FileCheck --check-prefix=CHECK-ERRORS-V5 < %t %s
      5 
      6 @ Check for various assembly diagnostic messages on invalid input.
      7 
      8 @ ADD instruction w/o 'S' suffix.
      9         add r1, r2, r3
     10 @ CHECK-ERRORS: error: invalid instruction
     11 @ CHECK-ERRORS:         add r1, r2, r3
     12 @ CHECK-ERRORS:         ^
     13 
     14 @ Instructions which require v6+ for both registers to be low regs.
     15         add r2, r3
     16         mov r2, r3
     17 @ CHECK-ERRORS: error: instruction variant requires Thumb2
     18 @ CHECK-ERRORS:         add r2, r3
     19 @ CHECK-ERRORS:         ^
     20 @ CHECK-ERRORS-V5: error: instruction variant requires ARMv6 or later
     21 @ CHECK-ERRORS-V5:         mov r2, r3
     22 @ CHECK-ERRORS-V5:         ^
     23 
     24 
     25 @ Out of range immediates for ASR instruction.
     26         asrs r2, r3, #33
     27 @ CHECK-ERRORS: error: invalid operand for instruction
     28 @ CHECK-ERRORS:         asrs r2, r3, #33
     29 @ CHECK-ERRORS:                      ^
     30 
     31 @ Out of range immediates for BKPT instruction.
     32         bkpt #256
     33         bkpt #-1
     34 error: invalid operand for instruction
     35         bkpt #256
     36              ^
     37 error: invalid operand for instruction
     38         bkpt #-1
     39              ^
     40 
     41 @ Invalid writeback and register lists for LDM
     42         ldm r2!, {r5, r8}
     43         ldm r2, {r5, r7}
     44         ldm r2!, {r2, r3, r4}
     45 @ CHECK-ERRORS: error: registers must be in range r0-r7
     46 @ CHECK-ERRORS:         ldm r2!, {r5, r8}
     47 @ CHECK-ERRORS:                  ^
     48 @ CHECK-ERRORS: error: writeback operator '!' expected
     49 @ CHECK-ERRORS:         ldm r2, {r5, r7}
     50 @ CHECK-ERRORS:             ^
     51 @ CHECK-ERRORS: error: writeback operator '!' not allowed when base register in register list
     52 @ CHECK-ERRORS:         ldm r2!, {r2, r3, r4}
     53 @ CHECK-ERRORS:               ^
     54 
     55 
     56 @ Invalid writeback and register lists for PUSH/POP
     57         pop {r1, r2, r10}
     58         push {r8, r9}
     59 @ CHECK-ERRORS: error: registers must be in range r0-r7 or pc
     60 @ CHECK-ERRORS:         pop {r1, r2, r10}
     61 @ CHECK-ERRORS:             ^
     62 @ CHECK-ERRORS: error: registers must be in range r0-r7 or lr
     63 @ CHECK-ERRORS:         push {r8, r9}
     64 @ CHECK-ERRORS:              ^
     65 
     66 
     67 @ Invalid writeback and register lists for STM
     68         stm r1, {r2, r6}
     69         stm r1!, {r2, r9}
     70 @ CHECK-ERRORS: error: instruction requires: thumb2
     71 @ CHECK-ERRORS:         stm r1, {r2, r6}
     72 @ CHECK-ERRORS:         ^
     73 @ CHECK-ERRORS: error: registers must be in range r0-r7
     74 @ CHECK-ERRORS:         stm r1!, {r2, r9}
     75 @ CHECK-ERRORS:                  ^
     76 
     77 @ Out of range immediates for LSL instruction.
     78         lsls r4, r5, #-1
     79         lsls r4, r5, #32
     80 @ CHECK-ERRORS: error: invalid operand for instruction
     81 @ CHECK-ERRORS:         lsls r4, r5, #-1
     82 @ CHECK-ERRORS:                      ^
     83 @ CHECK-ERRORS: error: invalid operand for instruction
     84 @ CHECK-ERRORS:         lsls r4, r5, #32
     85 @ CHECK-ERRORS:                      ^
     86 
     87 @ Mismatched source/destination operands for MUL instruction.
     88         muls r1, r2, r3
     89 @ CHECK-ERRORS: error: destination register must match source register
     90 @ CHECK-ERRORS:         muls r1, r2, r3
     91 @ CHECK-ERRORS:              ^
     92 
     93 
     94 @ Out of range immediates for STR instruction.
     95         str r2, [r7, #-1]
     96         str r5, [r1, #3]
     97         str r3, [r7, #128]
     98 @ CHECK-ERRORS: error: instruction requires: thumb2
     99 @ CHECK-ERRORS:         str r2, [r7, #-1]
    100 @ CHECK-ERRORS:         ^
    101 @ CHECK-ERRORS: error: instruction requires: thumb2
    102 @ CHECK-ERRORS:         str r5, [r1, #3]
    103 @ CHECK-ERRORS:         ^
    104 @ CHECK-ERRORS: error: instruction requires: thumb2
    105 @ CHECK-ERRORS:         str r3, [r7, #128]
    106 @ CHECK-ERRORS:         ^
    107 
    108 @ Out of range immediate for SVC instruction.
    109         svc #-1
    110         svc #256
    111 @ CHECK-ERRORS: error: invalid operand for instruction
    112 @ CHECK-ERRORS:         svc #-1
    113 @ CHECK-ERRORS:             ^
    114 @ CHECK-ERRORS: error: instruction requires: arm-mode
    115 @ CHECK-ERRORS:         svc #256
    116 @ CHECK-ERRORS:         ^
    117 
    118 
    119 @ Out of range immediate for ADD SP instructions
    120         add sp, #-1
    121         add sp, #3
    122         add sp, sp, #512
    123         add r2, sp, #1024
    124 @ CHECK-ERRORS: error: instruction requires: thumb2
    125 @ CHECK-ERRORS:         add sp, #-1
    126 @ CHECK-ERRORS:                 ^
    127 @ CHECK-ERRORS: error: instruction requires: thumb2
    128 @ CHECK-ERRORS:         add sp, #3
    129 @ CHECK-ERRORS:                 ^
    130 @ CHECK-ERRORS: error: instruction requires: thumb2
    131 @ CHECK-ERRORS:         add sp, sp, #512
    132 @ CHECK-ERRORS:                     ^
    133 @ CHECK-ERRORS: error: instruction requires: arm-mode
    134 @ CHECK-ERRORS:         add r2, sp, #1024
    135 @ CHECK-ERRORS:         ^
    136 
    137         add r2, sp, ip
    138 @ CHECK-ERRORS: error: source register must be the same as destination
    139 @ CHECK-ERRORS:         add r2, sp, ip
    140 @ CHECK-ERRORS:                     ^
    141 
    142 @------------------------------------------------------------------------------
    143 @ WFE/WFI/YIELD - are not supported pre v6T2
    144 @------------------------------------------------------------------------------
    145         wfe
    146         wfi
    147         yield
    148 
    149 @ CHECK-ERRORS: error: instruction requires: thumb2
    150 @ CHECK-ERRORS: wfe
    151 @ CHECK-ERRORS: ^
    152 @ CHECK-ERRORS: error: instruction requires: thumb2
    153 @ CHECK-ERRORS: wfi
    154 @ CHECK-ERRORS: ^
    155 @ CHECK-ERRORS: error: instruction requires: thumb2
    156 @ CHECK-ERRORS: yield
    157 @ CHECK-ERRORS: ^
    158 
    159