Coverage Report

Created: 2026-11-21 09:00

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