thumb-diagnostics.s revision b5523ce1bb50e86942ad5273e3a89872c4d26b73
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@ RUN: not llvm-mc -triple=thumbv8 < %s 2> %t 6@ RUN: FileCheck --check-prefix=CHECK-ERRORS-V8 < %t %s 7 8@ Check for various assembly diagnostic messages on invalid input. 9 10@ ADD instruction w/o 'S' suffix. 11 add r1, r2, r3 12@ CHECK-ERRORS: error: invalid instruction 13@ CHECK-ERRORS: add r1, r2, r3 14@ CHECK-ERRORS: ^ 15 16@ Instructions which require v6+ for both registers to be low regs. 17 add r2, r3 18 mov r2, r3 19@ CHECK-ERRORS: error: instruction variant requires Thumb2 20@ CHECK-ERRORS: add r2, r3 21@ CHECK-ERRORS: ^ 22@ CHECK-ERRORS-V5: error: instruction variant requires ARMv6 or later 23@ CHECK-ERRORS-V5: mov r2, r3 24@ CHECK-ERRORS-V5: ^ 25 26 27@ Out of range immediates for ASR instruction. 28 asrs r2, r3, #33 29@ CHECK-ERRORS: error: invalid operand for instruction 30@ CHECK-ERRORS: asrs r2, r3, #33 31@ CHECK-ERRORS: ^ 32 33@ Out of range immediates for BKPT instruction. 34 bkpt #256 35 bkpt #-1 36error: invalid operand for instruction 37 bkpt #256 38 ^ 39error: invalid operand for instruction 40 bkpt #-1 41 ^ 42 43@ Out of range immediates for v8 HLT instruction. 44 hlt #64 45 hlt #-1 46@CHECK-ERRORS: error: instruction requires: armv8 arm-mode 47@CHECK-ERRORS: hlt #64 48@CHECK-ERRORS: ^ 49@CHECK-ERRORS-V8: error: instruction requires: arm-mode 50@CHECK-ERRORS-V8: hlt #64 51@CHECK-ERRORS-V8: ^ 52@CHECK-ERRORS: error: invalid operand for instruction 53@CHECK-ERRORS: hlt #-1 54@CHECK-ERRORS: ^ 55 56@ Invalid writeback and register lists for LDM 57 ldm r2!, {r5, r8} 58 ldm r2, {r5, r7} 59 ldm r2!, {r2, r3, r4} 60@ CHECK-ERRORS: error: registers must be in range r0-r7 61@ CHECK-ERRORS: ldm r2!, {r5, r8} 62@ CHECK-ERRORS: ^ 63@ CHECK-ERRORS: error: writeback operator '!' expected 64@ CHECK-ERRORS: ldm r2, {r5, r7} 65@ CHECK-ERRORS: ^ 66@ CHECK-ERRORS: error: writeback operator '!' not allowed when base register in register list 67@ CHECK-ERRORS: ldm r2!, {r2, r3, r4} 68@ CHECK-ERRORS: ^ 69 70@ Invalid writeback and register lists for PUSH/POP 71 pop {r1, r2, r10} 72 push {r8, r9} 73@ CHECK-ERRORS: error: registers must be in range r0-r7 or pc 74@ CHECK-ERRORS: pop {r1, r2, r10} 75@ CHECK-ERRORS: ^ 76@ CHECK-ERRORS: error: registers must be in range r0-r7 or lr 77@ CHECK-ERRORS: push {r8, r9} 78@ CHECK-ERRORS: ^ 79 80 81@ Invalid writeback and register lists for STM 82 stm r1, {r2, r6} 83 stm r1!, {r2, r9} 84@ CHECK-ERRORS: error: instruction requires: thumb2 85@ CHECK-ERRORS: stm r1, {r2, r6} 86@ CHECK-ERRORS: ^ 87@ CHECK-ERRORS: error: registers must be in range r0-r7 88@ CHECK-ERRORS: stm r1!, {r2, r9} 89@ CHECK-ERRORS: ^ 90 91@ Out of range immediates for LSL instruction. 92 lsls r4, r5, #-1 93 lsls r4, r5, #32 94@ CHECK-ERRORS: error: invalid operand for instruction 95@ CHECK-ERRORS: lsls r4, r5, #-1 96@ CHECK-ERRORS: ^ 97@ CHECK-ERRORS: error: invalid operand for instruction 98@ CHECK-ERRORS: lsls r4, r5, #32 99@ CHECK-ERRORS: ^ 100 101@ Mismatched source/destination operands for MUL instruction. 102 muls r1, r2, r3 103@ CHECK-ERRORS: error: destination register must match source register 104@ CHECK-ERRORS: muls r1, r2, r3 105@ CHECK-ERRORS: ^ 106 107 108@ Out of range immediates for STR instruction. 109 str r2, [r7, #-1] 110 str r5, [r1, #3] 111 str r3, [r7, #128] 112@ CHECK-ERRORS: error: instruction requires: thumb2 113@ CHECK-ERRORS: str r2, [r7, #-1] 114@ CHECK-ERRORS: ^ 115@ CHECK-ERRORS: error: instruction requires: thumb2 116@ CHECK-ERRORS: str r5, [r1, #3] 117@ CHECK-ERRORS: ^ 118@ CHECK-ERRORS: error: instruction requires: thumb2 119@ CHECK-ERRORS: str r3, [r7, #128] 120@ CHECK-ERRORS: ^ 121 122@ Out of range immediate for SVC instruction. 123 svc #-1 124 svc #256 125@ CHECK-ERRORS: error: invalid operand for instruction 126@ CHECK-ERRORS: svc #-1 127@ CHECK-ERRORS: ^ 128@ CHECK-ERRORS: error: instruction requires: arm-mode 129@ CHECK-ERRORS: svc #256 130@ CHECK-ERRORS: ^ 131 132 133@ Out of range immediate for ADD SP instructions 134 add sp, #-1 135 add sp, #3 136 add sp, sp, #512 137 add r2, sp, #1024 138@ CHECK-ERRORS: error: instruction requires: thumb2 139@ CHECK-ERRORS: add sp, #-1 140@ CHECK-ERRORS: ^ 141@ CHECK-ERRORS: error: instruction requires: thumb2 142@ CHECK-ERRORS: add sp, #3 143@ CHECK-ERRORS: ^ 144@ CHECK-ERRORS: error: instruction requires: thumb2 145@ CHECK-ERRORS: add sp, sp, #512 146@ CHECK-ERRORS: ^ 147@ CHECK-ERRORS: error: instruction requires: arm-mode 148@ CHECK-ERRORS: add r2, sp, #1024 149@ CHECK-ERRORS: ^ 150 151 add r2, sp, ip 152@ CHECK-ERRORS: error: source register must be the same as destination 153@ CHECK-ERRORS: add r2, sp, ip 154@ CHECK-ERRORS: ^ 155 156 157@------------------------------------------------------------------------------ 158@ B/Bcc - out of range immediates for Thumb1 branches 159@------------------------------------------------------------------------------ 160 161 beq #-258 162 bne #256 163 bgt #13 164 b #-1048578 165 b #1048576 166 b #10323 167 168@ CHECK-ERRORS: error: Branch target out of range 169@ CHECK-ERRORS: error: Branch target out of range 170@ CHECK-ERRORS: error: Branch target out of range 171@ CHECK-ERRORS: error: Branch target out of range 172@ CHECK-ERRORS: error: Branch target out of range 173@ CHECK-ERRORS: error: Branch target out of range 174 175@------------------------------------------------------------------------------ 176@ WFE/WFI/YIELD - are not supported pre v6T2 177@------------------------------------------------------------------------------ 178 wfe 179 wfi 180 yield 181 182@ CHECK-ERRORS: error: instruction requires: thumb2 183@ CHECK-ERRORS: wfe 184@ CHECK-ERRORS: ^ 185@ CHECK-ERRORS: error: instruction requires: thumb2 186@ CHECK-ERRORS: wfi 187@ CHECK-ERRORS: ^ 188@ CHECK-ERRORS: error: instruction requires: thumb2 189@ CHECK-ERRORS: yield 190@ CHECK-ERRORS: ^ 191 192@------------------------------------------------------------------------------ 193@ PLDW required mp-extensions 194@------------------------------------------------------------------------------ 195 pldw [r0, #4] 196@ CHECK-ERRORS: error: instruction requires: mp-extensions 197 198@------------------------------------------------------------------------------ 199@ LDR(lit) - invalid offsets 200@------------------------------------------------------------------------------ 201 202 ldr r4, [pc, #-12] 203@ CHECK-ERRORS: error: instruction requires: thumb2 204 205