xref: /llvm-project/llvm/test/MC/ARM/armv8.1m-pacbti.s (revision 39f83849640114340fb2144450383a7bd90d5f0b)
1// RUN: llvm-mc -triple thumbv8.1m.main-arm-none-eabi -mattr=+pacbti %s -show-encoding -o - | FileCheck %s --check-prefixes=CHECK,CHECK-PACBTI
2// RUN: not llvm-mc -triple thumbv8.1m.main-arm-none-eabi -mattr=-pacbti %s -show-encoding -o - 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK-NOPACBTI
3// RUN: not llvm-mc -triple thumbv7m-arm-none-eabi %s -show-encoding -o - 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK-NOPACBTI
4
5// Non Hint Space instructions and system regs
6
7// CHECK-PACBTI: autg	r0, r1, r2             @ encoding: [0x51,0xfb,0x02,0x0f]
8// CHECK-NOPACBTI: error: instruction requires: pacbti
9autg r0, r1, r2
10// CHECK-PACBTI: autg	r12, lr, sp            @ encoding: [0x5e,0xfb,0x0d,0xcf]
11// CHECK-NOPACBTI: error: instruction requires: pacbti
12autg ip, lr, sp
13// CHECK-PACBTI: bxaut	r0, r1, r2             @ encoding: [0x51,0xfb,0x12,0x0f]
14// CHECK-NOPACBTI: error: instruction requires: pacbti
15bxaut r0, r1, r2
16
17// CHECK-PACBTI: pacg r0, r1, r2               @ encoding: [0x61,0xfb,0x02,0xf0]
18// CHECK-NOPACBTI: error: instruction requires: pacbti
19pacg r0, r1, r2
20// CHECK-PACBTI: pacg r12, lr, sp              @ encoding: [0x6e,0xfb,0x0d,0xfc]
21// CHECK-NOPACBTI: error: instruction requires: pacbti
22pacg ip, lr, sp
23
24// CHECK-PACBTI: msr	pac_key_p_0, r0           @ encoding: [0x80,0xf3,0x20,0x88]
25// CHECK-NOPACBTI: error: invalid operand for instruction
26msr pac_key_p_0, r0
27// CHECK-PACBTI: msr	pac_key_p_1, r0           @ encoding: [0x80,0xf3,0x21,0x88]
28// CHECK-NOPACBTI: error: invalid operand for instruction
29msr pac_key_p_1, r0
30// CHECK-PACBTI: msr	pac_key_p_2, r0           @ encoding: [0x80,0xf3,0x22,0x88]
31// CHECK-NOPACBTI: error: invalid operand for instruction
32msr pac_key_p_2, r0
33// CHECK-PACBTI: msr	pac_key_p_3, r0           @ encoding: [0x80,0xf3,0x23,0x88]
34// CHECK-NOPACBTI: error: invalid operand for instruction
35msr pac_key_p_3, r0
36// CHECK-PACBTI: msr	pac_key_u_0, r0           @ encoding: [0x80,0xf3,0x24,0x88]
37// CHECK-NOPACBTI: error: invalid operand for instruction
38msr pac_key_u_0, r0
39// CHECK-PACBTI: msr	pac_key_u_1, r0           @ encoding: [0x80,0xf3,0x25,0x88]
40// CHECK-NOPACBTI: error: invalid operand for instruction
41msr pac_key_u_1, r0
42// CHECK-PACBTI: msr	pac_key_u_2, r0           @ encoding: [0x80,0xf3,0x26,0x88]
43// CHECK-NOPACBTI: error: invalid operand for instruction
44msr pac_key_u_2, r0
45// CHECK-PACBTI: msr	pac_key_u_3, r0           @ encoding: [0x80,0xf3,0x27,0x88]
46// CHECK-NOPACBTI: error: invalid operand for instruction
47msr pac_key_u_3, r0
48// CHECK-PACBTI: msr	pac_key_p_0_ns, r0        @ encoding: [0x80,0xf3,0xa0,0x88]
49// CHECK-NOPACBTI: error: invalid operand for instruction
50msr pac_key_p_0_ns, r0
51// CHECK-PACBTI: msr	pac_key_p_1_ns, r0        @ encoding: [0x80,0xf3,0xa1,0x88]
52// CHECK-NOPACBTI: error: invalid operand for instruction
53msr pac_key_p_1_ns, r0
54// CHECK-PACBTI: msr	pac_key_p_2_ns, r0        @ encoding: [0x80,0xf3,0xa2,0x88]
55// CHECK-NOPACBTI: error: invalid operand for instruction
56msr pac_key_p_2_ns, r0
57// CHECK-PACBTI: msr	pac_key_p_3_ns, r0        @ encoding: [0x80,0xf3,0xa3,0x88]
58// CHECK-NOPACBTI: error: invalid operand for instruction
59msr pac_key_p_3_ns, r0
60// CHECK-PACBTI: msr	pac_key_u_0_ns, r0        @ encoding: [0x80,0xf3,0xa4,0x88]
61// CHECK-NOPACBTI: error: invalid operand for instruction
62msr pac_key_u_0_ns, r0
63// CHECK-PACBTI: msr	pac_key_u_1_ns, r0        @ encoding: [0x80,0xf3,0xa5,0x88]
64// CHECK-NOPACBTI: error: invalid operand for instruction
65msr pac_key_u_1_ns, r0
66// CHECK-PACBTI: msr	pac_key_u_2_ns, r0        @ encoding: [0x80,0xf3,0xa6,0x88]
67// CHECK-NOPACBTI: error: invalid operand for instruction
68msr pac_key_u_2_ns, r0
69// CHECK-PACBTI: msr	pac_key_u_3_ns, r0        @ encoding: [0x80,0xf3,0xa7,0x88]
70// CHECK-NOPACBTI: error: invalid operand for instruction
71msr pac_key_u_3_ns, r0
72
73// CHECK-PACBTI: mrs	r0, pac_key_p_0           @ encoding: [0xef,0xf3,0x20,0x80]
74// CHECK-NOPACBTI: error: invalid operand for instruction
75mrs r0, pac_key_p_0
76// CHECK-PACBTI: mrs	r0, pac_key_p_1           @ encoding: [0xef,0xf3,0x21,0x80]
77// CHECK-NOPACBTI: error: invalid operand for instruction
78mrs r0, pac_key_p_1
79// CHECK-PACBTI: mrs	r0, pac_key_p_2           @ encoding: [0xef,0xf3,0x22,0x80]
80// CHECK-NOPACBTI: error: invalid operand for instruction
81mrs r0, pac_key_p_2
82// CHECK-PACBTI: mrs	r0, pac_key_p_3           @ encoding: [0xef,0xf3,0x23,0x80]
83// CHECK-NOPACBTI: error: invalid operand for instruction
84mrs r0, pac_key_p_3
85// CHECK-PACBTI: mrs	r0, pac_key_u_0           @ encoding: [0xef,0xf3,0x24,0x80]
86// CHECK-NOPACBTI: error: invalid operand for instruction
87mrs r0, pac_key_u_0
88// CHECK-PACBTI: mrs	r0, pac_key_u_1           @ encoding: [0xef,0xf3,0x25,0x80]
89// CHECK-NOPACBTI: error: invalid operand for instruction
90mrs r0, pac_key_u_1
91// CHECK-PACBTI: mrs	r0, pac_key_u_2           @ encoding: [0xef,0xf3,0x26,0x80]
92// CHECK-NOPACBTI: error: invalid operand for instruction
93mrs r0, pac_key_u_2
94// CHECK-PACBTI: mrs	r0, pac_key_u_3           @ encoding: [0xef,0xf3,0x27,0x80]
95// CHECK-NOPACBTI: error: invalid operand for instruction
96mrs r0, pac_key_u_3
97// CHECK-PACBTI: mrs	r0, pac_key_p_0_ns        @ encoding: [0xef,0xf3,0xa0,0x80]
98// CHECK-NOPACBTI: error: invalid operand for instruction
99mrs r0, pac_key_p_0_ns
100// CHECK-PACBTI: mrs	r0, pac_key_p_1_ns        @ encoding: [0xef,0xf3,0xa1,0x80]
101// CHECK-NOPACBTI: error: invalid operand for instruction
102mrs r0, pac_key_p_1_ns
103// CHECK-PACBTI: mrs	r0, pac_key_p_2_ns        @ encoding: [0xef,0xf3,0xa2,0x80]
104// CHECK-NOPACBTI: error: invalid operand for instruction
105mrs r0, pac_key_p_2_ns
106// CHECK-PACBTI: mrs	r0, pac_key_p_3_ns        @ encoding: [0xef,0xf3,0xa3,0x80]
107// CHECK-NOPACBTI: error: invalid operand for instruction
108mrs r0, pac_key_p_3_ns
109// CHECK-PACBTI: mrs	r0, pac_key_u_0_ns        @ encoding: [0xef,0xf3,0xa4,0x80]
110// CHECK-NOPACBTI: error: invalid operand for instruction
111mrs r0, pac_key_u_0_ns
112// CHECK-PACBTI: mrs	r0, pac_key_u_1_ns        @ encoding: [0xef,0xf3,0xa5,0x80]
113// CHECK-NOPACBTI: error: invalid operand for instruction
114mrs r0, pac_key_u_1_ns
115// CHECK-PACBTI: mrs	r0, pac_key_u_2_ns        @ encoding: [0xef,0xf3,0xa6,0x80]
116// CHECK-NOPACBTI: error: invalid operand for instruction
117mrs r0, pac_key_u_2_ns
118// CHECK-PACBTI: mrs	r0, pac_key_u_3_ns        @ encoding: [0xef,0xf3,0xa7,0x80]
119// CHECK-NOPACBTI: error: invalid operand for instruction
120mrs r0, pac_key_u_3_ns
121
122// Hint space instructions - deliberately at the bottom of the file as the
123// error's are emitted first.
124
125// CHECK: aut	r12, lr, sp             @ encoding: [0xaf,0xf3,0x2d,0x80]
126aut ip, lr, sp
127// CHECK: aut	r12,lr,sp               @ encoding: [0xaf,0xf3,0x2d,0x80]
128hint.w #45
129
130// CHECK: bti	                        @ encoding: [0xaf,0xf3,0x0f,0x80]
131bti
132// CHECK: bti	                        @ encoding: [0xaf,0xf3,0x0f,0x80]
133hint.w #15
134
135// CHECK: pac r12, lr, sp               @ encoding: [0xaf,0xf3,0x1d,0x80]
136pac ip, lr, sp
137// CHECK: pac r12,lr,sp                 @ encoding: [0xaf,0xf3,0x1d,0x80]
138hint.w #29
139// CHECK: pacbti r12, lr, sp            @ encoding: [0xaf,0xf3,0x0d,0x80]
140pacbti ip, lr, sp
141// CHECK: pacbti r12,lr,sp              @ encoding: [0xaf,0xf3,0x0d,0x80]
142hint.w #13