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