[ARM] Allow SP in rGPR, starting from ARMv8
[oota-llvm.git] / test / MC / ARM / thumb2-diagnostics.s
1 @ RUN: not llvm-mc -triple=thumbv7-apple-darwin < %s 2> %t
2 @ RUN: FileCheck --check-prefix=CHECK-ERRORS --check-prefix=CHECK-ERRORS-V7 < %t %s
3
4 @ RUN: not llvm-mc -triple=thumbv8-apple-darwin < %s 2> %t
5 @ RUN: FileCheck --check-prefix=CHECK-ERRORS --check-prefix=CHECK-ERRORS-V8 < %t %s
6
7 @ Ill-formed IT block instructions.
8         itet eq
9         addle r0, r1, r2
10         nop
11         it le
12         iteeee gt
13         ittfe le
14         nopeq
15
16 @ CHECK-ERRORS: error: incorrect condition in IT block; got 'le', but expected 'eq'
17 @ CHECK-ERRORS:         addle r0, r1, r2
18 @ CHECK-ERRORS:            ^
19 @ CHECK-ERRORS: error: incorrect condition in IT block; got 'al', but expected 'ne'
20 @ CHECK-ERRORS:         nop
21 @ CHECK-ERRORS:            ^
22 @ CHECK-ERRORS: error: instructions in IT block must be predicable
23 @ CHECK-ERRORS:         it le
24 @ CHECK-ERRORS:         ^
25 @ CHECK-ERRORS: error: too many conditions on IT instruction
26 @ CHECK-ERRORS:         iteeee gt
27 @ CHECK-ERRORS:           ^
28 @ CHECK-ERRORS: error: illegal IT block condition mask 'tfe'
29 @ CHECK-ERRORS:         ittfe le
30 @ CHECK-ERRORS:           ^
31 @ CHECK-ERRORS: error: predicated instructions must be in IT block
32 @ CHECK-ERRORS:         nopeq
33 @ CHECK-ERRORS:         ^
34
35         @ Out of range immediates for MRC/MRC2/MRRC/MRRC2
36         mrc  p14, #8, r1, c1, c2, #4
37         mrc  p14, #1, r1, c1, c2, #8
38         mrc2  p14, #8, r1, c1, c2, #4
39         mrc2  p14, #0, r1, c1, c2, #9
40         mrrc  p7, #16, r5, r4, c1
41         mrrc2  p7, #17, r5, r4, c1
42 @ CHECK-ERRORS: error: invalid operand for instruction
43 @ CHECK-ERRORS: error: invalid operand for instruction
44 @ CHECK-ERRORS: error: invalid operand for instruction
45 @ CHECK-ERRORS: error: invalid operand for instruction
46 @ CHECK-ERRORS: error: immediate operand must be in the range [0,15]
47 @ CHECK-ERRORS-V7: error: immediate operand must be in the range [0,15]
48 @ CHECK-ERRORS-V8: error: invalid operand for instruction
49
50         isb  #-1
51         isb  #16
52 @ CHECK-ERRORS: error: immediate value out of range
53 @ CHECK-ERRORS: error: immediate value out of range
54
55         itt eq
56         bkpteq #1
57 @ CHECK-ERRORS: error: instruction 'bkpt' is not predicable, but condition code specified
58
59         nopeq
60         nopeq
61
62 @ out of range operands for Thumb2 targets
63
64         beq.w  #-1048578
65         bne.w  #1048576
66         blt.w  #1013411
67         b.w    #-16777218
68         b.w    #16777216
69         b.w    #1592313
70
71 @ CHECK-ERRORS: error: branch target out of range
72 @ CHECK-ERRORS: error: branch target out of range
73 @ CHECK-ERRORS: error: branch target out of range
74 @ CHECK-ERRORS: error: branch target out of range
75 @ CHECK-ERRORS: error: branch target out of range
76 @ CHECK-ERRORS: error: branch target out of range
77
78 foo2:
79         mov r0, foo2
80         movw r0, foo2
81         movt r0, foo2
82 @ CHECK-ERRORS: error: immediate expression for mov requires :lower16: or :upper16
83 @ CHECK-ERRORS:                 ^
84 @ CHECK-ERRORS: error: immediate expression for mov requires :lower16: or :upper16
85 @ CHECK-ERRORS:                  ^
86 @ CHECK-ERRORS: error: immediate expression for mov requires :lower16: or :upper16
87 @ CHECK-ERRORS:                  ^
88
89         and sp, r1, #80008000
90         and pc, r1, #80008000
91 @ CHECK-ERRORS: error: invalid operand for instruction
92 @ CHECK-ERRORS: error: invalid operand for instruction
93
94         ssat r0, #1, r0, asr #32
95         usat r0, #1, r0, asr #32
96 @ CHECK-ERRORS: error: 'asr #32' shift amount not allowed in Thumb mode
97 @ CHECK-ERRORS: error: 'asr #32' shift amount not allowed in Thumb mode
98
99         @ PC is not valid as shifted-rGPR
100         sbc.w r2, r7, pc, lsr #16
101         and.w r2, r7, pc, lsr #16
102 @ CHECK-ERRORS: error: invalid operand for instruction
103 @ CHECK-ERRORS: error: invalid operand for instruction
104