]>
Commit | Line | Data |
---|---|---|
a06ea964 NC |
1 | /* AArch64 assembler/disassembler support. |
2 | ||
fd67aa11 | 3 | Copyright (C) 2009-2024 Free Software Foundation, Inc. |
a06ea964 NC |
4 | Contributed by ARM Ltd. |
5 | ||
6 | This file is part of GNU Binutils. | |
7 | ||
8 | This program is free software; you can redistribute it and/or modify | |
9 | it under the terms of the GNU General Public License as published by | |
10 | the Free Software Foundation; either version 3 of the license, or | |
11 | (at your option) any later version. | |
12 | ||
13 | This program is distributed in the hope that it will be useful, | |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | GNU General Public License for more details. | |
17 | ||
18 | You should have received a copy of the GNU General Public License | |
19 | along with this program; see the file COPYING3. If not, | |
20 | see <http://www.gnu.org/licenses/>. */ | |
21 | ||
22 | #ifndef OPCODE_AARCH64_H | |
23 | #define OPCODE_AARCH64_H | |
24 | ||
25 | #include "bfd.h" | |
3dfb1b6d | 26 | #include <stdint.h> |
a06ea964 NC |
27 | #include <assert.h> |
28 | #include <stdlib.h> | |
29 | ||
76a4c1e0 AB |
30 | #include "dis-asm.h" |
31 | ||
d3e12b29 YQ |
32 | #ifdef __cplusplus |
33 | extern "C" { | |
34 | #endif | |
35 | ||
a06ea964 NC |
36 | /* The offset for pc-relative addressing is currently defined to be 0. */ |
37 | #define AARCH64_PCREL_OFFSET 0 | |
38 | ||
39 | typedef uint32_t aarch64_insn; | |
40 | ||
4abb672a RS |
41 | /* An enum containing all known CPU features. The values act as bit positions |
42 | into aarch64_feature_set. */ | |
43 | enum aarch64_feature_bit { | |
44 | /* All processors. */ | |
45 | AARCH64_FEATURE_V8, | |
46 | /* ARMv8.6 processors. */ | |
47 | AARCH64_FEATURE_V8_6A, | |
48 | /* Bfloat16 insns. */ | |
49 | AARCH64_FEATURE_BFLOAT16, | |
50 | /* Armv8-A processors. */ | |
51 | AARCH64_FEATURE_V8A, | |
52 | /* SVE2 instructions. */ | |
53 | AARCH64_FEATURE_SVE2, | |
54 | /* ARMv8.2 processors. */ | |
55 | AARCH64_FEATURE_V8_2A, | |
56 | /* ARMv8.3 processors. */ | |
57 | AARCH64_FEATURE_V8_3A, | |
58 | AARCH64_FEATURE_SVE2_AES, | |
59 | AARCH64_FEATURE_SVE2_BITPERM, | |
60 | AARCH64_FEATURE_SVE2_SM4, | |
61 | AARCH64_FEATURE_SVE2_SHA3, | |
62 | /* ARMv8.4 processors. */ | |
63 | AARCH64_FEATURE_V8_4A, | |
64 | /* Armv8-R processors. */ | |
65 | AARCH64_FEATURE_V8R, | |
66 | /* Armv8.7 processors. */ | |
67 | AARCH64_FEATURE_V8_7A, | |
68 | /* Scalable Matrix Extension. */ | |
69 | AARCH64_FEATURE_SME, | |
70 | /* Atomic 64-byte load/store. */ | |
71 | AARCH64_FEATURE_LS64, | |
72 | /* v8.3 Pointer Authentication. */ | |
73 | AARCH64_FEATURE_PAC, | |
74 | /* FP instructions. */ | |
75 | AARCH64_FEATURE_FP, | |
76 | /* SIMD instructions. */ | |
77 | AARCH64_FEATURE_SIMD, | |
78 | /* CRC instructions. */ | |
79 | AARCH64_FEATURE_CRC, | |
80 | /* LSE instructions. */ | |
81 | AARCH64_FEATURE_LSE, | |
82 | /* PAN instructions. */ | |
83 | AARCH64_FEATURE_PAN, | |
84 | /* LOR instructions. */ | |
85 | AARCH64_FEATURE_LOR, | |
86 | /* v8.1 SIMD instructions. */ | |
87 | AARCH64_FEATURE_RDMA, | |
88 | /* v8.1 features. */ | |
89 | AARCH64_FEATURE_V8_1A, | |
90 | /* v8.2 FP16 instructions. */ | |
91 | AARCH64_FEATURE_F16, | |
92 | /* RAS Extensions. */ | |
93 | AARCH64_FEATURE_RAS, | |
94 | /* Statistical Profiling. */ | |
95 | AARCH64_FEATURE_PROFILE, | |
96 | /* SVE instructions. */ | |
97 | AARCH64_FEATURE_SVE, | |
98 | /* RCPC instructions. */ | |
99 | AARCH64_FEATURE_RCPC, | |
36891070 AC |
100 | /* RCPC2 instructions. */ |
101 | AARCH64_FEATURE_RCPC2, | |
4abb672a RS |
102 | /* Complex # instructions. */ |
103 | AARCH64_FEATURE_COMPNUM, | |
227af30e AC |
104 | /* JavaScript conversion instructions. */ |
105 | AARCH64_FEATURE_JSCVT, | |
4abb672a RS |
106 | /* Dot Product instructions. */ |
107 | AARCH64_FEATURE_DOTPROD, | |
108 | /* SM3 & SM4 instructions. */ | |
109 | AARCH64_FEATURE_SM4, | |
110 | /* SHA2 instructions. */ | |
111 | AARCH64_FEATURE_SHA2, | |
112 | /* SHA3 instructions. */ | |
113 | AARCH64_FEATURE_SHA3, | |
114 | /* AES instructions. */ | |
115 | AARCH64_FEATURE_AES, | |
116 | /* v8.2 FP16FML ins. */ | |
117 | AARCH64_FEATURE_F16_FML, | |
118 | /* ARMv8.5 processors. */ | |
119 | AARCH64_FEATURE_V8_5A, | |
120 | /* v8.5 Flag Manipulation version 2. */ | |
121 | AARCH64_FEATURE_FLAGMANIP, | |
122 | /* FRINT[32,64][Z,X] insns. */ | |
123 | AARCH64_FEATURE_FRINTTS, | |
124 | /* SB instruction. */ | |
125 | AARCH64_FEATURE_SB, | |
126 | /* Execution and Data Prediction Restriction instructions. */ | |
127 | AARCH64_FEATURE_PREDRES, | |
128 | /* DC CVADP. */ | |
129 | AARCH64_FEATURE_CVADP, | |
130 | /* Random Number instructions. */ | |
131 | AARCH64_FEATURE_RNG, | |
132 | /* BTI instructions. */ | |
133 | AARCH64_FEATURE_BTI, | |
134 | /* SCXTNUM_ELx. */ | |
135 | AARCH64_FEATURE_SCXTNUM, | |
136 | /* ID_PFR2 instructions. */ | |
137 | AARCH64_FEATURE_ID_PFR2, | |
138 | /* SSBS mechanism enabled. */ | |
139 | AARCH64_FEATURE_SSBS, | |
140 | /* Memory Tagging Extension. */ | |
141 | AARCH64_FEATURE_MEMTAG, | |
142 | /* Transactional Memory Extension. */ | |
143 | AARCH64_FEATURE_TME, | |
43291582 AC |
144 | /* XS memory attribute. */ |
145 | AARCH64_FEATURE_XS, | |
59255bf7 AC |
146 | /* WFx instructions with timeout. */ |
147 | AARCH64_FEATURE_WFXT, | |
4abb672a RS |
148 | /* Standardization of memory operations. */ |
149 | AARCH64_FEATURE_MOPS, | |
150 | /* Hinted conditional branches. */ | |
151 | AARCH64_FEATURE_HBC, | |
152 | /* Matrix Multiply instructions. */ | |
153 | AARCH64_FEATURE_I8MM, | |
154 | AARCH64_FEATURE_F32MM, | |
155 | AARCH64_FEATURE_F64MM, | |
156 | /* v8.4 Flag Manipulation. */ | |
157 | AARCH64_FEATURE_FLAGM, | |
158 | /* Armv9.0-A processors. */ | |
159 | AARCH64_FEATURE_V9A, | |
160 | /* SME F64F64. */ | |
161 | AARCH64_FEATURE_SME_F64F64, | |
162 | /* SME I16I64. */ | |
163 | AARCH64_FEATURE_SME_I16I64, | |
164 | /* Armv8.8 processors. */ | |
165 | AARCH64_FEATURE_V8_8A, | |
166 | /* Common Short Sequence Compression instructions. */ | |
167 | AARCH64_FEATURE_CSSC, | |
8cee11ca | 168 | /* Armv8.9-A processors. */ |
169 | AARCH64_FEATURE_V8_9A, | |
6c0ecdba SP |
170 | /* Check Feature Status Extension. */ |
171 | AARCH64_FEATURE_CHK, | |
f985c251 | 172 | /* Guarded Control Stack. */ |
173 | AARCH64_FEATURE_GCS, | |
43e228e9 SP |
174 | /* SPE Call Return branch records. */ |
175 | AARCH64_FEATURE_SPE_CRR, | |
176 | /* SPE Filter by data source. */ | |
177 | AARCH64_FEATURE_SPE_FDS, | |
178 | /* Additional SPE events. */ | |
179 | AARCH64_FEATURE_SPEv1p4, | |
4abb672a | 180 | /* SME2. */ |
d86dbbea | 181 | AARCH64_FEATURE_SME2, |
9203a155 VDN |
182 | /* Translation Hardening Extension. */ |
183 | AARCH64_FEATURE_THE, | |
f0d70d8e VDN |
184 | /* LSE128. */ |
185 | AARCH64_FEATURE_LSE128, | |
311276f1 SP |
186 | /* ARMv8.9-A RAS Extensions. */ |
187 | AARCH64_FEATURE_RASv2, | |
188 | /* System Control Register2. */ | |
189 | AARCH64_FEATURE_SCTLR2, | |
190 | /* Fine Grained Traps. */ | |
191 | AARCH64_FEATURE_FGT2, | |
192 | /* Physical Fault Address. */ | |
193 | AARCH64_FEATURE_PFAR, | |
281fda33 SP |
194 | /* Address Translate Stage 1. */ |
195 | AARCH64_FEATURE_ATS1A, | |
44167ca8 SP |
196 | /* Memory Attribute Index Enhancement. */ |
197 | AARCH64_FEATURE_AIE, | |
198 | /* Stage 1 Permission Indirection Extension. */ | |
199 | AARCH64_FEATURE_S1PIE, | |
200 | /* Stage 2 Permission Indirection Extension. */ | |
201 | AARCH64_FEATURE_S2PIE, | |
202 | /* Stage 1 Permission Overlay Extension. */ | |
203 | AARCH64_FEATURE_S1POE, | |
204 | /* Stage 2 Permission Overlay Extension. */ | |
205 | AARCH64_FEATURE_S2POE, | |
206 | /* Extension to Translation Control Registers. */ | |
207 | AARCH64_FEATURE_TCR2, | |
88b5a8ae AC |
208 | /* Speculation Prediction Restriction instructions. */ |
209 | AARCH64_FEATURE_PREDRES2, | |
d645278c AC |
210 | /* Instrumentation Extension. */ |
211 | AARCH64_FEATURE_ITE, | |
7b08cc32 VDN |
212 | /* 128-bit page table descriptor, system registers |
213 | and isntructions. */ | |
214 | AARCH64_FEATURE_D128, | |
15f3b5ba SJ |
215 | /* Armv8.9-A/Armv9.4-A architecture Debug extension. */ |
216 | AARCH64_FEATURE_DEBUGv8p9, | |
217 | /* Performance Monitors Extension. */ | |
218 | AARCH64_FEATURE_PMUv3p9, | |
219 | /* Performance Monitors Snapshots Extension. */ | |
220 | AARCH64_FEATURE_PMUv3_SS, | |
221 | /* Performance Monitors Instruction Counter Extension. */ | |
222 | AARCH64_FEATURE_PMUv3_ICNTR, | |
223 | /* Performance Monitors Synchronous-Exception-Based Event Extension. */ | |
224 | AARCH64_FEATURE_SEBEP, | |
7e8d2d87 SP |
225 | /* SVE2.1 and SME2.1 non-widening BFloat16 instructions. */ |
226 | AARCH64_FEATURE_B16B16, | |
89e06ec1 SP |
227 | /* SME2.1 instructions. */ |
228 | AARCH64_FEATURE_SME2p1, | |
88601c2d SP |
229 | /* SVE2.1 instructions. */ |
230 | AARCH64_FEATURE_SVE2p1, | |
d86dbbea | 231 | AARCH64_NUM_FEATURES |
4abb672a RS |
232 | }; |
233 | ||
234 | /* These macros take an initial argument X that gives the index into | |
235 | an aarch64_feature_set. The macros then return the bitmask for | |
236 | that array index. */ | |
237 | ||
238 | /* A mask in which feature bit BIT is set and all other bits are clear. */ | |
239 | #define AARCH64_UINT64_BIT(X, BIT) \ | |
240 | ((X) == (BIT) / 64 ? 1ULL << (BIT) % 64 : 0) | |
241 | ||
242 | /* A mask that includes only AARCH64_FEATURE_<NAME>. */ | |
243 | #define AARCH64_FEATBIT(X, NAME) \ | |
244 | AARCH64_UINT64_BIT (X, AARCH64_FEATURE_##NAME) | |
245 | ||
246 | /* A mask of the features that are enabled by each architecture version, | |
247 | excluding those that are inherited from other architecture versions. */ | |
248 | #define AARCH64_ARCH_V8A_FEATURES(X) (AARCH64_FEATBIT (X, V8A) \ | |
249 | | AARCH64_FEATBIT (X, FP) \ | |
250 | | AARCH64_FEATBIT (X, RAS) \ | |
6c0ecdba SP |
251 | | AARCH64_FEATBIT (X, SIMD) \ |
252 | | AARCH64_FEATBIT (X, CHK)) | |
4abb672a RS |
253 | #define AARCH64_ARCH_V8_1A_FEATURES(X) (AARCH64_FEATBIT (X, V8_1A) \ |
254 | | AARCH64_FEATBIT (X, CRC) \ | |
255 | | AARCH64_FEATBIT (X, LSE) \ | |
256 | | AARCH64_FEATBIT (X, PAN) \ | |
257 | | AARCH64_FEATBIT (X, LOR) \ | |
258 | | AARCH64_FEATBIT (X, RDMA)) | |
259 | #define AARCH64_ARCH_V8_2A_FEATURES(X) (AARCH64_FEATBIT (X, V8_2A)) | |
260 | #define AARCH64_ARCH_V8_3A_FEATURES(X) (AARCH64_FEATBIT (X, V8_3A) \ | |
261 | | AARCH64_FEATBIT (X, PAC) \ | |
262 | | AARCH64_FEATBIT (X, RCPC) \ | |
227af30e AC |
263 | | AARCH64_FEATBIT (X, COMPNUM) \ |
264 | | AARCH64_FEATBIT (X, JSCVT)) | |
4abb672a | 265 | #define AARCH64_ARCH_V8_4A_FEATURES(X) (AARCH64_FEATBIT (X, V8_4A) \ |
36891070 | 266 | | AARCH64_FEATBIT (X, RCPC2) \ |
4abb672a RS |
267 | | AARCH64_FEATBIT (X, DOTPROD) \ |
268 | | AARCH64_FEATBIT (X, FLAGM) \ | |
269 | | AARCH64_FEATBIT (X, F16_FML)) | |
270 | #define AARCH64_ARCH_V8_5A_FEATURES(X) (AARCH64_FEATBIT (X, V8_5A) \ | |
271 | | AARCH64_FEATBIT (X, FLAGMANIP) \ | |
272 | | AARCH64_FEATBIT (X, FRINTTS) \ | |
273 | | AARCH64_FEATBIT (X, SB) \ | |
274 | | AARCH64_FEATBIT (X, PREDRES) \ | |
275 | | AARCH64_FEATBIT (X, CVADP) \ | |
276 | | AARCH64_FEATBIT (X, BTI) \ | |
277 | | AARCH64_FEATBIT (X, SCXTNUM) \ | |
278 | | AARCH64_FEATBIT (X, ID_PFR2) \ | |
279 | | AARCH64_FEATBIT (X, SSBS)) | |
280 | #define AARCH64_ARCH_V8_6A_FEATURES(X) (AARCH64_FEATBIT (X, V8_6A) \ | |
281 | | AARCH64_FEATBIT (X, BFLOAT16) \ | |
282 | | AARCH64_FEATBIT (X, I8MM)) | |
283 | #define AARCH64_ARCH_V8_7A_FEATURES(X) (AARCH64_FEATBIT (X, V8_7A) \ | |
43291582 | 284 | | AARCH64_FEATBIT (X, XS) \ |
59255bf7 | 285 | | AARCH64_FEATBIT (X, WFXT) \ |
4abb672a RS |
286 | | AARCH64_FEATBIT (X, LS64)) |
287 | #define AARCH64_ARCH_V8_8A_FEATURES(X) (AARCH64_FEATBIT (X, V8_8A) \ | |
288 | | AARCH64_FEATBIT (X, MOPS) \ | |
289 | | AARCH64_FEATBIT (X, HBC)) | |
43e228e9 SP |
290 | #define AARCH64_ARCH_V8_9A_FEATURES(X) (AARCH64_FEATBIT (X, V8_9A) \ |
291 | | AARCH64_FEATBIT (X, SPEv1p4) \ | |
292 | | AARCH64_FEATBIT (X, SPE_CRR) \ | |
311276f1 SP |
293 | | AARCH64_FEATBIT (X, SPE_FDS) \ |
294 | | AARCH64_FEATBIT (X, RASv2) \ | |
295 | | AARCH64_FEATBIT (X, SCTLR2) \ | |
296 | | AARCH64_FEATBIT (X, FGT2) \ | |
281fda33 | 297 | | AARCH64_FEATBIT (X, PFAR) \ |
44167ca8 SP |
298 | | AARCH64_FEATBIT (X, ATS1A) \ |
299 | | AARCH64_FEATBIT (X, AIE) \ | |
300 | | AARCH64_FEATBIT (X, S1PIE) \ | |
301 | | AARCH64_FEATBIT (X, S2PIE) \ | |
302 | | AARCH64_FEATBIT (X, S1POE) \ | |
303 | | AARCH64_FEATBIT (X, S2POE) \ | |
304 | | AARCH64_FEATBIT (X, TCR2) \ | |
15f3b5ba SJ |
305 | | AARCH64_FEATBIT (X, DEBUGv8p9) \ |
306 | | AARCH64_FEATBIT (X, PMUv3p9) \ | |
307 | | AARCH64_FEATBIT (X, PMUv3_SS) \ | |
308 | | AARCH64_FEATBIT (X, PMUv3_ICNTR) \ | |
309 | | AARCH64_FEATBIT (X, SEBEP) \ | |
44167ca8 | 310 | ) |
4abb672a RS |
311 | |
312 | #define AARCH64_ARCH_V9A_FEATURES(X) (AARCH64_FEATBIT (X, V9A) \ | |
313 | | AARCH64_FEATBIT (X, F16) \ | |
314 | | AARCH64_FEATBIT (X, SVE) \ | |
315 | | AARCH64_FEATBIT (X, SVE2)) | |
316 | #define AARCH64_ARCH_V9_1A_FEATURES(X) AARCH64_ARCH_V8_6A_FEATURES (X) | |
317 | #define AARCH64_ARCH_V9_2A_FEATURES(X) AARCH64_ARCH_V8_7A_FEATURES (X) | |
318 | #define AARCH64_ARCH_V9_3A_FEATURES(X) AARCH64_ARCH_V8_8A_FEATURES (X) | |
88b5a8ae AC |
319 | #define AARCH64_ARCH_V9_4A_FEATURES(X) (AARCH64_ARCH_V8_9A_FEATURES (X) \ |
320 | | AARCH64_FEATBIT (X, PREDRES2)) | |
35180222 | 321 | |
a06ea964 | 322 | /* Architectures are the sum of the base and extensions. */ |
4abb672a RS |
323 | #define AARCH64_ARCH_V8A(X) (AARCH64_FEATBIT (X, V8) \ |
324 | | AARCH64_ARCH_V8A_FEATURES (X)) | |
325 | #define AARCH64_ARCH_V8_1A(X) (AARCH64_ARCH_V8A (X) \ | |
326 | | AARCH64_ARCH_V8_1A_FEATURES (X)) | |
327 | #define AARCH64_ARCH_V8_2A(X) (AARCH64_ARCH_V8_1A (X) \ | |
328 | | AARCH64_ARCH_V8_2A_FEATURES (X)) | |
329 | #define AARCH64_ARCH_V8_3A(X) (AARCH64_ARCH_V8_2A (X) \ | |
330 | | AARCH64_ARCH_V8_3A_FEATURES (X)) | |
331 | #define AARCH64_ARCH_V8_4A(X) (AARCH64_ARCH_V8_3A (X) \ | |
332 | | AARCH64_ARCH_V8_4A_FEATURES (X)) | |
333 | #define AARCH64_ARCH_V8_5A(X) (AARCH64_ARCH_V8_4A (X) \ | |
334 | | AARCH64_ARCH_V8_5A_FEATURES (X)) | |
335 | #define AARCH64_ARCH_V8_6A(X) (AARCH64_ARCH_V8_5A (X) \ | |
336 | | AARCH64_ARCH_V8_6A_FEATURES (X)) | |
337 | #define AARCH64_ARCH_V8_7A(X) (AARCH64_ARCH_V8_6A (X) \ | |
338 | | AARCH64_ARCH_V8_7A_FEATURES (X)) | |
339 | #define AARCH64_ARCH_V8_8A(X) (AARCH64_ARCH_V8_7A (X) \ | |
340 | | AARCH64_ARCH_V8_8A_FEATURES (X)) | |
8cee11ca | 341 | #define AARCH64_ARCH_V8_9A(X) (AARCH64_ARCH_V8_8A (X) \ |
342 | | AARCH64_ARCH_V8_9A_FEATURES (X)) | |
4abb672a RS |
343 | #define AARCH64_ARCH_V8R(X) ((AARCH64_ARCH_V8_4A (X) \ |
344 | | AARCH64_FEATBIT (X, V8R)) \ | |
345 | & ~AARCH64_FEATBIT (X, V8A) \ | |
346 | & ~AARCH64_FEATBIT (X, LOR)) | |
347 | ||
348 | #define AARCH64_ARCH_V9A(X) (AARCH64_ARCH_V8_5A (X) \ | |
349 | | AARCH64_ARCH_V9A_FEATURES (X)) | |
350 | #define AARCH64_ARCH_V9_1A(X) (AARCH64_ARCH_V9A (X) \ | |
351 | | AARCH64_ARCH_V9_1A_FEATURES (X)) | |
352 | #define AARCH64_ARCH_V9_2A(X) (AARCH64_ARCH_V9_1A (X) \ | |
353 | | AARCH64_ARCH_V9_2A_FEATURES (X)) | |
354 | #define AARCH64_ARCH_V9_3A(X) (AARCH64_ARCH_V9_2A (X) \ | |
355 | | AARCH64_ARCH_V9_3A_FEATURES (X)) | |
8cee11ca | 356 | #define AARCH64_ARCH_V9_4A(X) (AARCH64_ARCH_V9_3A (X) \ |
357 | | AARCH64_ARCH_V9_4A_FEATURES (X)) | |
4abb672a RS |
358 | |
359 | #define AARCH64_ARCH_NONE(X) 0 | |
a06ea964 NC |
360 | |
361 | /* CPU-specific features. */ | |
d86dbbea RS |
362 | typedef struct { |
363 | uint64_t flags[(AARCH64_NUM_FEATURES + 63) / 64]; | |
364 | } aarch64_feature_set; | |
a06ea964 | 365 | |
4abb672a | 366 | #define AARCH64_CPU_HAS_FEATURE(CPU,FEAT) \ |
d86dbbea RS |
367 | ((~(CPU).flags[0] & AARCH64_FEATBIT (0, FEAT)) == 0 \ |
368 | && (~(CPU).flags[1] & AARCH64_FEATBIT (1, FEAT)) == 0) | |
4abb672a | 369 | |
93d8990c | 370 | #define AARCH64_CPU_HAS_ALL_FEATURES(CPU,FEAT) \ |
d86dbbea RS |
371 | ((~(CPU).flags[0] & (FEAT).flags[0]) == 0 \ |
372 | && (~(CPU).flags[1] & (FEAT).flags[1]) == 0) | |
93d8990c SN |
373 | |
374 | #define AARCH64_CPU_HAS_ANY_FEATURES(CPU,FEAT) \ | |
d86dbbea RS |
375 | (((CPU).flags[0] & (FEAT).flags[0]) != 0 \ |
376 | || ((CPU).flags[1] & (FEAT).flags[1]) != 0) | |
a06ea964 | 377 | |
4abb672a | 378 | #define AARCH64_SET_FEATURE(DEST, FEAT) \ |
d86dbbea RS |
379 | ((DEST).flags[0] = FEAT (0), \ |
380 | (DEST).flags[1] = FEAT (1)) | |
4abb672a RS |
381 | |
382 | #define AARCH64_CLEAR_FEATURE(DEST, SRC, FEAT) \ | |
d86dbbea RS |
383 | ((DEST).flags[0] = (SRC).flags[0] & ~AARCH64_FEATBIT (0, FEAT), \ |
384 | (DEST).flags[1] = (SRC).flags[1] & ~AARCH64_FEATBIT (1, FEAT)) | |
385 | ||
386 | #define AARCH64_MERGE_FEATURE_SETS(TARG,F1,F2) \ | |
387 | do \ | |
388 | { \ | |
389 | (TARG).flags[0] = (F1).flags[0] | (F2).flags[0]; \ | |
390 | (TARG).flags[1] = (F1).flags[1] | (F2).flags[1]; \ | |
391 | } \ | |
a06ea964 NC |
392 | while (0) |
393 | ||
d86dbbea RS |
394 | #define AARCH64_CLEAR_FEATURES(TARG,F1,F2) \ |
395 | do \ | |
396 | { \ | |
397 | (TARG).flags[0] = (F1).flags[0] &~ (F2).flags[0]; \ | |
398 | (TARG).flags[1] = (F1).flags[1] &~ (F2).flags[1]; \ | |
399 | } \ | |
a06ea964 NC |
400 | while (0) |
401 | ||
4abb672a RS |
402 | /* aarch64_feature_set initializers for no features and all features, |
403 | respectively. */ | |
d86dbbea RS |
404 | #define AARCH64_NO_FEATURES { { 0, 0 } } |
405 | #define AARCH64_ALL_FEATURES { { -1, -1 } } | |
4abb672a RS |
406 | |
407 | /* An aarch64_feature_set initializer for a single feature, | |
408 | AARCH64_FEATURE_<FEAT>. */ | |
d86dbbea RS |
409 | #define AARCH64_FEATURE(FEAT) \ |
410 | { { AARCH64_FEATBIT (0, FEAT), AARCH64_FEATBIT (1, FEAT) } } | |
4abb672a RS |
411 | |
412 | /* An aarch64_feature_set initializer for a specific architecture version, | |
413 | including all the features that are enabled by default for that architecture | |
414 | version. */ | |
d86dbbea RS |
415 | #define AARCH64_ARCH_FEATURES(ARCH) \ |
416 | { { AARCH64_ARCH_##ARCH (0), AARCH64_ARCH_##ARCH (1) } } | |
4abb672a RS |
417 | |
418 | /* Used by AARCH64_CPU_FEATURES. */ | |
419 | #define AARCH64_OR_FEATURES_1(X, ARCH, F1) \ | |
420 | (AARCH64_FEATBIT (X, F1) | AARCH64_ARCH_##ARCH (X)) | |
421 | #define AARCH64_OR_FEATURES_2(X, ARCH, F1, F2) \ | |
422 | (AARCH64_FEATBIT (X, F1) | AARCH64_OR_FEATURES_1 (X, ARCH, F2)) | |
423 | #define AARCH64_OR_FEATURES_3(X, ARCH, F1, ...) \ | |
424 | (AARCH64_FEATBIT (X, F1) | AARCH64_OR_FEATURES_2 (X, ARCH, __VA_ARGS__)) | |
425 | #define AARCH64_OR_FEATURES_4(X, ARCH, F1, ...) \ | |
426 | (AARCH64_FEATBIT (X, F1) | AARCH64_OR_FEATURES_3 (X, ARCH, __VA_ARGS__)) | |
427 | #define AARCH64_OR_FEATURES_5(X, ARCH, F1, ...) \ | |
428 | (AARCH64_FEATBIT (X, F1) | AARCH64_OR_FEATURES_4 (X, ARCH, __VA_ARGS__)) | |
429 | #define AARCH64_OR_FEATURES_6(X, ARCH, F1, ...) \ | |
430 | (AARCH64_FEATBIT (X, F1) | AARCH64_OR_FEATURES_5 (X, ARCH, __VA_ARGS__)) | |
431 | #define AARCH64_OR_FEATURES_7(X, ARCH, F1, ...) \ | |
432 | (AARCH64_FEATBIT (X, F1) | AARCH64_OR_FEATURES_6 (X, ARCH, __VA_ARGS__)) | |
433 | #define AARCH64_OR_FEATURES_8(X, ARCH, F1, ...) \ | |
434 | (AARCH64_FEATBIT (X, F1) | AARCH64_OR_FEATURES_7 (X, ARCH, __VA_ARGS__)) | |
435 | #define AARCH64_OR_FEATURES_9(X, ARCH, F1, ...) \ | |
436 | (AARCH64_FEATBIT (X, F1) | AARCH64_OR_FEATURES_8 (X, ARCH, __VA_ARGS__)) | |
437 | ||
438 | /* An aarch64_feature_set initializer for a CPU that implements architecture | |
439 | version ARCH, and additionally provides the N features listed in "...". */ | |
440 | #define AARCH64_CPU_FEATURES(ARCH, N, ...) \ | |
d86dbbea RS |
441 | { { AARCH64_OR_FEATURES_##N (0, ARCH, __VA_ARGS__), \ |
442 | AARCH64_OR_FEATURES_##N (1, ARCH, __VA_ARGS__) } } | |
4abb672a RS |
443 | |
444 | /* An aarch64_feature_set initializer for the N features listed in "...". */ | |
445 | #define AARCH64_FEATURES(N, ...) \ | |
446 | AARCH64_CPU_FEATURES (NONE, N, __VA_ARGS__) | |
a06ea964 | 447 | |
a06ea964 NC |
448 | enum aarch64_operand_class |
449 | { | |
450 | AARCH64_OPND_CLASS_NIL, | |
451 | AARCH64_OPND_CLASS_INT_REG, | |
452 | AARCH64_OPND_CLASS_MODIFIED_REG, | |
453 | AARCH64_OPND_CLASS_FP_REG, | |
454 | AARCH64_OPND_CLASS_SIMD_REG, | |
455 | AARCH64_OPND_CLASS_SIMD_ELEMENT, | |
456 | AARCH64_OPND_CLASS_SISD_REG, | |
457 | AARCH64_OPND_CLASS_SIMD_REGLIST, | |
f11ad6bc | 458 | AARCH64_OPND_CLASS_SVE_REG, |
db3c06bf | 459 | AARCH64_OPND_CLASS_SVE_REGLIST, |
f11ad6bc | 460 | AARCH64_OPND_CLASS_PRED_REG, |
ff60bcbf | 461 | AARCH64_OPND_CLASS_ZA_ACCESS, |
a06ea964 NC |
462 | AARCH64_OPND_CLASS_ADDRESS, |
463 | AARCH64_OPND_CLASS_IMMEDIATE, | |
464 | AARCH64_OPND_CLASS_SYSTEM, | |
68a64283 | 465 | AARCH64_OPND_CLASS_COND, |
a06ea964 NC |
466 | }; |
467 | ||
468 | /* Operand code that helps both parsing and coding. | |
469 | Keep AARCH64_OPERANDS synced. */ | |
470 | ||
471 | enum aarch64_opnd | |
472 | { | |
473 | AARCH64_OPND_NIL, /* no operand---MUST BE FIRST!*/ | |
474 | ||
475 | AARCH64_OPND_Rd, /* Integer register as destination. */ | |
476 | AARCH64_OPND_Rn, /* Integer register as source. */ | |
477 | AARCH64_OPND_Rm, /* Integer register as source. */ | |
478 | AARCH64_OPND_Rt, /* Integer register used in ld/st instructions. */ | |
479 | AARCH64_OPND_Rt2, /* Integer register used in ld/st pair instructions. */ | |
6c0ecdba | 480 | AARCH64_OPND_X16, /* Integer register x16 in chkfeat instruction. */ |
8edca81e | 481 | AARCH64_OPND_Rt_LS64, /* Integer register used in LS64 instructions. */ |
bd7ceb8d | 482 | AARCH64_OPND_Rt_SP, /* Integer Rt or SP used in STG instructions. */ |
a06ea964 NC |
483 | AARCH64_OPND_Rs, /* Integer register used in ld/st exclusive. */ |
484 | AARCH64_OPND_Ra, /* Integer register used in ddp_3src instructions. */ | |
485 | AARCH64_OPND_Rt_SYS, /* Integer register used in system instructions. */ | |
486 | ||
487 | AARCH64_OPND_Rd_SP, /* Integer Rd or SP. */ | |
488 | AARCH64_OPND_Rn_SP, /* Integer Rn or SP. */ | |
c84364ec | 489 | AARCH64_OPND_Rm_SP, /* Integer Rm or SP. */ |
ee804238 | 490 | AARCH64_OPND_PAIRREG, /* Paired register operand. */ |
d30eb38d | 491 | AARCH64_OPND_PAIRREG_OR_XZR, /* Paired register operand, optionally xzr. */ |
a06ea964 NC |
492 | AARCH64_OPND_Rm_EXT, /* Integer Rm extended. */ |
493 | AARCH64_OPND_Rm_SFT, /* Integer Rm shifted. */ | |
494 | ||
495 | AARCH64_OPND_Fd, /* Floating-point Fd. */ | |
496 | AARCH64_OPND_Fn, /* Floating-point Fn. */ | |
497 | AARCH64_OPND_Fm, /* Floating-point Fm. */ | |
498 | AARCH64_OPND_Fa, /* Floating-point Fa. */ | |
499 | AARCH64_OPND_Ft, /* Floating-point Ft. */ | |
500 | AARCH64_OPND_Ft2, /* Floating-point Ft2. */ | |
501 | ||
502 | AARCH64_OPND_Sd, /* AdvSIMD Scalar Sd. */ | |
503 | AARCH64_OPND_Sn, /* AdvSIMD Scalar Sn. */ | |
504 | AARCH64_OPND_Sm, /* AdvSIMD Scalar Sm. */ | |
505 | ||
f42f1a1d | 506 | AARCH64_OPND_Va, /* AdvSIMD Vector Va. */ |
a06ea964 NC |
507 | AARCH64_OPND_Vd, /* AdvSIMD Vector Vd. */ |
508 | AARCH64_OPND_Vn, /* AdvSIMD Vector Vn. */ | |
509 | AARCH64_OPND_Vm, /* AdvSIMD Vector Vm. */ | |
510 | AARCH64_OPND_VdD1, /* AdvSIMD <Vd>.D[1]; for FMOV only. */ | |
511 | AARCH64_OPND_VnD1, /* AdvSIMD <Vn>.D[1]; for FMOV only. */ | |
512 | AARCH64_OPND_Ed, /* AdvSIMD Vector Element Vd. */ | |
513 | AARCH64_OPND_En, /* AdvSIMD Vector Element Vn. */ | |
514 | AARCH64_OPND_Em, /* AdvSIMD Vector Element Vm. */ | |
369c9167 TC |
515 | AARCH64_OPND_Em16, /* AdvSIMD Vector Element Vm restricted to V0 - V15 when |
516 | qualifier is S_H. */ | |
a06ea964 NC |
517 | AARCH64_OPND_LVn, /* AdvSIMD Vector register list used in e.g. TBL. */ |
518 | AARCH64_OPND_LVt, /* AdvSIMD Vector register list used in ld/st. */ | |
519 | AARCH64_OPND_LVt_AL, /* AdvSIMD Vector register list for loading single | |
520 | structure to all lanes. */ | |
521 | AARCH64_OPND_LEt, /* AdvSIMD Vector Element list. */ | |
522 | ||
a6a51754 RL |
523 | AARCH64_OPND_CRn, /* Co-processor register in CRn field. */ |
524 | AARCH64_OPND_CRm, /* Co-processor register in CRm field. */ | |
a06ea964 NC |
525 | |
526 | AARCH64_OPND_IDX, /* AdvSIMD EXT index operand. */ | |
f42f1a1d | 527 | AARCH64_OPND_MASK, /* AdvSIMD EXT index operand. */ |
a06ea964 NC |
528 | AARCH64_OPND_IMM_VLSL,/* Immediate for shifting vector registers left. */ |
529 | AARCH64_OPND_IMM_VLSR,/* Immediate for shifting vector registers right. */ | |
530 | AARCH64_OPND_SIMD_IMM,/* AdvSIMD modified immediate without shift. */ | |
531 | AARCH64_OPND_SIMD_IMM_SFT, /* AdvSIMD modified immediate with shift. */ | |
532 | AARCH64_OPND_SIMD_FPIMM,/* AdvSIMD 8-bit fp immediate. */ | |
533 | AARCH64_OPND_SHLL_IMM,/* Immediate shift for AdvSIMD SHLL instruction | |
534 | (no encoding). */ | |
535 | AARCH64_OPND_IMM0, /* Immediate for #0. */ | |
536 | AARCH64_OPND_FPIMM0, /* Immediate for #0.0. */ | |
537 | AARCH64_OPND_FPIMM, /* Floating-point Immediate. */ | |
538 | AARCH64_OPND_IMMR, /* Immediate #<immr> in e.g. BFM. */ | |
539 | AARCH64_OPND_IMMS, /* Immediate #<imms> in e.g. BFM. */ | |
540 | AARCH64_OPND_WIDTH, /* Immediate #<width> in e.g. BFI. */ | |
541 | AARCH64_OPND_IMM, /* Immediate. */ | |
f42f1a1d | 542 | AARCH64_OPND_IMM_2, /* Immediate. */ |
a06ea964 NC |
543 | AARCH64_OPND_UIMM3_OP1,/* Unsigned 3-bit immediate in the op1 field. */ |
544 | AARCH64_OPND_UIMM3_OP2,/* Unsigned 3-bit immediate in the op2 field. */ | |
545 | AARCH64_OPND_UIMM4, /* Unsigned 4-bit immediate in the CRm field. */ | |
193614f2 | 546 | AARCH64_OPND_UIMM4_ADDG,/* Unsigned 4-bit immediate in addg/subg. */ |
a06ea964 | 547 | AARCH64_OPND_UIMM7, /* Unsigned 7-bit immediate in the CRm:op2 fields. */ |
193614f2 | 548 | AARCH64_OPND_UIMM10, /* Unsigned 10-bit immediate in addg/subg. */ |
a06ea964 NC |
549 | AARCH64_OPND_BIT_NUM, /* Immediate. */ |
550 | AARCH64_OPND_EXCEPTION,/* imm16 operand in exception instructions. */ | |
09c1e68a | 551 | AARCH64_OPND_UNDEFINED,/* imm16 operand in undefined instruction. */ |
a06ea964 | 552 | AARCH64_OPND_CCMP_IMM,/* Immediate in conditional compare instructions. */ |
e950b345 | 553 | AARCH64_OPND_SIMM5, /* 5-bit signed immediate in the imm5 field. */ |
a06ea964 NC |
554 | AARCH64_OPND_NZCV, /* Flag bit specifier giving an alternative value for |
555 | each condition flag. */ | |
556 | ||
557 | AARCH64_OPND_LIMM, /* Logical Immediate. */ | |
558 | AARCH64_OPND_AIMM, /* Arithmetic immediate. */ | |
559 | AARCH64_OPND_HALF, /* #<imm16>{, LSL #<shift>} operand in move wide. */ | |
560 | AARCH64_OPND_FBITS, /* FP #<fbits> operand in e.g. SCVTF */ | |
561 | AARCH64_OPND_IMM_MOV, /* Immediate operand for the MOV alias. */ | |
c2c4ff8d SN |
562 | AARCH64_OPND_IMM_ROT1, /* Immediate rotate operand for FCMLA. */ |
563 | AARCH64_OPND_IMM_ROT2, /* Immediate rotate operand for indexed FCMLA. */ | |
564 | AARCH64_OPND_IMM_ROT3, /* Immediate rotate operand for FCADD. */ | |
a06ea964 NC |
565 | |
566 | AARCH64_OPND_COND, /* Standard condition as the last operand. */ | |
68a64283 | 567 | AARCH64_OPND_COND1, /* Same as the above, but excluding AL and NV. */ |
a06ea964 NC |
568 | |
569 | AARCH64_OPND_ADDR_ADRP, /* Memory address for ADRP */ | |
570 | AARCH64_OPND_ADDR_PCREL14, /* 14-bit PC-relative address for e.g. TBZ. */ | |
571 | AARCH64_OPND_ADDR_PCREL19, /* 19-bit PC-relative address for e.g. LDR. */ | |
572 | AARCH64_OPND_ADDR_PCREL21, /* 21-bit PC-relative address for e.g. ADR. */ | |
573 | AARCH64_OPND_ADDR_PCREL26, /* 26-bit PC-relative address for e.g. BL. */ | |
574 | ||
575 | AARCH64_OPND_ADDR_SIMPLE, /* Address of ld/st exclusive. */ | |
576 | AARCH64_OPND_ADDR_REGOFF, /* Address of register offset. */ | |
577 | AARCH64_OPND_ADDR_SIMM7, /* Address of signed 7-bit immediate. */ | |
578 | AARCH64_OPND_ADDR_SIMM9, /* Address of signed 9-bit immediate. */ | |
579 | AARCH64_OPND_ADDR_SIMM9_2, /* Same as the above, but the immediate is | |
580 | negative or unaligned and there is | |
581 | no writeback allowed. This operand code | |
582 | is only used to support the programmer- | |
583 | friendly feature of using LDR/STR as the | |
584 | the mnemonic name for LDUR/STUR instructions | |
585 | wherever there is no ambiguity. */ | |
3f06e550 | 586 | AARCH64_OPND_ADDR_SIMM10, /* Address of signed 10-bit immediate. */ |
fb3265b3 SD |
587 | AARCH64_OPND_ADDR_SIMM11, /* Address with a signed 11-bit (multiple of |
588 | 16) immediate. */ | |
a06ea964 | 589 | AARCH64_OPND_ADDR_UIMM12, /* Address of unsigned 12-bit immediate. */ |
fb3265b3 SD |
590 | AARCH64_OPND_ADDR_SIMM13, /* Address with a signed 13-bit (multiple of |
591 | 16) immediate. */ | |
a06ea964 | 592 | AARCH64_OPND_SIMD_ADDR_SIMPLE,/* Address of ld/st multiple structures. */ |
f42f1a1d | 593 | AARCH64_OPND_ADDR_OFFSET, /* Address with an optional 9-bit immediate. */ |
a06ea964 NC |
594 | AARCH64_OPND_SIMD_ADDR_POST, /* Address of ld/st multiple post-indexed. */ |
595 | ||
596 | AARCH64_OPND_SYSREG, /* System register operand. */ | |
9af8f671 | 597 | AARCH64_OPND_SYSREG128, /* 128-bit system register operand. */ |
a06ea964 NC |
598 | AARCH64_OPND_PSTATEFIELD, /* PSTATE field name operand. */ |
599 | AARCH64_OPND_SYSREG_AT, /* System register <at_op> operand. */ | |
600 | AARCH64_OPND_SYSREG_DC, /* System register <dc_op> operand. */ | |
601 | AARCH64_OPND_SYSREG_IC, /* System register <ic_op> operand. */ | |
602 | AARCH64_OPND_SYSREG_TLBI, /* System register <tlbi_op> operand. */ | |
a9e2cefd | 603 | AARCH64_OPND_SYSREG_TLBIP, /* System register <tlbip_op> operand. */ |
2ac435d4 | 604 | AARCH64_OPND_SYSREG_SR, /* System register RCTX operand. */ |
a06ea964 | 605 | AARCH64_OPND_BARRIER, /* Barrier operand. */ |
fd195909 | 606 | AARCH64_OPND_BARRIER_DSB_NXS, /* Barrier operand for DSB nXS variant. */ |
a06ea964 NC |
607 | AARCH64_OPND_BARRIER_ISB, /* Barrier operand for ISB. */ |
608 | AARCH64_OPND_PRFOP, /* Prefetch operation. */ | |
8ff42920 | 609 | AARCH64_OPND_RPRFMOP, /* Range prefetch operation. */ |
1e6f4800 | 610 | AARCH64_OPND_BARRIER_PSB, /* Barrier operand for PSB. */ |
c58f84d8 | 611 | AARCH64_OPND_BARRIER_GCSB, /* Barrier operand for GCSB. */ |
ff605452 | 612 | AARCH64_OPND_BTI_TARGET, /* BTI {<target>}. */ |
6219f9da VDN |
613 | AARCH64_OPND_LSE128_Rt, /* LSE128 <Xt1>. */ |
614 | AARCH64_OPND_LSE128_Rt2, /* LSE128 <Xt2>. */ | |
582e12bf | 615 | AARCH64_OPND_SVE_ADDR_RI_S4x16, /* SVE [<Xn|SP>, #<simm4>*16]. */ |
8382113f | 616 | AARCH64_OPND_SVE_ADDR_RI_S4x32, /* SVE [<Xn|SP>, #<simm4>*32]. */ |
98907a70 RS |
617 | AARCH64_OPND_SVE_ADDR_RI_S4xVL, /* SVE [<Xn|SP>, #<simm4>, MUL VL]. */ |
618 | AARCH64_OPND_SVE_ADDR_RI_S4x2xVL, /* SVE [<Xn|SP>, #<simm4>*2, MUL VL]. */ | |
619 | AARCH64_OPND_SVE_ADDR_RI_S4x3xVL, /* SVE [<Xn|SP>, #<simm4>*3, MUL VL]. */ | |
620 | AARCH64_OPND_SVE_ADDR_RI_S4x4xVL, /* SVE [<Xn|SP>, #<simm4>*4, MUL VL]. */ | |
621 | AARCH64_OPND_SVE_ADDR_RI_S6xVL, /* SVE [<Xn|SP>, #<simm6>, MUL VL]. */ | |
622 | AARCH64_OPND_SVE_ADDR_RI_S9xVL, /* SVE [<Xn|SP>, #<simm9>, MUL VL]. */ | |
4df068de RS |
623 | AARCH64_OPND_SVE_ADDR_RI_U6, /* SVE [<Xn|SP>, #<uimm6>]. */ |
624 | AARCH64_OPND_SVE_ADDR_RI_U6x2, /* SVE [<Xn|SP>, #<uimm6>*2]. */ | |
625 | AARCH64_OPND_SVE_ADDR_RI_U6x4, /* SVE [<Xn|SP>, #<uimm6>*4]. */ | |
626 | AARCH64_OPND_SVE_ADDR_RI_U6x8, /* SVE [<Xn|SP>, #<uimm6>*8]. */ | |
c8d59609 | 627 | AARCH64_OPND_SVE_ADDR_R, /* SVE [<Xn|SP>]. */ |
4df068de RS |
628 | AARCH64_OPND_SVE_ADDR_RR, /* SVE [<Xn|SP>, <Xm|XZR>]. */ |
629 | AARCH64_OPND_SVE_ADDR_RR_LSL1, /* SVE [<Xn|SP>, <Xm|XZR>, LSL #1]. */ | |
630 | AARCH64_OPND_SVE_ADDR_RR_LSL2, /* SVE [<Xn|SP>, <Xm|XZR>, LSL #2]. */ | |
631 | AARCH64_OPND_SVE_ADDR_RR_LSL3, /* SVE [<Xn|SP>, <Xm|XZR>, LSL #3]. */ | |
01a4d082 | 632 | AARCH64_OPND_SVE_ADDR_RR_LSL4, /* SVE [<Xn|SP>, <Xm|XZR>, LSL #4]. */ |
4df068de RS |
633 | AARCH64_OPND_SVE_ADDR_RX, /* SVE [<Xn|SP>, <Xm>]. */ |
634 | AARCH64_OPND_SVE_ADDR_RX_LSL1, /* SVE [<Xn|SP>, <Xm>, LSL #1]. */ | |
635 | AARCH64_OPND_SVE_ADDR_RX_LSL2, /* SVE [<Xn|SP>, <Xm>, LSL #2]. */ | |
636 | AARCH64_OPND_SVE_ADDR_RX_LSL3, /* SVE [<Xn|SP>, <Xm>, LSL #3]. */ | |
c469c864 | 637 | AARCH64_OPND_SVE_ADDR_ZX, /* SVE [Zn.<T>{, <Xm>}]. */ |
4df068de RS |
638 | AARCH64_OPND_SVE_ADDR_RZ, /* SVE [<Xn|SP>, Zm.D]. */ |
639 | AARCH64_OPND_SVE_ADDR_RZ_LSL1, /* SVE [<Xn|SP>, Zm.D, LSL #1]. */ | |
640 | AARCH64_OPND_SVE_ADDR_RZ_LSL2, /* SVE [<Xn|SP>, Zm.D, LSL #2]. */ | |
641 | AARCH64_OPND_SVE_ADDR_RZ_LSL3, /* SVE [<Xn|SP>, Zm.D, LSL #3]. */ | |
642 | AARCH64_OPND_SVE_ADDR_RZ_XTW_14, /* SVE [<Xn|SP>, Zm.<T>, (S|U)XTW]. | |
643 | Bit 14 controls S/U choice. */ | |
644 | AARCH64_OPND_SVE_ADDR_RZ_XTW_22, /* SVE [<Xn|SP>, Zm.<T>, (S|U)XTW]. | |
645 | Bit 22 controls S/U choice. */ | |
646 | AARCH64_OPND_SVE_ADDR_RZ_XTW1_14, /* SVE [<Xn|SP>, Zm.<T>, (S|U)XTW #1]. | |
647 | Bit 14 controls S/U choice. */ | |
648 | AARCH64_OPND_SVE_ADDR_RZ_XTW1_22, /* SVE [<Xn|SP>, Zm.<T>, (S|U)XTW #1]. | |
649 | Bit 22 controls S/U choice. */ | |
650 | AARCH64_OPND_SVE_ADDR_RZ_XTW2_14, /* SVE [<Xn|SP>, Zm.<T>, (S|U)XTW #2]. | |
651 | Bit 14 controls S/U choice. */ | |
652 | AARCH64_OPND_SVE_ADDR_RZ_XTW2_22, /* SVE [<Xn|SP>, Zm.<T>, (S|U)XTW #2]. | |
653 | Bit 22 controls S/U choice. */ | |
654 | AARCH64_OPND_SVE_ADDR_RZ_XTW3_14, /* SVE [<Xn|SP>, Zm.<T>, (S|U)XTW #3]. | |
655 | Bit 14 controls S/U choice. */ | |
656 | AARCH64_OPND_SVE_ADDR_RZ_XTW3_22, /* SVE [<Xn|SP>, Zm.<T>, (S|U)XTW #3]. | |
657 | Bit 22 controls S/U choice. */ | |
658 | AARCH64_OPND_SVE_ADDR_ZI_U5, /* SVE [Zn.<T>, #<uimm5>]. */ | |
659 | AARCH64_OPND_SVE_ADDR_ZI_U5x2, /* SVE [Zn.<T>, #<uimm5>*2]. */ | |
660 | AARCH64_OPND_SVE_ADDR_ZI_U5x4, /* SVE [Zn.<T>, #<uimm5>*4]. */ | |
661 | AARCH64_OPND_SVE_ADDR_ZI_U5x8, /* SVE [Zn.<T>, #<uimm5>*8]. */ | |
662 | AARCH64_OPND_SVE_ADDR_ZZ_LSL, /* SVE [Zn.<T>, Zm,<T>, LSL #<msz>]. */ | |
663 | AARCH64_OPND_SVE_ADDR_ZZ_SXTW, /* SVE [Zn.<T>, Zm,<T>, SXTW #<msz>]. */ | |
664 | AARCH64_OPND_SVE_ADDR_ZZ_UXTW, /* SVE [Zn.<T>, Zm,<T>, UXTW #<msz>]. */ | |
e950b345 RS |
665 | AARCH64_OPND_SVE_AIMM, /* SVE unsigned arithmetic immediate. */ |
666 | AARCH64_OPND_SVE_ASIMM, /* SVE signed arithmetic immediate. */ | |
165d4950 RS |
667 | AARCH64_OPND_SVE_FPIMM8, /* SVE 8-bit floating-point immediate. */ |
668 | AARCH64_OPND_SVE_I1_HALF_ONE, /* SVE choice between 0.5 and 1.0. */ | |
669 | AARCH64_OPND_SVE_I1_HALF_TWO, /* SVE choice between 0.5 and 2.0. */ | |
670 | AARCH64_OPND_SVE_I1_ZERO_ONE, /* SVE choice between 0.0 and 1.0. */ | |
582e12bf RS |
671 | AARCH64_OPND_SVE_IMM_ROT1, /* SVE 1-bit rotate operand (90 or 270). */ |
672 | AARCH64_OPND_SVE_IMM_ROT2, /* SVE 2-bit rotate operand (N*90). */ | |
adccc507 | 673 | AARCH64_OPND_SVE_IMM_ROT3, /* SVE cadd 1-bit rotate (90 or 270). */ |
e950b345 RS |
674 | AARCH64_OPND_SVE_INV_LIMM, /* SVE inverted logical immediate. */ |
675 | AARCH64_OPND_SVE_LIMM, /* SVE logical immediate. */ | |
676 | AARCH64_OPND_SVE_LIMM_MOV, /* SVE logical immediate for MOV. */ | |
245d2e3f | 677 | AARCH64_OPND_SVE_PATTERN, /* SVE vector pattern enumeration. */ |
2442d846 | 678 | AARCH64_OPND_SVE_PATTERN_SCALED, /* Likewise, with additional MUL factor. */ |
245d2e3f | 679 | AARCH64_OPND_SVE_PRFOP, /* SVE prefetch operation. */ |
f11ad6bc | 680 | AARCH64_OPND_SVE_Pd, /* SVE p0-p15 in Pd. */ |
503fae12 | 681 | AARCH64_OPND_SVE_PNd, /* SVE pn0-pn15 in Pd. */ |
f11ad6bc RS |
682 | AARCH64_OPND_SVE_Pg3, /* SVE p0-p7 in Pg. */ |
683 | AARCH64_OPND_SVE_Pg4_5, /* SVE p0-p15 in Pg, bits [8,5]. */ | |
684 | AARCH64_OPND_SVE_Pg4_10, /* SVE p0-p15 in Pg, bits [13,10]. */ | |
503fae12 | 685 | AARCH64_OPND_SVE_PNg4_10, /* SVE pn0-pn15 in Pg, bits [13,10]. */ |
f11ad6bc RS |
686 | AARCH64_OPND_SVE_Pg4_16, /* SVE p0-p15 in Pg, bits [19,16]. */ |
687 | AARCH64_OPND_SVE_Pm, /* SVE p0-p15 in Pm. */ | |
688 | AARCH64_OPND_SVE_Pn, /* SVE p0-p15 in Pn. */ | |
503fae12 | 689 | AARCH64_OPND_SVE_PNn, /* SVE pn0-pn15 in Pn. */ |
f11ad6bc | 690 | AARCH64_OPND_SVE_Pt, /* SVE p0-p15 in Pt. */ |
503fae12 | 691 | AARCH64_OPND_SVE_PNt, /* SVE pn0-pn15 in Pt. */ |
047cd301 RS |
692 | AARCH64_OPND_SVE_Rm, /* Integer Rm or ZR, alt. SVE position. */ |
693 | AARCH64_OPND_SVE_Rn_SP, /* Integer Rn or SP, alt. SVE position. */ | |
e950b345 RS |
694 | AARCH64_OPND_SVE_SHLIMM_PRED, /* SVE shift left amount (predicated). */ |
695 | AARCH64_OPND_SVE_SHLIMM_UNPRED, /* SVE shift left amount (unpredicated). */ | |
28ed815a | 696 | AARCH64_OPND_SVE_SHLIMM_UNPRED_22, /* SVE 3 bit shift left unpred. */ |
e950b345 RS |
697 | AARCH64_OPND_SVE_SHRIMM_PRED, /* SVE shift right amount (predicated). */ |
698 | AARCH64_OPND_SVE_SHRIMM_UNPRED, /* SVE shift right amount (unpredicated). */ | |
3c17238b | 699 | AARCH64_OPND_SVE_SHRIMM_UNPRED_22, /* SVE 3 bit shift right unpred. */ |
e950b345 RS |
700 | AARCH64_OPND_SVE_SIMM5, /* SVE signed 5-bit immediate. */ |
701 | AARCH64_OPND_SVE_SIMM5B, /* SVE secondary signed 5-bit immediate. */ | |
702 | AARCH64_OPND_SVE_SIMM6, /* SVE signed 6-bit immediate. */ | |
703 | AARCH64_OPND_SVE_SIMM8, /* SVE signed 8-bit immediate. */ | |
704 | AARCH64_OPND_SVE_UIMM3, /* SVE unsigned 3-bit immediate. */ | |
705 | AARCH64_OPND_SVE_UIMM7, /* SVE unsigned 7-bit immediate. */ | |
706 | AARCH64_OPND_SVE_UIMM8, /* SVE unsigned 8-bit immediate. */ | |
707 | AARCH64_OPND_SVE_UIMM8_53, /* SVE split unsigned 8-bit immediate. */ | |
047cd301 RS |
708 | AARCH64_OPND_SVE_VZn, /* Scalar SIMD&FP register in Zn field. */ |
709 | AARCH64_OPND_SVE_Vd, /* Scalar SIMD&FP register in Vd. */ | |
710 | AARCH64_OPND_SVE_Vm, /* Scalar SIMD&FP register in Vm. */ | |
711 | AARCH64_OPND_SVE_Vn, /* Scalar SIMD&FP register in Vn. */ | |
89e06ec1 SP |
712 | AARCH64_OPND_SME_ZA_array_vrsb_1, /* Tile to vector, two registers (B). */ |
713 | AARCH64_OPND_SME_ZA_array_vrsh_1, /* Tile to vector, two registers (H). */ | |
714 | AARCH64_OPND_SME_ZA_array_vrss_1, /* Tile to vector, two registers (S). */ | |
715 | AARCH64_OPND_SME_ZA_array_vrsd_1, /* Tile to vector, two registers (D). */ | |
716 | AARCH64_OPND_SME_ZA_array_vrsb_2, /* Tile to vector, four registers (B). */ | |
717 | AARCH64_OPND_SME_ZA_array_vrsh_2, /* Tile to vector, four registers (H). */ | |
718 | AARCH64_OPND_SME_ZA_array_vrss_2, /* Tile to vector, four registers (S). */ | |
719 | AARCH64_OPND_SME_ZA_array_vrsd_2, /* Tile to vector, four registers (D). */ | |
f11ad6bc RS |
720 | AARCH64_OPND_SVE_Za_5, /* SVE vector register in Za, bits [9,5]. */ |
721 | AARCH64_OPND_SVE_Za_16, /* SVE vector register in Za, bits [20,16]. */ | |
722 | AARCH64_OPND_SVE_Zd, /* SVE vector register in Zd. */ | |
723 | AARCH64_OPND_SVE_Zm_5, /* SVE vector register in Zm, bits [9,5]. */ | |
724 | AARCH64_OPND_SVE_Zm_16, /* SVE vector register in Zm, bits [20,16]. */ | |
582e12bf | 725 | AARCH64_OPND_SVE_Zm3_INDEX, /* z0-z7[0-3] in Zm, bits [20,16]. */ |
116adc27 | 726 | AARCH64_OPND_SVE_Zm3_11_INDEX, /* z0-z7[0-7] in Zm3_INDEX plus bit 11. */ |
dfc12f9f RS |
727 | AARCH64_OPND_SVE_Zm3_19_INDEX, /* z0-z7[0-3] in Zm3_INDEX plus bit 19. */ |
728 | AARCH64_OPND_SVE_Zm3_22_INDEX, /* z0-z7[0-7] in Zm3_INDEX plus bit 22. */ | |
31e36ab3 | 729 | AARCH64_OPND_SVE_Zm4_11_INDEX, /* z0-z15[0-3] in Zm plus bit 11. */ |
582e12bf | 730 | AARCH64_OPND_SVE_Zm4_INDEX, /* z0-z15[0-1] in Zm, bits [20,16]. */ |
f11ad6bc RS |
731 | AARCH64_OPND_SVE_Zn, /* SVE vector register in Zn. */ |
732 | AARCH64_OPND_SVE_Zn_INDEX, /* Indexed SVE vector register, for DUP. */ | |
733 | AARCH64_OPND_SVE_ZnxN, /* SVE vector register list in Zn. */ | |
734 | AARCH64_OPND_SVE_Zt, /* SVE vector register in Zt. */ | |
735 | AARCH64_OPND_SVE_ZtxN, /* SVE vector register list in Zt. */ | |
d8773a8a RS |
736 | AARCH64_OPND_SME_Zdnx2, /* SVE vector register list from [4:1]*2. */ |
737 | AARCH64_OPND_SME_Zdnx4, /* SVE vector register list from [4:2]*4. */ | |
e87ff672 | 738 | AARCH64_OPND_SME_Zm, /* SVE vector register list in 4-bit Zm. */ |
99e01a66 RS |
739 | AARCH64_OPND_SME_Zmx2, /* SVE vector register list from [20:17]*2. */ |
740 | AARCH64_OPND_SME_Zmx4, /* SVE vector register list from [20:18]*4. */ | |
d8773a8a RS |
741 | AARCH64_OPND_SME_Znx2, /* SVE vector register list from [9:6]*2. */ |
742 | AARCH64_OPND_SME_Znx4, /* SVE vector register list from [9:7]*4. */ | |
b408ebbf RS |
743 | AARCH64_OPND_SME_Ztx2_STRIDED, /* SVE vector register list in [4:0]&23. */ |
744 | AARCH64_OPND_SME_Ztx4_STRIDED, /* SVE vector register list in [4:0]&19. */ | |
971eda73 PW |
745 | AARCH64_OPND_SME_ZAda_2b, /* SME <ZAda>.S, 2-bits. */ |
746 | AARCH64_OPND_SME_ZAda_3b, /* SME <ZAda>.D, 3-bits. */ | |
7bb5f07c | 747 | AARCH64_OPND_SME_ZA_HV_idx_src, /* SME source ZA tile vector. */ |
d8773a8a | 748 | AARCH64_OPND_SME_ZA_HV_idx_srcxN, /* SME N source ZA tile vectors. */ |
7bb5f07c | 749 | AARCH64_OPND_SME_ZA_HV_idx_dest, /* SME destination ZA tile vector. */ |
d8773a8a | 750 | AARCH64_OPND_SME_ZA_HV_idx_destxN, /* SME N dest ZA tile vectors. */ |
99e01a66 RS |
751 | AARCH64_OPND_SME_Pdx2, /* Predicate register list in [3:1]. */ |
752 | AARCH64_OPND_SME_PdxN, /* Predicate register list in [3:0]. */ | |
971eda73 | 753 | AARCH64_OPND_SME_Pm, /* SME scalable predicate register, bits [15:13]. */ |
99e01a66 | 754 | AARCH64_OPND_SME_PNd3, /* Predicate-as-counter register, bits [3:0]. */ |
b408ebbf | 755 | AARCH64_OPND_SME_PNg3, /* Predicate-as-counter register, bits [12:10]. */ |
99e01a66 RS |
756 | AARCH64_OPND_SME_PNn, /* Predicate-as-counter register, bits [8:5]. */ |
757 | AARCH64_OPND_SME_PNn3_INDEX1, /* Indexed pred-as-counter reg, bits [8:5]. */ | |
758 | AARCH64_OPND_SME_PNn3_INDEX2, /* Indexed pred-as-counter reg, bits [9:5]. */ | |
1cad938d | 759 | AARCH64_OPND_SME_list_of_64bit_tiles, /* SME list of ZA tiles. */ |
90cd80f8 | 760 | AARCH64_OPND_SME_ZA_HV_idx_ldstr, /* SME destination ZA tile vector. */ |
a8cb21aa | 761 | AARCH64_OPND_SME_ZA_array_off1x4, /* SME ZA[<Wv>, #<imm1>*4:<imm1>*4+3]. */ |
ed429b33 | 762 | AARCH64_OPND_SME_ZA_array_off2x2, /* SME ZA[<Wv>, #<imm2>*2:<imm2>*2+1]. */ |
a8cb21aa | 763 | AARCH64_OPND_SME_ZA_array_off2x4, /* SME ZA[<Wv>, #<imm2>*4:<imm2>*4+3]. */ |
d8773a8a RS |
764 | AARCH64_OPND_SME_ZA_array_off3_0, /* SME ZA[<Wv>{, #<imm3>}]. */ |
765 | AARCH64_OPND_SME_ZA_array_off3_5, /* SME ZA[<Wv>{, #<imm3>}]. */ | |
ed429b33 | 766 | AARCH64_OPND_SME_ZA_array_off3x2, /* SME ZA[<Wv>, #<imm3>*2:<imm3>*2+1]. */ |
90cd80f8 | 767 | AARCH64_OPND_SME_ZA_array_off4, /* SME ZA[<Wv>{, #<imm>}]. */ |
01a4d082 | 768 | AARCH64_OPND_SME_ADDR_RI_U4xVL, /* SME [<Xn|SP>{, #<imm>, MUL VL}]. */ |
3dd032c5 | 769 | AARCH64_OPND_SME_SM_ZA, /* SME {SM | ZA}. */ |
90cd80f8 | 770 | AARCH64_OPND_SME_PnT_Wm_imm, /* SME <Pn>.<T>[<Wm>, #<imm>]. */ |
6efa6601 RS |
771 | AARCH64_OPND_SME_SHRIMM4, /* 4-bit right shift, bits [19:16]. */ |
772 | AARCH64_OPND_SME_SHRIMM5, /* size + 5-bit right shift, bits [23:22,20:16]. */ | |
80752eb0 RS |
773 | AARCH64_OPND_SME_Zm_INDEX1, /* Zn.T[index], bits [19:16,10]. */ |
774 | AARCH64_OPND_SME_Zm_INDEX2, /* Zn.T[index], bits [19:16,11:10]. */ | |
a8cb21aa | 775 | AARCH64_OPND_SME_Zm_INDEX3_1, /* Zn.T[index], bits [19:16,10,2:1]. */ |
ed429b33 RS |
776 | AARCH64_OPND_SME_Zm_INDEX3_2, /* Zn.T[index], bits [19:16,11:10,2]. */ |
777 | AARCH64_OPND_SME_Zm_INDEX3_10, /* Zn.T[index], bits [19:16,15,11:10]. */ | |
a8cb21aa RS |
778 | AARCH64_OPND_SME_Zm_INDEX4_1, /* Zn.T[index], bits [19:16,11:10,2:1]. */ |
779 | AARCH64_OPND_SME_Zm_INDEX4_10, /* Zn.T[index], bits [19:16,15,12:10]. */ | |
cbd11b88 RS |
780 | AARCH64_OPND_SME_Zn_INDEX1_16, /* Zn[index], bits [9:5] and [16:16]. */ |
781 | AARCH64_OPND_SME_Zn_INDEX2_15, /* Zn[index], bits [9:5] and [16:15]. */ | |
782 | AARCH64_OPND_SME_Zn_INDEX2_16, /* Zn[index], bits [9:5] and [17:16]. */ | |
783 | AARCH64_OPND_SME_Zn_INDEX3_14, /* Zn[index], bits [9:5] and [16:14]. */ | |
784 | AARCH64_OPND_SME_Zn_INDEX3_15, /* Zn[index], bits [9:5] and [17:15]. */ | |
785 | AARCH64_OPND_SME_Zn_INDEX4_14, /* Zn[index], bits [9:5] and [17:14]. */ | |
99e01a66 RS |
786 | AARCH64_OPND_SME_VLxN_10, /* VLx2 or VLx4, in bit 10. */ |
787 | AARCH64_OPND_SME_VLxN_13, /* VLx2 or VLx4, in bit 13. */ | |
cbd11b88 RS |
788 | AARCH64_OPND_SME_ZT0, /* The fixed token zt0/ZT0 (not encoded). */ |
789 | AARCH64_OPND_SME_ZT0_INDEX, /* ZT0[<imm>], bits [14:12]. */ | |
790 | AARCH64_OPND_SME_ZT0_LIST, /* { zt0/ZT0 } (not encoded). */ | |
b83b4b13 | 791 | AARCH64_OPND_TME_UIMM16, /* TME unsigned 16-bit immediate. */ |
f42f1a1d | 792 | AARCH64_OPND_SM3_IMM2, /* SM3 encodes lane in bits [13, 14]. */ |
6327658e RS |
793 | AARCH64_OPND_MOPS_ADDR_Rd, /* [Rd]!, in bits [0, 4]. */ |
794 | AARCH64_OPND_MOPS_ADDR_Rs, /* [Rs]!, in bits [16, 20]. */ | |
1f7b42d5 AV |
795 | AARCH64_OPND_MOPS_WB_Rn, /* Rn!, in bits [5, 9]. */ |
796 | AARCH64_OPND_CSSC_SIMM8, /* CSSC signed 8-bit immediate. */ | |
797 | AARCH64_OPND_CSSC_UIMM8, /* CSSC unsigned 8-bit immediate. */ | |
a06ea964 NC |
798 | }; |
799 | ||
800 | /* Qualifier constrains an operand. It either specifies a variant of an | |
801 | operand type or limits values available to an operand type. | |
802 | ||
803 | N.B. Order is important; keep aarch64_opnd_qualifiers synced. */ | |
804 | ||
805 | enum aarch64_opnd_qualifier | |
806 | { | |
807 | /* Indicating no further qualification on an operand. */ | |
808 | AARCH64_OPND_QLF_NIL, | |
809 | ||
810 | /* Qualifying an operand which is a general purpose (integer) register; | |
811 | indicating the operand data size or a specific register. */ | |
812 | AARCH64_OPND_QLF_W, /* Wn, WZR or WSP. */ | |
813 | AARCH64_OPND_QLF_X, /* Xn, XZR or XSP. */ | |
814 | AARCH64_OPND_QLF_WSP, /* WSP. */ | |
815 | AARCH64_OPND_QLF_SP, /* SP. */ | |
816 | ||
817 | /* Qualifying an operand which is a floating-point register, a SIMD | |
818 | vector element or a SIMD vector element list; indicating operand data | |
819 | size or the size of each SIMD vector element in the case of a SIMD | |
820 | vector element list. | |
821 | These qualifiers are also used to qualify an address operand to | |
822 | indicate the size of data element a load/store instruction is | |
823 | accessing. | |
824 | They are also used for the immediate shift operand in e.g. SSHR. Such | |
825 | a use is only for the ease of operand encoding/decoding and qualifier | |
826 | sequence matching; such a use should not be applied widely; use the value | |
827 | constraint qualifiers for immediate operands wherever possible. */ | |
828 | AARCH64_OPND_QLF_S_B, | |
829 | AARCH64_OPND_QLF_S_H, | |
830 | AARCH64_OPND_QLF_S_S, | |
831 | AARCH64_OPND_QLF_S_D, | |
832 | AARCH64_OPND_QLF_S_Q, | |
df678013 MM |
833 | /* These type qualifiers have a special meaning in that they mean 4 x 1 byte |
834 | or 2 x 2 byte are selected by the instruction. Other than that they have | |
835 | no difference with AARCH64_OPND_QLF_S_B in encoding. They are here purely | |
836 | for syntactical reasons and is an exception from normal AArch64 | |
837 | disassembly scheme. */ | |
00c2093f | 838 | AARCH64_OPND_QLF_S_4B, |
df678013 | 839 | AARCH64_OPND_QLF_S_2H, |
a06ea964 NC |
840 | |
841 | /* Qualifying an operand which is a SIMD vector register or a SIMD vector | |
842 | register list; indicating register shape. | |
843 | They are also used for the immediate shift operand in e.g. SSHR. Such | |
844 | a use is only for the ease of operand encoding/decoding and qualifier | |
845 | sequence matching; such a use should not be applied widely; use the value | |
846 | constraint qualifiers for immediate operands wherever possible. */ | |
a3b3345a | 847 | AARCH64_OPND_QLF_V_4B, |
a06ea964 NC |
848 | AARCH64_OPND_QLF_V_8B, |
849 | AARCH64_OPND_QLF_V_16B, | |
3067d3b9 | 850 | AARCH64_OPND_QLF_V_2H, |
a06ea964 NC |
851 | AARCH64_OPND_QLF_V_4H, |
852 | AARCH64_OPND_QLF_V_8H, | |
853 | AARCH64_OPND_QLF_V_2S, | |
854 | AARCH64_OPND_QLF_V_4S, | |
855 | AARCH64_OPND_QLF_V_1D, | |
856 | AARCH64_OPND_QLF_V_2D, | |
857 | AARCH64_OPND_QLF_V_1Q, | |
858 | ||
d50c751e RS |
859 | AARCH64_OPND_QLF_P_Z, |
860 | AARCH64_OPND_QLF_P_M, | |
fb3265b3 SD |
861 | |
862 | /* Used in scaled signed immediate that are scaled by a Tag granule | |
863 | like in stg, st2g, etc. */ | |
864 | AARCH64_OPND_QLF_imm_tag, | |
d50c751e | 865 | |
a06ea964 | 866 | /* Constraint on value. */ |
a6a51754 | 867 | AARCH64_OPND_QLF_CR, /* CRn, CRm. */ |
a06ea964 NC |
868 | AARCH64_OPND_QLF_imm_0_7, |
869 | AARCH64_OPND_QLF_imm_0_15, | |
870 | AARCH64_OPND_QLF_imm_0_31, | |
871 | AARCH64_OPND_QLF_imm_0_63, | |
872 | AARCH64_OPND_QLF_imm_1_32, | |
873 | AARCH64_OPND_QLF_imm_1_64, | |
874 | ||
875 | /* Indicate whether an AdvSIMD modified immediate operand is shift-zeros | |
876 | or shift-ones. */ | |
877 | AARCH64_OPND_QLF_LSL, | |
878 | AARCH64_OPND_QLF_MSL, | |
879 | ||
880 | /* Special qualifier helping retrieve qualifier information during the | |
881 | decoding time (currently not in use). */ | |
882 | AARCH64_OPND_QLF_RETRIEVE, | |
883 | }; | |
884 | \f | |
885 | /* Instruction class. */ | |
886 | ||
887 | enum aarch64_insn_class | |
888 | { | |
8382113f | 889 | aarch64_misc, |
a06ea964 NC |
890 | addsub_carry, |
891 | addsub_ext, | |
892 | addsub_imm, | |
893 | addsub_shift, | |
894 | asimdall, | |
895 | asimddiff, | |
896 | asimdelem, | |
897 | asimdext, | |
898 | asimdimm, | |
899 | asimdins, | |
900 | asimdmisc, | |
901 | asimdperm, | |
902 | asimdsame, | |
903 | asimdshf, | |
904 | asimdtbl, | |
905 | asisddiff, | |
906 | asisdelem, | |
907 | asisdlse, | |
908 | asisdlsep, | |
909 | asisdlso, | |
910 | asisdlsop, | |
911 | asisdmisc, | |
912 | asisdone, | |
913 | asisdpair, | |
914 | asisdsame, | |
915 | asisdshf, | |
916 | bitfield, | |
917 | branch_imm, | |
918 | branch_reg, | |
919 | compbranch, | |
920 | condbranch, | |
921 | condcmp_imm, | |
922 | condcmp_reg, | |
923 | condsel, | |
924 | cryptoaes, | |
925 | cryptosha2, | |
926 | cryptosha3, | |
927 | dp_1src, | |
928 | dp_2src, | |
929 | dp_3src, | |
930 | exception, | |
931 | extract, | |
932 | float2fix, | |
933 | float2int, | |
934 | floatccmp, | |
935 | floatcmp, | |
936 | floatdp1, | |
937 | floatdp2, | |
938 | floatdp3, | |
939 | floatimm, | |
940 | floatsel, | |
941 | ldst_immpost, | |
942 | ldst_immpre, | |
943 | ldst_imm9, /* immpost or immpre */ | |
3f06e550 | 944 | ldst_imm10, /* LDRAA/LDRAB */ |
a06ea964 NC |
945 | ldst_pos, |
946 | ldst_regoff, | |
947 | ldst_unpriv, | |
948 | ldst_unscaled, | |
949 | ldstexcl, | |
950 | ldstnapair_offs, | |
951 | ldstpair_off, | |
952 | ldstpair_indexed, | |
953 | loadlit, | |
954 | log_imm, | |
955 | log_shift, | |
ee804238 | 956 | lse_atomic, |
f0d70d8e | 957 | lse128_atomic, |
a06ea964 NC |
958 | movewide, |
959 | pcreladdr, | |
960 | ic_system, | |
e87ff672 RS |
961 | sme_fp_sd, |
962 | sme_int_sd, | |
971eda73 | 963 | sme_misc, |
a5791d58 | 964 | sme_mov, |
01a4d082 | 965 | sme_ldr, |
a5791d58 | 966 | sme_psel, |
6efa6601 | 967 | sme_shift, |
cbd11b88 RS |
968 | sme_size_12_bhs, |
969 | sme_size_12_hs, | |
d8773a8a | 970 | sme_size_22, |
27f6a0bd | 971 | sme_size_22_hsd, |
ce623e7a | 972 | sme_sz_23, |
01a4d082 | 973 | sme_str, |
3dd032c5 PW |
974 | sme_start, |
975 | sme_stop, | |
d8773a8a | 976 | sme2_mov, |
89e06ec1 | 977 | sme2_movaz, |
116b6019 RS |
978 | sve_cpy, |
979 | sve_index, | |
980 | sve_limm, | |
981 | sve_misc, | |
982 | sve_movprfx, | |
983 | sve_pred_zm, | |
984 | sve_shift_pred, | |
985 | sve_shift_unpred, | |
986 | sve_size_bhs, | |
987 | sve_size_bhsd, | |
988 | sve_size_hsd, | |
3bd82c86 | 989 | sve_size_hsd2, |
116b6019 | 990 | sve_size_sd, |
3c705960 | 991 | sve_size_bh, |
0a57e14f | 992 | sve_size_sd2, |
41be57ca | 993 | sve_size_13, |
3c17238b | 994 | sve_shift_tsz_hsd, |
1be5f94f | 995 | sve_shift_tsz_bhsd, |
fd1dc4a0 | 996 | sve_size_tsz_bhs, |
a06ea964 | 997 | testbranch, |
f42f1a1d TC |
998 | cryptosm3, |
999 | cryptosm4, | |
65a55fbb | 1000 | dotproduct, |
df678013 | 1001 | bfloat16, |
1f7b42d5 | 1002 | cssc, |
f985c251 | 1003 | gcs, |
e318eb09 | 1004 | the, |
88601c2d | 1005 | sve2_urqvs |
a06ea964 NC |
1006 | }; |
1007 | ||
1008 | /* Opcode enumerators. */ | |
1009 | ||
1010 | enum aarch64_op | |
1011 | { | |
1012 | OP_NIL, | |
1013 | OP_STRB_POS, | |
1014 | OP_LDRB_POS, | |
1015 | OP_LDRSB_POS, | |
1016 | OP_STRH_POS, | |
1017 | OP_LDRH_POS, | |
1018 | OP_LDRSH_POS, | |
1019 | OP_STR_POS, | |
1020 | OP_LDR_POS, | |
1021 | OP_STRF_POS, | |
1022 | OP_LDRF_POS, | |
1023 | OP_LDRSW_POS, | |
1024 | OP_PRFM_POS, | |
1025 | ||
1026 | OP_STURB, | |
1027 | OP_LDURB, | |
1028 | OP_LDURSB, | |
1029 | OP_STURH, | |
1030 | OP_LDURH, | |
1031 | OP_LDURSH, | |
1032 | OP_STUR, | |
1033 | OP_LDUR, | |
1034 | OP_STURV, | |
1035 | OP_LDURV, | |
1036 | OP_LDURSW, | |
1037 | OP_PRFUM, | |
1038 | ||
1039 | OP_LDR_LIT, | |
1040 | OP_LDRV_LIT, | |
1041 | OP_LDRSW_LIT, | |
1042 | OP_PRFM_LIT, | |
1043 | ||
1044 | OP_ADD, | |
1045 | OP_B, | |
1046 | OP_BL, | |
1047 | ||
1048 | OP_MOVN, | |
1049 | OP_MOVZ, | |
1050 | OP_MOVK, | |
1051 | ||
1052 | OP_MOV_IMM_LOG, /* MOV alias for moving bitmask immediate. */ | |
1053 | OP_MOV_IMM_WIDE, /* MOV alias for moving wide immediate. */ | |
1054 | OP_MOV_IMM_WIDEN, /* MOV alias for moving wide immediate (negated). */ | |
1055 | ||
1056 | OP_MOV_V, /* MOV alias for moving vector register. */ | |
1057 | ||
1058 | OP_ASR_IMM, | |
1059 | OP_LSR_IMM, | |
1060 | OP_LSL_IMM, | |
1061 | ||
1062 | OP_BIC, | |
1063 | ||
1064 | OP_UBFX, | |
1065 | OP_BFXIL, | |
1066 | OP_SBFX, | |
1067 | OP_SBFIZ, | |
1068 | OP_BFI, | |
d685192a | 1069 | OP_BFC, /* ARMv8.2. */ |
a06ea964 NC |
1070 | OP_UBFIZ, |
1071 | OP_UXTB, | |
1072 | OP_UXTH, | |
1073 | OP_UXTW, | |
1074 | ||
a06ea964 NC |
1075 | OP_CINC, |
1076 | OP_CINV, | |
1077 | OP_CNEG, | |
1078 | OP_CSET, | |
1079 | OP_CSETM, | |
1080 | ||
1081 | OP_FCVT, | |
1082 | OP_FCVTN, | |
1083 | OP_FCVTN2, | |
1084 | OP_FCVTL, | |
1085 | OP_FCVTL2, | |
1086 | OP_FCVTXN_S, /* Scalar version. */ | |
1087 | ||
1088 | OP_ROR_IMM, | |
1089 | ||
e30181a5 YZ |
1090 | OP_SXTL, |
1091 | OP_SXTL2, | |
1092 | OP_UXTL, | |
1093 | OP_UXTL2, | |
1094 | ||
c0890d26 | 1095 | OP_MOV_P_P, |
503fae12 | 1096 | OP_MOV_PN_PN, |
c0890d26 RS |
1097 | OP_MOV_Z_P_Z, |
1098 | OP_MOV_Z_V, | |
1099 | OP_MOV_Z_Z, | |
1100 | OP_MOV_Z_Zi, | |
1101 | OP_MOVM_P_P_P, | |
1102 | OP_MOVS_P_P, | |
1103 | OP_MOVZS_P_P_P, | |
1104 | OP_MOVZ_P_P_P, | |
1105 | OP_NOTS_P_P_P_Z, | |
1106 | OP_NOT_P_P_P_Z, | |
1107 | ||
c2c4ff8d SN |
1108 | OP_FCMLA_ELEM, /* ARMv8.3, indexed element version. */ |
1109 | ||
a06ea964 NC |
1110 | OP_TOTAL_NUM, /* Pseudo. */ |
1111 | }; | |
1112 | ||
1d482394 TC |
1113 | /* Error types. */ |
1114 | enum err_type | |
1115 | { | |
1116 | ERR_OK, | |
1117 | ERR_UND, | |
1118 | ERR_UNP, | |
1119 | ERR_NYI, | |
a68f4cd2 | 1120 | ERR_VFI, |
1d482394 TC |
1121 | ERR_NR_ENTRIES |
1122 | }; | |
1123 | ||
a06ea964 | 1124 | /* Maximum number of operands an instruction can have. */ |
2ec6065a | 1125 | #define AARCH64_MAX_OPND_NUM 7 |
a06ea964 NC |
1126 | /* Maximum number of qualifier sequences an instruction can have. */ |
1127 | #define AARCH64_MAX_QLF_SEQ_NUM 10 | |
1128 | /* Operand qualifier typedef; optimized for the size. */ | |
1129 | typedef unsigned char aarch64_opnd_qualifier_t; | |
1130 | /* Operand qualifier sequence typedef. */ | |
1131 | typedef aarch64_opnd_qualifier_t \ | |
1132 | aarch64_opnd_qualifier_seq_t [AARCH64_MAX_OPND_NUM]; | |
1133 | ||
1134 | /* FIXME: improve the efficiency. */ | |
9193bc42 | 1135 | static inline bool |
a06ea964 NC |
1136 | empty_qualifier_sequence_p (const aarch64_opnd_qualifier_t *qualifiers) |
1137 | { | |
1138 | int i; | |
1139 | for (i = 0; i < AARCH64_MAX_OPND_NUM; ++i) | |
1140 | if (qualifiers[i] != AARCH64_OPND_QLF_NIL) | |
9193bc42 AM |
1141 | return false; |
1142 | return true; | |
a06ea964 NC |
1143 | } |
1144 | ||
7e84b55d TC |
1145 | /* Forward declare error reporting type. */ |
1146 | typedef struct aarch64_operand_error aarch64_operand_error; | |
1147 | /* Forward declare instruction sequence type. */ | |
1148 | typedef struct aarch64_instr_sequence aarch64_instr_sequence; | |
1149 | /* Forward declare instruction definition. */ | |
1150 | typedef struct aarch64_inst aarch64_inst; | |
1151 | ||
a06ea964 NC |
1152 | /* This structure holds information for a particular opcode. */ |
1153 | ||
1154 | struct aarch64_opcode | |
1155 | { | |
1156 | /* The name of the mnemonic. */ | |
1157 | const char *name; | |
1158 | ||
1159 | /* The opcode itself. Those bits which will be filled in with | |
1160 | operands are zeroes. */ | |
1161 | aarch64_insn opcode; | |
1162 | ||
1163 | /* The opcode mask. This is used by the disassembler. This is a | |
1164 | mask containing ones indicating those bits which must match the | |
1165 | opcode field, and zeroes indicating those bits which need not | |
1166 | match (and are presumably filled in by operands). */ | |
1167 | aarch64_insn mask; | |
1168 | ||
1169 | /* Instruction class. */ | |
1170 | enum aarch64_insn_class iclass; | |
1171 | ||
1172 | /* Enumerator identifier. */ | |
1173 | enum aarch64_op op; | |
1174 | ||
1175 | /* Which architecture variant provides this instruction. */ | |
1176 | const aarch64_feature_set *avariant; | |
1177 | ||
1178 | /* An array of operand codes. Each code is an index into the | |
1179 | operand table. They appear in the order which the operands must | |
1180 | appear in assembly code, and are terminated by a zero. */ | |
1181 | enum aarch64_opnd operands[AARCH64_MAX_OPND_NUM]; | |
1182 | ||
1183 | /* A list of operand qualifier code sequence. Each operand qualifier | |
1184 | code qualifies the corresponding operand code. Each operand | |
1185 | qualifier sequence specifies a valid opcode variant and related | |
1186 | constraint on operands. */ | |
1187 | aarch64_opnd_qualifier_seq_t qualifiers_list[AARCH64_MAX_QLF_SEQ_NUM]; | |
1188 | ||
1189 | /* Flags providing information about this instruction */ | |
eae424ae TC |
1190 | uint64_t flags; |
1191 | ||
1192 | /* Extra constraints on the instruction that the verifier checks. */ | |
1193 | uint32_t constraints; | |
4bd13cde | 1194 | |
0c608d6b RS |
1195 | /* If nonzero, this operand and operand 0 are both registers and |
1196 | are required to have the same register number. */ | |
1197 | unsigned char tied_operand; | |
1198 | ||
4bd13cde | 1199 | /* If non-NULL, a function to verify that a given instruction is valid. */ |
755b748f | 1200 | enum err_type (* verifier) (const struct aarch64_inst *, const aarch64_insn, |
9193bc42 | 1201 | bfd_vma, bool, aarch64_operand_error *, |
755b748f | 1202 | struct aarch64_instr_sequence *); |
a06ea964 NC |
1203 | }; |
1204 | ||
1205 | typedef struct aarch64_opcode aarch64_opcode; | |
1206 | ||
1207 | /* Table describing all the AArch64 opcodes. */ | |
6c2ede01 | 1208 | extern const aarch64_opcode aarch64_opcode_table[]; |
a06ea964 NC |
1209 | |
1210 | /* Opcode flags. */ | |
1211 | #define F_ALIAS (1 << 0) | |
1212 | #define F_HAS_ALIAS (1 << 1) | |
1213 | /* Disassembly preference priority 1-3 (the larger the higher). If nothing | |
1214 | is specified, it is the priority 0 by default, i.e. the lowest priority. */ | |
1215 | #define F_P1 (1 << 2) | |
1216 | #define F_P2 (2 << 2) | |
1217 | #define F_P3 (3 << 2) | |
1218 | /* Flag an instruction that is truly conditional executed, e.g. b.cond. */ | |
1219 | #define F_COND (1 << 4) | |
1220 | /* Instruction has the field of 'sf'. */ | |
1221 | #define F_SF (1 << 5) | |
1222 | /* Instruction has the field of 'size:Q'. */ | |
1223 | #define F_SIZEQ (1 << 6) | |
1224 | /* Floating-point instruction has the field of 'type'. */ | |
1225 | #define F_FPTYPE (1 << 7) | |
1226 | /* AdvSIMD scalar instruction has the field of 'size'. */ | |
1227 | #define F_SSIZE (1 << 8) | |
1228 | /* AdvSIMD vector register arrangement specifier encoded in "imm5<3:0>:Q". */ | |
1229 | #define F_T (1 << 9) | |
1230 | /* Size of GPR operand in AdvSIMD instructions encoded in Q. */ | |
1231 | #define F_GPRSIZE_IN_Q (1 << 10) | |
1232 | /* Size of Rt load signed instruction encoded in opc[0], i.e. bit 22. */ | |
1233 | #define F_LDS_SIZE (1 << 11) | |
1234 | /* Optional operand; assume maximum of 1 operand can be optional. */ | |
1235 | #define F_OPD0_OPT (1 << 12) | |
1236 | #define F_OPD1_OPT (2 << 12) | |
1237 | #define F_OPD2_OPT (3 << 12) | |
1238 | #define F_OPD3_OPT (4 << 12) | |
1239 | #define F_OPD4_OPT (5 << 12) | |
1240 | /* Default value for the optional operand when omitted from the assembly. */ | |
1241 | #define F_DEFAULT(X) (((X) & 0x1f) << 15) | |
1242 | /* Instruction that is an alias of another instruction needs to be | |
1243 | encoded/decoded by converting it to/from the real form, followed by | |
1244 | the encoding/decoding according to the rules of the real opcode. | |
1245 | This compares to the direct coding using the alias's information. | |
1246 | N.B. this flag requires F_ALIAS to be used together. */ | |
1247 | #define F_CONV (1 << 20) | |
1248 | /* Use together with F_ALIAS to indicate an alias opcode is a programmer | |
1249 | friendly pseudo instruction available only in the assembly code (thus will | |
1250 | not show up in the disassembly). */ | |
1251 | #define F_PSEUDO (1 << 21) | |
1252 | /* Instruction has miscellaneous encoding/decoding rules. */ | |
1253 | #define F_MISC (1 << 22) | |
1254 | /* Instruction has the field of 'N'; used in conjunction with F_SF. */ | |
1255 | #define F_N (1 << 23) | |
1256 | /* Opcode dependent field. */ | |
1257 | #define F_OD(X) (((X) & 0x7) << 24) | |
ee804238 JW |
1258 | /* Instruction has the field of 'sz'. */ |
1259 | #define F_LSE_SZ (1 << 27) | |
4989adac RS |
1260 | /* Require an exact qualifier match, even for NIL qualifiers. */ |
1261 | #define F_STRICT (1ULL << 28) | |
f9830ec1 TC |
1262 | /* This system instruction is used to read system registers. */ |
1263 | #define F_SYS_READ (1ULL << 29) | |
1264 | /* This system instruction is used to write system registers. */ | |
1265 | #define F_SYS_WRITE (1ULL << 30) | |
eae424ae TC |
1266 | /* This instruction has an extra constraint on it that imposes a requirement on |
1267 | subsequent instructions. */ | |
1268 | #define F_SCAN (1ULL << 31) | |
f89c290e VDN |
1269 | /* Instruction takes a pair of optional operands. If we specify the Nth operand |
1270 | to be optional, then we also implicitly specify (N+1)th operand to also be | |
1271 | optional. */ | |
1272 | #define F_OPD_PAIR_OPT (1ULL << 32) | |
5517af82 VDN |
1273 | /* This instruction does not allow the full range of values that the |
1274 | width of fields in the assembler instruction would theoretically | |
1275 | allow. This impacts the constraintts on assembly but yelds no | |
1276 | impact on disassembly. */ | |
1277 | #define F_OPD_NARROW (1ULL << 33) | |
88601c2d SP |
1278 | /* For the instruction with size[22:23] field. */ |
1279 | #define F_OPD_SIZE (1ULL << 34) | |
1280 | /* Next bit is 35. */ | |
eae424ae TC |
1281 | |
1282 | /* Instruction constraints. */ | |
1283 | /* This instruction has a predication constraint on the instruction at PC+4. */ | |
1284 | #define C_SCAN_MOVPRFX (1U << 0) | |
1285 | /* This instruction's operation width is determined by the operand with the | |
1286 | largest element size. */ | |
1287 | #define C_MAX_ELEM (1U << 1) | |
63eff947 RS |
1288 | #define C_SCAN_MOPS_P (1U << 2) |
1289 | #define C_SCAN_MOPS_M (2U << 2) | |
1290 | #define C_SCAN_MOPS_E (3U << 2) | |
1291 | #define C_SCAN_MOPS_PME (3U << 2) | |
1292 | /* Next bit is 4. */ | |
a06ea964 | 1293 | |
9193bc42 | 1294 | static inline bool |
a06ea964 NC |
1295 | alias_opcode_p (const aarch64_opcode *opcode) |
1296 | { | |
63b4cc53 | 1297 | return (opcode->flags & F_ALIAS) != 0; |
a06ea964 NC |
1298 | } |
1299 | ||
9193bc42 | 1300 | static inline bool |
a06ea964 NC |
1301 | opcode_has_alias (const aarch64_opcode *opcode) |
1302 | { | |
63b4cc53 | 1303 | return (opcode->flags & F_HAS_ALIAS) != 0; |
a06ea964 NC |
1304 | } |
1305 | ||
1306 | /* Priority for disassembling preference. */ | |
1307 | static inline int | |
1308 | opcode_priority (const aarch64_opcode *opcode) | |
1309 | { | |
1310 | return (opcode->flags >> 2) & 0x3; | |
1311 | } | |
1312 | ||
9193bc42 | 1313 | static inline bool |
a06ea964 NC |
1314 | pseudo_opcode_p (const aarch64_opcode *opcode) |
1315 | { | |
63b4cc53 | 1316 | return (opcode->flags & F_PSEUDO) != 0lu; |
a06ea964 NC |
1317 | } |
1318 | ||
f89c290e VDN |
1319 | /* Deal with two possible scenarios: If F_OP_PAIR_OPT not set, as is the case |
1320 | by default, F_OPDn_OPT must equal IDX + 1, else F_OPDn_OPT must be in range | |
1321 | [IDX, IDX + 1]. */ | |
9193bc42 | 1322 | static inline bool |
a06ea964 NC |
1323 | optional_operand_p (const aarch64_opcode *opcode, unsigned int idx) |
1324 | { | |
f89c290e VDN |
1325 | if (opcode->flags & F_OPD_PAIR_OPT) |
1326 | return (((opcode->flags >> 12) & 0x7) == idx | |
1327 | || ((opcode->flags >> 12) & 0x7) == idx + 1); | |
63b4cc53 | 1328 | return ((opcode->flags >> 12) & 0x7) == idx + 1; |
a06ea964 NC |
1329 | } |
1330 | ||
1331 | static inline aarch64_insn | |
1332 | get_optional_operand_default_value (const aarch64_opcode *opcode) | |
1333 | { | |
1334 | return (opcode->flags >> 15) & 0x1f; | |
1335 | } | |
1336 | ||
1337 | static inline unsigned int | |
1338 | get_opcode_dependent_value (const aarch64_opcode *opcode) | |
1339 | { | |
1340 | return (opcode->flags >> 24) & 0x7; | |
1341 | } | |
1342 | ||
9193bc42 | 1343 | static inline bool |
a06ea964 NC |
1344 | opcode_has_special_coder (const aarch64_opcode *opcode) |
1345 | { | |
ee804238 | 1346 | return (opcode->flags & (F_SF | F_LSE_SZ | F_SIZEQ | F_FPTYPE | F_SSIZE | F_T |
88601c2d SP |
1347 | | F_GPRSIZE_IN_Q | F_LDS_SIZE | F_MISC | F_N | F_COND |
1348 | | F_OPD_SIZE)) != 0; | |
a06ea964 NC |
1349 | } |
1350 | \f | |
1351 | struct aarch64_name_value_pair | |
1352 | { | |
1353 | const char * name; | |
1354 | aarch64_insn value; | |
1355 | }; | |
1356 | ||
1357 | extern const struct aarch64_name_value_pair aarch64_operand_modifiers []; | |
a06ea964 | 1358 | extern const struct aarch64_name_value_pair aarch64_barrier_options [16]; |
fd195909 | 1359 | extern const struct aarch64_name_value_pair aarch64_barrier_dsb_nxs_options [4]; |
a06ea964 | 1360 | extern const struct aarch64_name_value_pair aarch64_prfops [32]; |
9ed608f9 | 1361 | extern const struct aarch64_name_value_pair aarch64_hint_options []; |
a06ea964 | 1362 | |
fa63795f AC |
1363 | #define AARCH64_MAX_SYSREG_NAME_LEN 32 |
1364 | ||
49eec193 YZ |
1365 | typedef struct |
1366 | { | |
1367 | const char * name; | |
1368 | aarch64_insn value; | |
1369 | uint32_t flags; | |
14962256 AC |
1370 | |
1371 | /* A set of features, all of which are required for this system register to be | |
1372 | available. */ | |
1373 | aarch64_feature_set features; | |
49eec193 YZ |
1374 | } aarch64_sys_reg; |
1375 | ||
1376 | extern const aarch64_sys_reg aarch64_sys_regs []; | |
87b8eed7 | 1377 | extern const aarch64_sys_reg aarch64_pstatefields []; |
9193bc42 | 1378 | extern bool aarch64_sys_reg_deprecated_p (const uint32_t); |
9af8f671 | 1379 | extern bool aarch64_sys_reg_128bit_p (const uint32_t); |
1bf6696b | 1380 | extern bool aarch64_sys_reg_alias_p (const uint32_t); |
9193bc42 AM |
1381 | extern bool aarch64_pstatefield_supported_p (const aarch64_feature_set, |
1382 | const aarch64_sys_reg *); | |
49eec193 | 1383 | |
a06ea964 NC |
1384 | typedef struct |
1385 | { | |
875880c6 | 1386 | const char *name; |
a06ea964 | 1387 | uint32_t value; |
ea2deeec | 1388 | uint32_t flags ; |
a06ea964 NC |
1389 | } aarch64_sys_ins_reg; |
1390 | ||
9193bc42 AM |
1391 | extern bool aarch64_sys_ins_reg_has_xt (const aarch64_sys_ins_reg *); |
1392 | extern bool | |
38cf07a6 AC |
1393 | aarch64_sys_ins_reg_supported_p (const aarch64_feature_set, |
1394 | const char *reg_name, aarch64_insn, | |
4abb672a | 1395 | uint32_t, const aarch64_feature_set *); |
ea2deeec | 1396 | |
a06ea964 NC |
1397 | extern const aarch64_sys_ins_reg aarch64_sys_regs_ic []; |
1398 | extern const aarch64_sys_ins_reg aarch64_sys_regs_dc []; | |
1399 | extern const aarch64_sys_ins_reg aarch64_sys_regs_at []; | |
1400 | extern const aarch64_sys_ins_reg aarch64_sys_regs_tlbi []; | |
2ac435d4 | 1401 | extern const aarch64_sys_ins_reg aarch64_sys_regs_sr []; |
a06ea964 NC |
1402 | |
1403 | /* Shift/extending operator kinds. | |
1404 | N.B. order is important; keep aarch64_operand_modifiers synced. */ | |
1405 | enum aarch64_modifier_kind | |
1406 | { | |
1407 | AARCH64_MOD_NONE, | |
1408 | AARCH64_MOD_MSL, | |
1409 | AARCH64_MOD_ROR, | |
1410 | AARCH64_MOD_ASR, | |
1411 | AARCH64_MOD_LSR, | |
1412 | AARCH64_MOD_LSL, | |
1413 | AARCH64_MOD_UXTB, | |
1414 | AARCH64_MOD_UXTH, | |
1415 | AARCH64_MOD_UXTW, | |
1416 | AARCH64_MOD_UXTX, | |
1417 | AARCH64_MOD_SXTB, | |
1418 | AARCH64_MOD_SXTH, | |
1419 | AARCH64_MOD_SXTW, | |
1420 | AARCH64_MOD_SXTX, | |
2442d846 | 1421 | AARCH64_MOD_MUL, |
98907a70 | 1422 | AARCH64_MOD_MUL_VL, |
a06ea964 NC |
1423 | }; |
1424 | ||
9193bc42 | 1425 | bool |
a06ea964 NC |
1426 | aarch64_extend_operator_p (enum aarch64_modifier_kind); |
1427 | ||
1428 | enum aarch64_modifier_kind | |
1429 | aarch64_get_operand_modifier (const struct aarch64_name_value_pair *); | |
1430 | /* Condition. */ | |
1431 | ||
1432 | typedef struct | |
1433 | { | |
1434 | /* A list of names with the first one as the disassembly preference; | |
1435 | terminated by NULL if fewer than 3. */ | |
bb7eff52 | 1436 | const char *names[4]; |
a06ea964 NC |
1437 | aarch64_insn value; |
1438 | } aarch64_cond; | |
1439 | ||
1440 | extern const aarch64_cond aarch64_conds[16]; | |
1441 | ||
1442 | const aarch64_cond* get_cond_from_value (aarch64_insn value); | |
1443 | const aarch64_cond* get_inverted_cond (const aarch64_cond *cond); | |
1444 | \f | |
575c497a RS |
1445 | /* Information about a reference to part of ZA. */ |
1446 | struct aarch64_indexed_za | |
1447 | { | |
586c6281 RS |
1448 | /* Which tile is being accessed. Unused (and 0) for an index into ZA. */ |
1449 | int regno; | |
1450 | ||
575c497a RS |
1451 | struct |
1452 | { | |
586c6281 RS |
1453 | /* The 32-bit index register. */ |
1454 | int regno; | |
1455 | ||
1456 | /* The first (or only) immediate offset. */ | |
1457 | int64_t imm; | |
1458 | ||
1459 | /* The last immediate offset minus the first immediate offset. | |
1460 | Unlike the range size, this is guaranteed not to overflow | |
1461 | when the end offset > the start offset. */ | |
1462 | uint64_t countm1; | |
575c497a | 1463 | } index; |
586c6281 RS |
1464 | |
1465 | /* The vector group size, or 0 if none. */ | |
e2dc4040 | 1466 | unsigned group_size : 8; |
586c6281 RS |
1467 | |
1468 | /* True if a tile access is vertical, false if it is horizontal. | |
1469 | Unused (and 0) for an index into ZA. */ | |
1470 | unsigned v : 1; | |
575c497a RS |
1471 | }; |
1472 | ||
f5b57fea RS |
1473 | /* Information about a list of registers. */ |
1474 | struct aarch64_reglist | |
1475 | { | |
1476 | unsigned first_regno : 8; | |
1477 | unsigned num_regs : 8; | |
1478 | /* The difference between the nth and the n+1th register. */ | |
1479 | unsigned stride : 8; | |
1480 | /* 1 if it is a list of reg element. */ | |
1481 | unsigned has_index : 1; | |
1482 | /* Lane index; valid only when has_index is 1. */ | |
1483 | int64_t index; | |
d0562653 | 1484 | }; |
f5b57fea | 1485 | |
a06ea964 NC |
1486 | /* Structure representing an operand. */ |
1487 | ||
1488 | struct aarch64_opnd_info | |
1489 | { | |
1490 | enum aarch64_opnd type; | |
1491 | aarch64_opnd_qualifier_t qualifier; | |
1492 | int idx; | |
1493 | ||
1494 | union | |
1495 | { | |
1496 | struct | |
1497 | { | |
1498 | unsigned regno; | |
1499 | } reg; | |
1500 | struct | |
1501 | { | |
dab26bf4 RS |
1502 | unsigned int regno; |
1503 | int64_t index; | |
a06ea964 NC |
1504 | } reglane; |
1505 | /* e.g. LVn. */ | |
f5b57fea | 1506 | struct aarch64_reglist reglist; |
a06ea964 NC |
1507 | /* e.g. immediate or pc relative address offset. */ |
1508 | struct | |
1509 | { | |
1510 | int64_t value; | |
1511 | unsigned is_fp : 1; | |
1512 | } imm; | |
1513 | /* e.g. address in STR (register offset). */ | |
1514 | struct | |
1515 | { | |
1516 | unsigned base_regno; | |
1517 | struct | |
1518 | { | |
1519 | union | |
1520 | { | |
1521 | int imm; | |
1522 | unsigned regno; | |
1523 | }; | |
1524 | unsigned is_reg; | |
1525 | } offset; | |
1526 | unsigned pcrel : 1; /* PC-relative. */ | |
1527 | unsigned writeback : 1; | |
1528 | unsigned preind : 1; /* Pre-indexed. */ | |
1529 | unsigned postind : 1; /* Post-indexed. */ | |
1530 | } addr; | |
561a72d4 TC |
1531 | |
1532 | struct | |
1533 | { | |
1534 | /* The encoding of the system register. */ | |
1535 | aarch64_insn value; | |
1536 | ||
1537 | /* The system register flags. */ | |
1538 | uint32_t flags; | |
1539 | } sysreg; | |
1540 | ||
7bb5f07c | 1541 | /* ZA tile vector, e.g. <ZAn><HV>.D[<Wv>{, <imm>}] */ |
575c497a | 1542 | struct aarch64_indexed_za indexed_za; |
7bb5f07c | 1543 | |
a06ea964 | 1544 | const aarch64_cond *cond; |
a06ea964 NC |
1545 | /* The encoding of the PSTATE field. */ |
1546 | aarch64_insn pstatefield; | |
1547 | const aarch64_sys_ins_reg *sysins_op; | |
1548 | const struct aarch64_name_value_pair *barrier; | |
9ed608f9 | 1549 | const struct aarch64_name_value_pair *hint_option; |
a06ea964 NC |
1550 | const struct aarch64_name_value_pair *prfop; |
1551 | }; | |
1552 | ||
1553 | /* Operand shifter; in use when the operand is a register offset address, | |
1554 | add/sub extended reg, etc. e.g. <R><m>{, <extend> {#<amount>}}. */ | |
1555 | struct | |
1556 | { | |
1557 | enum aarch64_modifier_kind kind; | |
a06ea964 NC |
1558 | unsigned operator_present: 1; /* Only valid during encoding. */ |
1559 | /* Value of the 'S' field in ld/st reg offset; used only in decoding. */ | |
1560 | unsigned amount_present: 1; | |
2442d846 | 1561 | int64_t amount; |
a06ea964 NC |
1562 | } shifter; |
1563 | ||
1564 | unsigned skip:1; /* Operand is not completed if there is a fixup needed | |
1565 | to be done on it. In some (but not all) of these | |
1566 | cases, we need to tell libopcodes to skip the | |
1567 | constraint checking and the encoding for this | |
1568 | operand, so that the libopcodes can pick up the | |
1569 | right opcode before the operand is fixed-up. This | |
1570 | flag should only be used during the | |
1571 | assembling/encoding. */ | |
1572 | unsigned present:1; /* Whether this operand is present in the assembly | |
1573 | line; not used during the disassembly. */ | |
1574 | }; | |
1575 | ||
1576 | typedef struct aarch64_opnd_info aarch64_opnd_info; | |
1577 | ||
1578 | /* Structure representing an instruction. | |
1579 | ||
1580 | It is used during both the assembling and disassembling. The assembler | |
1581 | fills an aarch64_inst after a successful parsing and then passes it to the | |
1582 | encoding routine to do the encoding. During the disassembling, the | |
1583 | disassembler calls the decoding routine to decode a binary instruction; on a | |
1584 | successful return, such a structure will be filled with information of the | |
1585 | instruction; then the disassembler uses the information to print out the | |
1586 | instruction. */ | |
1587 | ||
1588 | struct aarch64_inst | |
1589 | { | |
1590 | /* The value of the binary instruction. */ | |
1591 | aarch64_insn value; | |
1592 | ||
1593 | /* Corresponding opcode entry. */ | |
1594 | const aarch64_opcode *opcode; | |
1595 | ||
1596 | /* Condition for a truly conditional-executed instrutions, e.g. b.cond. */ | |
1597 | const aarch64_cond *cond; | |
1598 | ||
1599 | /* Operands information. */ | |
1600 | aarch64_opnd_info operands[AARCH64_MAX_OPND_NUM]; | |
1601 | }; | |
1602 | ||
ff605452 SD |
1603 | /* Defining the HINT #imm values for the aarch64_hint_options. */ |
1604 | #define HINT_OPD_CSYNC 0x11 | |
c58f84d8 | 1605 | #define HINT_OPD_DSYNC 0x13 |
ff605452 SD |
1606 | #define HINT_OPD_C 0x22 |
1607 | #define HINT_OPD_J 0x24 | |
1608 | #define HINT_OPD_JC 0x26 | |
1609 | #define HINT_OPD_NULL 0x00 | |
1610 | ||
a06ea964 NC |
1611 | \f |
1612 | /* Diagnosis related declaration and interface. */ | |
1613 | ||
1614 | /* Operand error kind enumerators. | |
1615 | ||
1616 | AARCH64_OPDE_RECOVERABLE | |
1617 | Less severe error found during the parsing, very possibly because that | |
1618 | GAS has picked up a wrong instruction template for the parsing. | |
1619 | ||
63eff947 RS |
1620 | AARCH64_OPDE_A_SHOULD_FOLLOW_B |
1621 | The instruction forms (or is expected to form) part of a sequence, | |
1622 | but the preceding instruction in the sequence wasn't the expected one. | |
1623 | The message refers to two strings: the name of the current instruction, | |
1624 | followed by the name of the expected preceding instruction. | |
1625 | ||
1626 | AARCH64_OPDE_EXPECTED_A_AFTER_B | |
1627 | Same as AARCH64_OPDE_A_SHOULD_FOLLOW_B, but shifting the focus | |
1628 | so that the current instruction is assumed to be the incorrect one: | |
1629 | "since the previous instruction was B, the current one should be A". | |
1630 | ||
a06ea964 NC |
1631 | AARCH64_OPDE_SYNTAX_ERROR |
1632 | General syntax error; it can be either a user error, or simply because | |
1633 | that GAS is trying a wrong instruction template. | |
1634 | ||
1635 | AARCH64_OPDE_FATAL_SYNTAX_ERROR | |
1636 | Definitely a user syntax error. | |
1637 | ||
1638 | AARCH64_OPDE_INVALID_VARIANT | |
1639 | No syntax error, but the operands are not a valid combination, e.g. | |
1640 | FMOV D0,S0 | |
1641 | ||
36043bcf RS |
1642 | The following errors are only reported against an asm string that is |
1643 | syntactically valid and that has valid operand qualifiers. | |
1644 | ||
e2dc4040 RS |
1645 | AARCH64_OPDE_INVALID_VG_SIZE |
1646 | Error about a "VGx<n>" modifier in a ZA index not having the | |
1647 | correct <n>. This error effectively forms a pair with | |
1648 | AARCH64_OPDE_REG_LIST_LENGTH, since both errors relate to the number | |
1649 | of vectors that an instruction operates on. However, the "VGx<n>" | |
1650 | modifier is optional, whereas a register list always has a known | |
1651 | and explicit length. It therefore seems better to place more | |
1652 | importance on the register list length when selecting an opcode table | |
1653 | entry. This in turn means that having an incorrect register length | |
1654 | should be more severe than having an incorrect "VGx<n>". | |
1655 | ||
f5b57fea RS |
1656 | AARCH64_OPDE_REG_LIST_LENGTH |
1657 | Error about a register list operand having an unexpected number of | |
36043bcf RS |
1658 | registers. This error is low severity because there might be another |
1659 | opcode entry that supports the given number of registers. | |
1660 | ||
f5b57fea RS |
1661 | AARCH64_OPDE_REG_LIST_STRIDE |
1662 | Error about a register list operand having the correct number | |
1663 | (and type) of registers, but an unexpected stride. This error is | |
1664 | more severe than AARCH64_OPDE_REG_LIST_LENGTH because it implies | |
1665 | that the length is known to be correct. However, it is lower than | |
1666 | many other errors, since some instructions have forms that share | |
1667 | the same number of registers but have different strides. | |
1668 | ||
01a4d082 PW |
1669 | AARCH64_OPDE_UNTIED_IMMS |
1670 | The asm failed to use the same immediate for a destination operand | |
1671 | and a tied source operand. | |
1672 | ||
0c608d6b RS |
1673 | AARCH64_OPDE_UNTIED_OPERAND |
1674 | The asm failed to use the same register for a destination operand | |
1675 | and a tied source operand. | |
1676 | ||
a06ea964 NC |
1677 | AARCH64_OPDE_OUT_OF_RANGE |
1678 | Error about some immediate value out of a valid range. | |
1679 | ||
1680 | AARCH64_OPDE_UNALIGNED | |
1681 | Error about some immediate value not properly aligned (i.e. not being a | |
1682 | multiple times of a certain value). | |
1683 | ||
a06ea964 NC |
1684 | AARCH64_OPDE_OTHER_ERROR |
1685 | Error of the highest severity and used for any severe issue that does not | |
1686 | fall into any of the above categories. | |
1687 | ||
859f51df RS |
1688 | AARCH64_OPDE_INVALID_REGNO |
1689 | A register was syntactically valid and had the right type, but it was | |
1690 | outside the range supported by the associated operand field. This is | |
1691 | a high severity error because there are currently no instructions that | |
1692 | would accept the operands that precede the erroneous one (if any) and | |
1693 | yet still accept a wider range of registers. | |
1694 | ||
63eff947 RS |
1695 | AARCH64_OPDE_RECOVERABLE, AARCH64_OPDE_SYNTAX_ERROR and |
1696 | AARCH64_OPDE_FATAL_SYNTAX_ERROR are only deteced by GAS while the | |
a06ea964 NC |
1697 | AARCH64_OPDE_INVALID_VARIANT error can only be spotted by libopcodes as |
1698 | only libopcodes has the information about the valid variants of each | |
1699 | instruction. | |
1700 | ||
1701 | The enumerators have an increasing severity. This is helpful when there are | |
1702 | multiple instruction templates available for a given mnemonic name (e.g. | |
1703 | FMOV); this mechanism will help choose the most suitable template from which | |
c1817dc2 RS |
1704 | the generated diagnostics can most closely describe the issues, if any. |
1705 | ||
1706 | This enum needs to be kept up-to-date with operand_mismatch_kind_names | |
1707 | in tc-aarch64.c. */ | |
a06ea964 NC |
1708 | |
1709 | enum aarch64_operand_error_kind | |
1710 | { | |
1711 | AARCH64_OPDE_NIL, | |
1712 | AARCH64_OPDE_RECOVERABLE, | |
63eff947 RS |
1713 | AARCH64_OPDE_A_SHOULD_FOLLOW_B, |
1714 | AARCH64_OPDE_EXPECTED_A_AFTER_B, | |
a06ea964 NC |
1715 | AARCH64_OPDE_SYNTAX_ERROR, |
1716 | AARCH64_OPDE_FATAL_SYNTAX_ERROR, | |
1717 | AARCH64_OPDE_INVALID_VARIANT, | |
e2dc4040 | 1718 | AARCH64_OPDE_INVALID_VG_SIZE, |
f5b57fea RS |
1719 | AARCH64_OPDE_REG_LIST_LENGTH, |
1720 | AARCH64_OPDE_REG_LIST_STRIDE, | |
01a4d082 | 1721 | AARCH64_OPDE_UNTIED_IMMS, |
0c608d6b | 1722 | AARCH64_OPDE_UNTIED_OPERAND, |
a06ea964 NC |
1723 | AARCH64_OPDE_OUT_OF_RANGE, |
1724 | AARCH64_OPDE_UNALIGNED, | |
859f51df RS |
1725 | AARCH64_OPDE_OTHER_ERROR, |
1726 | AARCH64_OPDE_INVALID_REGNO | |
a06ea964 NC |
1727 | }; |
1728 | ||
1729 | /* N.B. GAS assumes that this structure work well with shallow copy. */ | |
1730 | struct aarch64_operand_error | |
1731 | { | |
1732 | enum aarch64_operand_error_kind kind; | |
1733 | int index; | |
1734 | const char *error; | |
63eff947 RS |
1735 | /* Some data for extra information. */ |
1736 | union { | |
1737 | int i; | |
1738 | const char *s; | |
1739 | } data[3]; | |
9193bc42 | 1740 | bool non_fatal; |
a06ea964 NC |
1741 | }; |
1742 | ||
7e84b55d TC |
1743 | /* AArch64 sequence structure used to track instructions with F_SCAN |
1744 | dependencies for both assembler and disassembler. */ | |
1745 | struct aarch64_instr_sequence | |
1746 | { | |
b3e59f88 RS |
1747 | /* The instructions in the sequence, starting with the one that |
1748 | caused it to be opened. */ | |
7e84b55d | 1749 | aarch64_inst *instr; |
7e84b55d | 1750 | /* The number of instructions already in the sequence. */ |
b3e59f88 RS |
1751 | int num_added_insns; |
1752 | /* The number of instructions allocated to the sequence. */ | |
1753 | int num_allocated_insns; | |
7e84b55d | 1754 | }; |
a06ea964 NC |
1755 | |
1756 | /* Encoding entrypoint. */ | |
1757 | ||
9193bc42 | 1758 | extern bool |
a06ea964 NC |
1759 | aarch64_opcode_encode (const aarch64_opcode *, const aarch64_inst *, |
1760 | aarch64_insn *, aarch64_opnd_qualifier_t *, | |
7e84b55d | 1761 | aarch64_operand_error *, aarch64_instr_sequence *); |
a06ea964 NC |
1762 | |
1763 | extern const aarch64_opcode * | |
1764 | aarch64_replace_opcode (struct aarch64_inst *, | |
1765 | const aarch64_opcode *); | |
1766 | ||
1767 | /* Given the opcode enumerator OP, return the pointer to the corresponding | |
1768 | opcode entry. */ | |
1769 | ||
1770 | extern const aarch64_opcode * | |
1771 | aarch64_get_opcode (enum aarch64_op); | |
1772 | ||
76a4c1e0 AB |
1773 | /* An instance of this structure is passed to aarch64_print_operand, and |
1774 | the callback within this structure is used to apply styling to the | |
1775 | disassembler output. This structure encapsulates the callback and a | |
1776 | state pointer. */ | |
1777 | ||
1778 | struct aarch64_styler | |
1779 | { | |
1780 | /* The callback used to apply styling. Returns a string created from FMT | |
1781 | and ARGS with STYLE applied to the string. STYLER is a pointer back | |
1782 | to this object so that the callback can access the state member. | |
1783 | ||
1784 | The string returned from this callback must remain valid until the | |
1785 | call to aarch64_print_operand has completed. */ | |
1786 | const char *(*apply_style) (struct aarch64_styler *styler, | |
1787 | enum disassembler_style style, | |
1788 | const char *fmt, | |
1789 | va_list args); | |
1790 | ||
1791 | /* A pointer to a state object which can be used by the apply_style | |
1792 | callback function. */ | |
1793 | void *state; | |
1794 | }; | |
1795 | ||
a06ea964 NC |
1796 | /* Generate the string representation of an operand. */ |
1797 | extern void | |
1798 | aarch64_print_operand (char *, size_t, bfd_vma, const aarch64_opcode *, | |
7d02540a | 1799 | const aarch64_opnd_info *, int, int *, bfd_vma *, |
6837a663 | 1800 | char **, char *, size_t, |
76a4c1e0 AB |
1801 | aarch64_feature_set features, |
1802 | struct aarch64_styler *styler); | |
a06ea964 NC |
1803 | |
1804 | /* Miscellaneous interface. */ | |
1805 | ||
1806 | extern int | |
1807 | aarch64_operand_index (const enum aarch64_opnd *, enum aarch64_opnd); | |
1808 | ||
1809 | extern aarch64_opnd_qualifier_t | |
1810 | aarch64_get_expected_qualifier (const aarch64_opnd_qualifier_seq_t *, int, | |
1811 | const aarch64_opnd_qualifier_t, int); | |
1812 | ||
9193bc42 | 1813 | extern bool |
a68f4cd2 TC |
1814 | aarch64_is_destructive_by_operands (const aarch64_opcode *); |
1815 | ||
a06ea964 NC |
1816 | extern int |
1817 | aarch64_num_of_operands (const aarch64_opcode *); | |
1818 | ||
1819 | extern int | |
1820 | aarch64_stack_pointer_p (const aarch64_opnd_info *); | |
1821 | ||
e141d84e YQ |
1822 | extern int |
1823 | aarch64_zero_register_p (const aarch64_opnd_info *); | |
a06ea964 | 1824 | |
1d482394 | 1825 | extern enum err_type |
9193bc42 | 1826 | aarch64_decode_insn (aarch64_insn, aarch64_inst *, bool, |
a68f4cd2 TC |
1827 | aarch64_operand_error *); |
1828 | ||
1829 | extern void | |
1830 | init_insn_sequence (const struct aarch64_inst *, aarch64_instr_sequence *); | |
36f4aab1 | 1831 | |
a06ea964 NC |
1832 | /* Given an operand qualifier, return the expected data element size |
1833 | of a qualified operand. */ | |
1834 | extern unsigned char | |
1835 | aarch64_get_qualifier_esize (aarch64_opnd_qualifier_t); | |
1836 | ||
1837 | extern enum aarch64_operand_class | |
1838 | aarch64_get_operand_class (enum aarch64_opnd); | |
1839 | ||
1840 | extern const char * | |
1841 | aarch64_get_operand_name (enum aarch64_opnd); | |
1842 | ||
1843 | extern const char * | |
1844 | aarch64_get_operand_desc (enum aarch64_opnd); | |
1845 | ||
9193bc42 | 1846 | extern bool |
e950b345 RS |
1847 | aarch64_sve_dupm_mov_immediate_p (uint64_t, int); |
1848 | ||
199cfcc4 | 1849 | extern bool |
4abb672a | 1850 | aarch64_cpu_supports_inst_p (aarch64_feature_set, aarch64_inst *); |
199cfcc4 | 1851 | |
a06ea964 NC |
1852 | #ifdef DEBUG_AARCH64 |
1853 | extern int debug_dump; | |
1854 | ||
1855 | extern void | |
1856 | aarch64_verbose (const char *, ...) __attribute__ ((format (printf, 1, 2))); | |
1857 | ||
1858 | #define DEBUG_TRACE(M, ...) \ | |
1859 | { \ | |
1860 | if (debug_dump) \ | |
1861 | aarch64_verbose ("%s: " M ".", __func__, ##__VA_ARGS__); \ | |
1862 | } | |
1863 | ||
1864 | #define DEBUG_TRACE_IF(C, M, ...) \ | |
1865 | { \ | |
1866 | if (debug_dump && (C)) \ | |
1867 | aarch64_verbose ("%s: " M ".", __func__, ##__VA_ARGS__); \ | |
1868 | } | |
1869 | #else /* !DEBUG_AARCH64 */ | |
1870 | #define DEBUG_TRACE(M, ...) ; | |
1871 | #define DEBUG_TRACE_IF(C, M, ...) ; | |
1872 | #endif /* DEBUG_AARCH64 */ | |
1873 | ||
245d2e3f RS |
1874 | extern const char *const aarch64_sve_pattern_array[32]; |
1875 | extern const char *const aarch64_sve_prfop_array[16]; | |
8ff42920 | 1876 | extern const char *const aarch64_rprfmop_array[64]; |
99e01a66 | 1877 | extern const char *const aarch64_sme_vlxn_array[2]; |
245d2e3f | 1878 | |
d3e12b29 YQ |
1879 | #ifdef __cplusplus |
1880 | } | |
1881 | #endif | |
1882 | ||
a06ea964 | 1883 | #endif /* OPCODE_AARCH64_H */ |