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