Jim Grosbach | 1990672 | 2011-07-13 18:49:30 +0000 | [diff] [blame] | 1 | @ RUN: not llvm-mc -triple=armv7-apple-darwin < %s 2> %t |
| 2 | @ RUN: FileCheck --check-prefix=CHECK-ERRORS < %t %s |
| 3 | |
| 4 | @ Check for various assembly diagnostic messages on invalid input. |
| 5 | |
Jim Grosbach | 33c16a2 | 2011-07-14 22:04:21 +0000 | [diff] [blame] | 6 | @ 's' bit on an instruction that can't accept it. |
| 7 | mlss r1, r2, r3, r4 |
| 8 | @ CHECK-ERRORS: error: instruction 'mls' can not set flags, |
| 9 | @ CHECK-ERRORS: but 's' suffix specified |
| 10 | |
| 11 | |
Jim Grosbach | 1990672 | 2011-07-13 18:49:30 +0000 | [diff] [blame] | 12 | @ Out of range shift immediate values. |
| 13 | adc r1, r2, r3, lsl #invalid |
| 14 | adc r4, r5, r6, lsl #-1 |
| 15 | adc r4, r5, r6, lsl #32 |
| 16 | adc r4, r5, r6, lsr #-1 |
| 17 | adc r4, r5, r6, lsr #33 |
| 18 | adc r4, r5, r6, asr #-1 |
| 19 | adc r4, r5, r6, asr #33 |
| 20 | adc r4, r5, r6, ror #-1 |
| 21 | adc r4, r5, r6, ror #32 |
| 22 | |
| 23 | @ CHECK-ERRORS: error: invalid immediate shift value |
| 24 | @ CHECK-ERRORS: adc r1, r2, r3, lsl #invalid |
| 25 | @ CHECK-ERRORS: ^ |
| 26 | @ CHECK-ERRORS: error: immediate shift value out of range |
| 27 | @ CHECK-ERRORS: adc r4, r5, r6, lsl #-1 |
| 28 | @ CHECK-ERRORS: ^ |
| 29 | @ CHECK-ERRORS: error: immediate shift value out of range |
| 30 | @ CHECK-ERRORS: adc r4, r5, r6, lsl #32 |
| 31 | @ CHECK-ERRORS: ^ |
| 32 | @ CHECK-ERRORS: error: immediate shift value out of range |
| 33 | @ CHECK-ERRORS: adc r4, r5, r6, lsr #-1 |
| 34 | @ CHECK-ERRORS: ^ |
| 35 | @ CHECK-ERRORS: error: immediate shift value out of range |
| 36 | @ CHECK-ERRORS: adc r4, r5, r6, lsr #33 |
| 37 | @ CHECK-ERRORS: ^ |
| 38 | @ CHECK-ERRORS: error: immediate shift value out of range |
| 39 | @ CHECK-ERRORS: adc r4, r5, r6, asr #-1 |
| 40 | @ CHECK-ERRORS: ^ |
| 41 | @ CHECK-ERRORS: error: immediate shift value out of range |
| 42 | @ CHECK-ERRORS: adc r4, r5, r6, asr #33 |
| 43 | @ CHECK-ERRORS: ^ |
| 44 | @ CHECK-ERRORS: error: immediate shift value out of range |
| 45 | @ CHECK-ERRORS: adc r4, r5, r6, ror #-1 |
| 46 | @ CHECK-ERRORS: ^ |
| 47 | @ CHECK-ERRORS: error: immediate shift value out of range |
| 48 | @ CHECK-ERRORS: adc r4, r5, r6, ror #32 |
Jim Grosbach | fff76ee | 2011-07-13 20:10:10 +0000 | [diff] [blame] | 49 | |
| 50 | |
| 51 | @ Out of range 16-bit immediate on BKPT |
| 52 | bkpt #65536 |
| 53 | |
| 54 | @ CHECK-ERRORS: error: invalid operand for instruction |
Jim Grosbach | 83ab070 | 2011-07-13 22:01:08 +0000 | [diff] [blame] | 55 | |
| 56 | @ Out of range 4 and 3 bit immediates on CDP[2] |
| 57 | |
| 58 | @ Out of range immediates for CDP/CDP2 |
| 59 | cdp p7, #2, c1, c1, c1, #8 |
| 60 | cdp p7, #1, c1, c1, c1, #8 |
| 61 | cdp2 p7, #2, c1, c1, c1, #8 |
| 62 | cdp2 p7, #1, c1, c1, c1, #8 |
| 63 | |
| 64 | @ CHECK-ERRORS: error: invalid operand for instruction |
| 65 | @ CHECK-ERRORS: error: invalid operand for instruction |
| 66 | @ CHECK-ERRORS: error: invalid operand for instruction |
| 67 | @ CHECK-ERRORS: error: invalid operand for instruction |
Jim Grosbach | 6f9f884 | 2011-07-13 22:59:38 +0000 | [diff] [blame] | 68 | |
| 69 | @ Out of range immediates for DBG |
| 70 | dbg #-1 |
| 71 | dbg #16 |
| 72 | |
| 73 | @ CHECK-ERRORS: error: invalid operand for instruction |
| 74 | @ CHECK-ERRORS: error: invalid operand for instruction |
| 75 | @ Double-check that we're synced up with the right diagnostics. |
| 76 | @ CHECK-ERRORS: dbg #16 |
Jim Grosbach | e540c74 | 2011-07-14 21:19:17 +0000 | [diff] [blame] | 77 | |
Jim Grosbach | c8ae39e | 2011-07-14 21:26:42 +0000 | [diff] [blame] | 78 | @ Out of range immediate for MCR/MCR2/MCRR/MCRR2 |
Jim Grosbach | e540c74 | 2011-07-14 21:19:17 +0000 | [diff] [blame] | 79 | mcr p7, #8, r5, c1, c1, #4 |
| 80 | mcr p7, #2, r5, c1, c1, #8 |
| 81 | mcr2 p7, #8, r5, c1, c1, #4 |
| 82 | mcr2 p7, #1, r5, c1, c1, #8 |
Jim Grosbach | c8ae39e | 2011-07-14 21:26:42 +0000 | [diff] [blame] | 83 | mcrr p7, #16, r5, r4, c1 |
| 84 | mcrr2 p7, #16, r5, r4, c1 |
| 85 | @ CHECK-ERRORS: error: invalid operand for instruction |
| 86 | @ CHECK-ERRORS: error: invalid operand for instruction |
Jim Grosbach | e540c74 | 2011-07-14 21:19:17 +0000 | [diff] [blame] | 87 | @ CHECK-ERRORS: error: invalid operand for instruction |
| 88 | @ CHECK-ERRORS: error: invalid operand for instruction |
| 89 | @ CHECK-ERRORS: error: invalid operand for instruction |
| 90 | @ CHECK-ERRORS: error: invalid operand for instruction |
Jim Grosbach | ffa3225 | 2011-07-19 19:13:28 +0000 | [diff] [blame] | 91 | |
| 92 | |
| 93 | @ Out of range immediate for MOV |
| 94 | movw r9, 0x10000 |
| 95 | @ CHECK-ERRORS: error: invalid operand for instruction |
Jim Grosbach | 5f16057 | 2011-07-19 20:10:31 +0000 | [diff] [blame] | 96 | |
| 97 | @ Invalid 's' bit usage for MOVW |
| 98 | movs r6, #0xffff |
| 99 | movwseq r9, #0xffff |
| 100 | @ CHECK-ERRORS: error: invalid operand for instruction |
| 101 | @ CHECK-ERRORS: error: instruction 'movw' can not set flags, but 's' suffix specified |
Jim Grosbach | 1a2be4d | 2011-07-19 20:23:25 +0000 | [diff] [blame] | 102 | |
| 103 | @ Out of range immediate for MOVT |
| 104 | movt r9, 0x10000 |
| 105 | @ CHECK-ERRORS: error: invalid operand for instruction |
Jim Grosbach | ccfd931 | 2011-07-19 20:35:35 +0000 | [diff] [blame] | 106 | |
| 107 | @ Out of range immediates for MRC/MRC2/MRRC/MRRC2 |
| 108 | mrc p14, #8, r1, c1, c2, #4 |
| 109 | mrc p14, #1, r1, c1, c2, #8 |
| 110 | mrc2 p14, #8, r1, c1, c2, #4 |
| 111 | mrc2 p14, #0, r1, c1, c2, #9 |
| 112 | mrrc p7, #16, r5, r4, c1 |
| 113 | mrrc2 p7, #17, r5, r4, c1 |
| 114 | @ CHECK-ERRORS: error: invalid operand for instruction |
| 115 | @ CHECK-ERRORS: error: invalid operand for instruction |
| 116 | @ CHECK-ERRORS: error: invalid operand for instruction |
| 117 | @ CHECK-ERRORS: error: invalid operand for instruction |
| 118 | @ CHECK-ERRORS: error: invalid operand for instruction |
| 119 | @ CHECK-ERRORS: error: invalid operand for instruction |
Jim Grosbach | 61b1b21 | 2011-07-21 19:02:03 +0000 | [diff] [blame] | 120 | |
| 121 | @ Shifter operand validation for PKH instructions. |
| 122 | pkhbt r2, r2, r3, lsl #-1 |
| 123 | pkhbt r2, r2, r3, lsl #32 |
| 124 | pkhtb r2, r2, r3, asr #0 |
| 125 | pkhtb r2, r2, r3, asr #33 |
| 126 | pkhbt r2, r2, r3, asr #3 |
| 127 | pkhtb r2, r2, r3, lsl #3 |
| 128 | |
Jim Grosbach | a46c658 | 2011-07-26 15:41:22 +0000 | [diff] [blame] | 129 | @ CHECK-ERRORS: error: immediate value out of range |
| 130 | @ CHECK-ERRORS: pkhbt r2, r2, r3, lsl #-1 |
| 131 | @ CHECK-ERRORS: ^ |
| 132 | @ CHECK-ERRORS: error: immediate value out of range |
| 133 | @ CHECK-ERRORS: pkhbt r2, r2, r3, lsl #32 |
| 134 | @ CHECK-ERRORS: ^ |
| 135 | @ CHECK-ERRORS: error: immediate value out of range |
| 136 | @ CHECK-ERRORS: pkhtb r2, r2, r3, asr #0 |
| 137 | @ CHECK-ERRORS: ^ |
| 138 | @ CHECK-ERRORS: error: immediate value out of range |
| 139 | @ CHECK-ERRORS: pkhtb r2, r2, r3, asr #33 |
| 140 | @ CHECK-ERRORS: ^ |
| 141 | @ CHECK-ERRORS: error: lsl operand expected. |
| 142 | @ CHECK-ERRORS: pkhbt r2, r2, r3, asr #3 |
| 143 | @ CHECK-ERRORS: ^ |
| 144 | @ CHECK-ERRORS: error: asr operand expected. |
| 145 | @ CHECK-ERRORS: pkhtb r2, r2, r3, lsl #3 |
| 146 | @ CHECK-ERRORS: ^ |
Jim Grosbach | c27d4f9 | 2011-07-22 17:44:50 +0000 | [diff] [blame] | 147 | |
| 148 | |
| 149 | @ bad values for SETEND |
| 150 | setendne be |
| 151 | setend me |
| 152 | setend 1 |
| 153 | |
Jim Grosbach | a46c658 | 2011-07-26 15:41:22 +0000 | [diff] [blame] | 154 | @ CHECK-ERRORS: error: instruction 'setend' is not predicable, but condition code specified |
| 155 | @ CHECK-ERRORS: setendne be |
| 156 | @ CHECK-ERRORS: ^ |
| 157 | @ CHECK-ERRORS: error: 'be' or 'le' operand expected |
| 158 | @ CHECK-ERRORS: setend me |
| 159 | @ CHECK-ERRORS: ^ |
| 160 | @ CHECK-ERRORS: error: 'be' or 'le' operand expected |
| 161 | @ CHECK-ERRORS: setend 1 |
| 162 | @ CHECK-ERRORS: ^ |
Jim Grosbach | 580f4a9 | 2011-07-25 22:20:28 +0000 | [diff] [blame] | 163 | |
| 164 | |
| 165 | @ Out of range immediates and bad shift types for SSAT |
| 166 | ssat r8, #0, r10, lsl #8 |
| 167 | ssat r8, #33, r10, lsl #8 |
| 168 | ssat r8, #1, r10, lsl #-1 |
| 169 | ssat r8, #1, r10, lsl #32 |
| 170 | ssat r8, #1, r10, asr #0 |
| 171 | ssat r8, #1, r10, asr #33 |
| 172 | ssat r8, #1, r10, lsr #5 |
| 173 | ssat r8, #1, r10, lsl fred |
| 174 | ssat r8, #1, r10, lsl #fred |
| 175 | |
Jim Grosbach | a46c658 | 2011-07-26 15:41:22 +0000 | [diff] [blame] | 176 | @ CHECK-ERRORS: error: invalid operand for instruction |
| 177 | @ CHECK-ERRORS: ssat r8, #0, r10, lsl #8 |
| 178 | @ CHECK-ERRORS: ^ |
| 179 | @ CHECK-ERRORS: error: invalid operand for instruction |
| 180 | @ CHECK-ERRORS: ssat r8, #33, r10, lsl #8 |
| 181 | @ CHECK-ERRORS: ^ |
| 182 | @ CHECK-ERRORS: error: 'lsr' shift amount must be in range [0,31] |
| 183 | @ CHECK-ERRORS: ssat r8, #1, r10, lsl #-1 |
| 184 | @ CHECK-ERRORS: ^ |
| 185 | @ CHECK-ERRORS: error: 'lsr' shift amount must be in range [0,31] |
| 186 | @ CHECK-ERRORS: ssat r8, #1, r10, lsl #32 |
| 187 | @ CHECK-ERRORS: ^ |
| 188 | @ CHECK-ERRORS: error: 'asr' shift amount must be in range [1,32] |
| 189 | @ CHECK-ERRORS: ssat r8, #1, r10, asr #0 |
| 190 | @ CHECK-ERRORS: ^ |
| 191 | @ CHECK-ERRORS: error: 'asr' shift amount must be in range [1,32] |
| 192 | @ CHECK-ERRORS: ssat r8, #1, r10, asr #33 |
| 193 | @ CHECK-ERRORS: ^ |
| 194 | @ CHECK-ERRORS: error: shift operator 'asr' or 'lsl' expected |
| 195 | @ CHECK-ERRORS: ssat r8, #1, r10, lsr #5 |
| 196 | @ CHECK-ERRORS: ^ |
| 197 | @ CHECK-ERRORS: error: '#' expected |
| 198 | @ CHECK-ERRORS: ssat r8, #1, r10, lsl fred |
| 199 | @ CHECK-ERRORS: ^ |
| 200 | @ CHECK-ERRORS: error: shift amount must be an immediate |
| 201 | @ CHECK-ERRORS: ssat r8, #1, r10, lsl #fred |
| 202 | @ CHECK-ERRORS: ^ |
Jim Grosbach | f494335 | 2011-07-25 23:09:14 +0000 | [diff] [blame] | 203 | |
| 204 | @ Out of range immediates for SSAT16 |
| 205 | ssat16 r2, #0, r7 |
| 206 | ssat16 r3, #17, r5 |
| 207 | |
Jim Grosbach | a46c658 | 2011-07-26 15:41:22 +0000 | [diff] [blame] | 208 | @ CHECK-ERRORS: error: invalid operand for instruction |
| 209 | @ CHECK-ERRORS: ssat16 r2, #0, r7 |
| 210 | @ CHECK-ERRORS: ^ |
| 211 | @ CHECK-ERRORS: error: invalid operand for instruction |
| 212 | @ CHECK-ERRORS: ssat16 r3, #17, r5 |
| 213 | @ CHECK-ERRORS: ^ |
| 214 | |
| 215 | |
| 216 | @ Out of order STM registers |
| 217 | stmda sp!, {r5, r2} |
| 218 | |
Jim Grosbach | d0588e2 | 2011-09-14 18:08:35 +0000 | [diff] [blame^] | 219 | @ CHECK-ERRORS: error: register list not in ascending order |
Jim Grosbach | a46c658 | 2011-07-26 15:41:22 +0000 | [diff] [blame] | 220 | @ CHECK-ERRORS: stmda sp!, {r5, r2} |
| 221 | @ CHECK-ERRORS: ^ |
Jim Grosbach | ed83848 | 2011-07-26 16:24:27 +0000 | [diff] [blame] | 222 | |
| 223 | |
| 224 | @ Out of range immediate on SVC |
| 225 | svc #0x1000000 |
| 226 | @ CHECK-ERRORS: error: invalid operand for instruction |
| 227 | @ CHECK-ERRORS: svc #0x1000000 |
| 228 | @ CHECK-ERRORS: ^ |
Jim Grosbach | 189610f | 2011-07-26 18:25:39 +0000 | [diff] [blame] | 229 | |
| 230 | |
| 231 | @ Out of order Rt/Rt2 operands for ldrexd/strexd |
| 232 | ldrexd r4, r3, [r8] |
| 233 | strexd r6, r5, r3, [r8] |
| 234 | |
| 235 | @ CHECK-ERRORS: error: destination operands must be sequential |
| 236 | @ CHECK-ERRORS: ldrexd r4, r3, [r8] |
| 237 | @ CHECK-ERRORS: ^ |
| 238 | @ CHECK-ERRORS: error: source operands must be sequential |
| 239 | @ CHECK-ERRORS: strexd r6, r5, r3, [r8] |
| 240 | @ CHECK-ERRORS: ^ |
Jim Grosbach | 7e1547e | 2011-07-27 20:15:40 +0000 | [diff] [blame] | 241 | |
| 242 | @ Illegal rotate operators for extend instructions |
| 243 | sxtb r8, r3, #8 |
| 244 | sxtb r8, r3, ror 24 |
| 245 | sxtb r8, r3, ror #8 - |
| 246 | sxtab r3, r8, r3, ror #(fred - wilma) |
| 247 | sxtab r7, r8, r3, ror #25 |
| 248 | sxtah r9, r3, r3, ror #-8 |
| 249 | sxtb16ge r2, r3, lsr #24 |
| 250 | |
| 251 | @ CHECK-ERRORS: error: rotate operator 'ror' expected |
| 252 | @ CHECK-ERRORS: sxtb r8, r3, #8 |
| 253 | @ CHECK-ERRORS: ^ |
| 254 | @ CHECK-ERRORS: error: '#' expected |
| 255 | @ CHECK-ERRORS: sxtb r8, r3, ror 24 |
| 256 | @ CHECK-ERRORS: ^ |
| 257 | @ CHECK-ERRORS: error: unknown token in expression |
| 258 | @ CHECK-ERRORS: sxtb r8, r3, ror #8 - |
| 259 | @ CHECK-ERRORS: ^ |
| 260 | @ CHECK-ERRORS: error: malformed rotate expression |
| 261 | @ CHECK-ERRORS: sxtb r8, r3, ror #8 - |
| 262 | @ CHECK-ERRORS: ^ |
| 263 | @ CHECK-ERRORS: error: rotate amount must be an immediate |
| 264 | @ CHECK-ERRORS: sxtab r3, r8, r3, ror #(fred - wilma) |
| 265 | @ CHECK-ERRORS: ^ |
| 266 | @ CHECK-ERRORS: error: 'ror' rotate amount must be 8, 16, or 24 |
| 267 | @ CHECK-ERRORS: sxtab r7, r8, r3, ror #25 |
| 268 | @ CHECK-ERRORS: ^ |
| 269 | @ CHECK-ERRORS: error: 'ror' rotate amount must be 8, 16, or 24 |
| 270 | @ CHECK-ERRORS: sxtah r9, r3, r3, ror #-8 |
| 271 | @ CHECK-ERRORS: ^ |
| 272 | @ CHECK-ERRORS: error: rotate operator 'ror' expected |
| 273 | @ CHECK-ERRORS: sxtb16ge r2, r3, lsr #24 |
| 274 | @ CHECK-ERRORS: ^ |
Jim Grosbach | fb8989e | 2011-07-27 21:09:25 +0000 | [diff] [blame] | 275 | |
| 276 | @ Out of range width for SBFX/UBFX |
| 277 | sbfx r4, r5, #31, #2 |
| 278 | ubfxgt r4, r5, #16, #17 |
| 279 | |
| 280 | @ CHECK-ERRORS: error: bitfield width must be in range [1,32-lsb] |
| 281 | @ CHECK-ERRORS: sbfx r4, r5, #31, #2 |
| 282 | @ CHECK-ERRORS: ^ |
| 283 | @ CHECK-ERRORS: error: bitfield width must be in range [1,32-lsb] |
| 284 | @ CHECK-ERRORS: ubfxgt r4, r5, #16, #17 |
| 285 | @ CHECK-ERRORS: ^ |
Jim Grosbach | 2fd2b87 | 2011-08-10 20:29:19 +0000 | [diff] [blame] | 286 | |
| 287 | @ Out of order Rt/Rt2 operands for ldrd |
| 288 | ldrd r4, r3, [r8] |
| 289 | ldrd r4, r3, [r8, #8]! |
| 290 | ldrd r4, r3, [r8], #8 |
| 291 | @ CHECK-ERRORS: error: destination operands must be sequential |
| 292 | @ CHECK-ERRORS: ldrd r4, r3, [r8] |
| 293 | @ CHECK-ERRORS: ^ |
| 294 | @ CHECK-ERRORS: error: destination operands must be sequential |
| 295 | @ CHECK-ERRORS: ldrd r4, r3, [r8, #8]! |
| 296 | @ CHECK-ERRORS: ^ |
| 297 | @ CHECK-ERRORS: error: destination operands must be sequential |
| 298 | @ CHECK-ERRORS: ldrd r4, r3, [r8], #8 |
| 299 | @ CHECK-ERRORS: ^ |
Jim Grosbach | d0588e2 | 2011-09-14 18:08:35 +0000 | [diff] [blame^] | 300 | |
| 301 | |
| 302 | @ Bad register lists for VFP. |
| 303 | vpush {s0, s3} |
| 304 | @ CHECK-ERRORS: error: non-contiguous register range |
| 305 | @ CHECK-ERRORS: vpush {s0, s3} |
| 306 | @ CHECK-ERRORS: ^ |
| 307 | |