2012-08-13 16:52:54 +02:00
|
|
|
/* aarch64-dis.h -- Header file for aarch64-dis.c and aarch64-dis-2.c.
|
2016-01-01 12:25:12 +01:00
|
|
|
Copyright (C) 2012-2016 Free Software Foundation, Inc.
|
2012-08-13 16:52:54 +02:00
|
|
|
Contributed by ARM Ltd.
|
|
|
|
|
|
|
|
This file is part of the GNU opcodes library.
|
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 3, or (at your option)
|
|
|
|
any later version.
|
|
|
|
|
|
|
|
It is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
|
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
|
|
|
License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; see the file COPYING3. If not,
|
|
|
|
see <http://www.gnu.org/licenses/>. */
|
|
|
|
|
|
|
|
#ifndef OPCODES_AARCH64_DIS_H
|
|
|
|
#define OPCODES_AARCH64_DIS_H
|
|
|
|
#include "bfd_stdint.h"
|
|
|
|
#include "aarch64-opc.h"
|
|
|
|
|
|
|
|
/* Lookup opcode WORD in the opcode table.
|
|
|
|
|
|
|
|
In the case of multiple aarch64_opcode candidates, one of them will be
|
|
|
|
returned; for other candidate(s), call aarch64_find_next_opcode to
|
|
|
|
obtain. Note that aarch64_find_next_opcode finds the next
|
|
|
|
aarch64_opcode candidate in a way as if all related aarch64_opcode
|
|
|
|
entries were in a single-link list.
|
|
|
|
|
|
|
|
N.B. all alias opcodes are ignored here. */
|
|
|
|
|
|
|
|
const aarch64_opcode* aarch64_opcode_lookup (uint32_t);
|
|
|
|
const aarch64_opcode* aarch64_find_next_opcode (const aarch64_opcode *);
|
|
|
|
|
|
|
|
/* Given OPCODE, return its alias, e.g. given UBFM, return LSL.
|
|
|
|
|
|
|
|
In the case of multiple alias candidates, the one of the highest priority
|
|
|
|
(or one of several aliases of the same highest priority) will be
|
|
|
|
returned; for the other candidate(s), call aarch64_find_next_alias_opcode
|
|
|
|
to obtain. Note that aarch64_find_next_alias_opcode finds the next
|
|
|
|
alias candidate in a way as if all related aliases were in a single-link
|
|
|
|
list with priority from the highest to the least. */
|
|
|
|
|
|
|
|
const aarch64_opcode* aarch64_find_alias_opcode (const aarch64_opcode *);
|
|
|
|
const aarch64_opcode* aarch64_find_next_alias_opcode (const aarch64_opcode *);
|
|
|
|
|
|
|
|
/* Switch-table-based high-level operand extractor. */
|
|
|
|
|
|
|
|
int aarch64_extract_operand (const aarch64_operand *, aarch64_opnd_info *,
|
|
|
|
const aarch64_insn, const aarch64_inst *);
|
|
|
|
|
|
|
|
/* Operand extractors. */
|
|
|
|
|
|
|
|
#define AARCH64_DECL_OPD_EXTRACTOR(x) \
|
|
|
|
int aarch64_##x (const aarch64_operand *, aarch64_opnd_info *, \
|
|
|
|
const aarch64_insn, const aarch64_inst *)
|
|
|
|
|
|
|
|
AARCH64_DECL_OPD_EXTRACTOR (ext_regno);
|
2014-09-03 15:40:41 +02:00
|
|
|
AARCH64_DECL_OPD_EXTRACTOR (ext_regno_pair);
|
2012-08-13 16:52:54 +02:00
|
|
|
AARCH64_DECL_OPD_EXTRACTOR (ext_regrt_sysins);
|
|
|
|
AARCH64_DECL_OPD_EXTRACTOR (ext_reglane);
|
|
|
|
AARCH64_DECL_OPD_EXTRACTOR (ext_reglist);
|
|
|
|
AARCH64_DECL_OPD_EXTRACTOR (ext_ldst_reglist);
|
|
|
|
AARCH64_DECL_OPD_EXTRACTOR (ext_ldst_reglist_r);
|
|
|
|
AARCH64_DECL_OPD_EXTRACTOR (ext_ldst_elemlist);
|
|
|
|
AARCH64_DECL_OPD_EXTRACTOR (ext_advsimd_imm_shift);
|
|
|
|
AARCH64_DECL_OPD_EXTRACTOR (ext_shll_imm);
|
|
|
|
AARCH64_DECL_OPD_EXTRACTOR (ext_imm);
|
|
|
|
AARCH64_DECL_OPD_EXTRACTOR (ext_imm_half);
|
|
|
|
AARCH64_DECL_OPD_EXTRACTOR (ext_advsimd_imm_modified);
|
2016-09-21 17:51:24 +02:00
|
|
|
AARCH64_DECL_OPD_EXTRACTOR (ext_fpimm);
|
2012-08-13 16:52:54 +02:00
|
|
|
AARCH64_DECL_OPD_EXTRACTOR (ext_fbits);
|
|
|
|
AARCH64_DECL_OPD_EXTRACTOR (ext_aimm);
|
|
|
|
AARCH64_DECL_OPD_EXTRACTOR (ext_limm);
|
|
|
|
AARCH64_DECL_OPD_EXTRACTOR (ext_ft);
|
|
|
|
AARCH64_DECL_OPD_EXTRACTOR (ext_addr_simple);
|
|
|
|
AARCH64_DECL_OPD_EXTRACTOR (ext_addr_regoff);
|
|
|
|
AARCH64_DECL_OPD_EXTRACTOR (ext_addr_simm);
|
|
|
|
AARCH64_DECL_OPD_EXTRACTOR (ext_addr_uimm12);
|
|
|
|
AARCH64_DECL_OPD_EXTRACTOR (ext_simd_addr_post);
|
|
|
|
AARCH64_DECL_OPD_EXTRACTOR (ext_cond);
|
|
|
|
AARCH64_DECL_OPD_EXTRACTOR (ext_sysreg);
|
|
|
|
AARCH64_DECL_OPD_EXTRACTOR (ext_pstatefield);
|
|
|
|
AARCH64_DECL_OPD_EXTRACTOR (ext_sysins_op);
|
|
|
|
AARCH64_DECL_OPD_EXTRACTOR (ext_barrier);
|
2015-12-11 11:11:27 +01:00
|
|
|
AARCH64_DECL_OPD_EXTRACTOR (ext_hint);
|
2012-08-13 16:52:54 +02:00
|
|
|
AARCH64_DECL_OPD_EXTRACTOR (ext_prfop);
|
|
|
|
AARCH64_DECL_OPD_EXTRACTOR (ext_reg_extended);
|
|
|
|
AARCH64_DECL_OPD_EXTRACTOR (ext_reg_shifted);
|
[AArch64][SVE 25/32] Add support for SVE addressing modes
This patch adds most of the new SVE addressing modes and associated
operands. A follow-on patch adds MUL VL, since handling it separately
makes the changes easier to read.
The patch also introduces a new "operand-dependent data" field to the
operand flags, based closely on the existing one for opcode flags.
For SVE this new field needs only 2 bits, but it could be widened
in future if necessary.
include/
* opcode/aarch64.h (AARCH64_OPND_SVE_ADDR_RI_U6): New aarch64_opnd.
(AARCH64_OPND_SVE_ADDR_RI_U6x2, AARCH64_OPND_SVE_ADDR_RI_U6x4)
(AARCH64_OPND_SVE_ADDR_RI_U6x8, AARCH64_OPND_SVE_ADDR_RR)
(AARCH64_OPND_SVE_ADDR_RR_LSL1, AARCH64_OPND_SVE_ADDR_RR_LSL2)
(AARCH64_OPND_SVE_ADDR_RR_LSL3, AARCH64_OPND_SVE_ADDR_RX)
(AARCH64_OPND_SVE_ADDR_RX_LSL1, AARCH64_OPND_SVE_ADDR_RX_LSL2)
(AARCH64_OPND_SVE_ADDR_RX_LSL3, AARCH64_OPND_SVE_ADDR_RZ)
(AARCH64_OPND_SVE_ADDR_RZ_LSL1, AARCH64_OPND_SVE_ADDR_RZ_LSL2)
(AARCH64_OPND_SVE_ADDR_RZ_LSL3, AARCH64_OPND_SVE_ADDR_RZ_XTW_14)
(AARCH64_OPND_SVE_ADDR_RZ_XTW_22, AARCH64_OPND_SVE_ADDR_RZ_XTW1_14)
(AARCH64_OPND_SVE_ADDR_RZ_XTW1_22, AARCH64_OPND_SVE_ADDR_RZ_XTW2_14)
(AARCH64_OPND_SVE_ADDR_RZ_XTW2_22, AARCH64_OPND_SVE_ADDR_RZ_XTW3_14)
(AARCH64_OPND_SVE_ADDR_RZ_XTW3_22, AARCH64_OPND_SVE_ADDR_ZI_U5)
(AARCH64_OPND_SVE_ADDR_ZI_U5x2, AARCH64_OPND_SVE_ADDR_ZI_U5x4)
(AARCH64_OPND_SVE_ADDR_ZI_U5x8, AARCH64_OPND_SVE_ADDR_ZZ_LSL)
(AARCH64_OPND_SVE_ADDR_ZZ_SXTW, AARCH64_OPND_SVE_ADDR_ZZ_UXTW):
Likewise.
opcodes/
* aarch64-tbl.h (AARCH64_OPERANDS): Add entries for the new SVE
address operands.
* aarch64-opc.h (FLD_SVE_imm6, FLD_SVE_msz, FLD_SVE_xs_14)
(FLD_SVE_xs_22): New aarch64_field_kinds.
(OPD_F_OD_MASK, OPD_F_OD_LSB, OPD_F_NO_ZR): New flags.
(get_operand_specific_data): New function.
* aarch64-opc.c (fields): Add entries for FLD_SVE_imm6, FLD_SVE_msz,
FLD_SVE_xs_14 and FLD_SVE_xs_22.
(operand_general_constraint_met_p): Handle the new SVE address
operands.
(sve_reg): New array.
(get_addr_sve_reg_name): New function.
(aarch64_print_operand): Handle the new SVE address operands.
* aarch64-opc-2.c: Regenerate.
* aarch64-asm.h (ins_sve_addr_ri_u6, ins_sve_addr_rr_lsl)
(ins_sve_addr_rz_xtw, ins_sve_addr_zi_u5, ins_sve_addr_zz_lsl)
(ins_sve_addr_zz_sxtw, ins_sve_addr_zz_uxtw): New inserters.
* aarch64-asm.c (aarch64_ins_sve_addr_ri_u6): New function.
(aarch64_ins_sve_addr_rr_lsl): Likewise.
(aarch64_ins_sve_addr_rz_xtw): Likewise.
(aarch64_ins_sve_addr_zi_u5): Likewise.
(aarch64_ins_sve_addr_zz): Likewise.
(aarch64_ins_sve_addr_zz_lsl): Likewise.
(aarch64_ins_sve_addr_zz_sxtw): Likewise.
(aarch64_ins_sve_addr_zz_uxtw): Likewise.
* aarch64-asm-2.c: Regenerate.
* aarch64-dis.h (ext_sve_addr_ri_u6, ext_sve_addr_rr_lsl)
(ext_sve_addr_rz_xtw, ext_sve_addr_zi_u5, ext_sve_addr_zz_lsl)
(ext_sve_addr_zz_sxtw, ext_sve_addr_zz_uxtw): New extractors.
* aarch64-dis.c (aarch64_ext_sve_add_reg_imm): New function.
(aarch64_ext_sve_addr_ri_u6): Likewise.
(aarch64_ext_sve_addr_rr_lsl): Likewise.
(aarch64_ext_sve_addr_rz_xtw): Likewise.
(aarch64_ext_sve_addr_zi_u5): Likewise.
(aarch64_ext_sve_addr_zz): Likewise.
(aarch64_ext_sve_addr_zz_lsl): Likewise.
(aarch64_ext_sve_addr_zz_sxtw): Likewise.
(aarch64_ext_sve_addr_zz_uxtw): Likewise.
* aarch64-dis-2.c: Regenerate.
gas/
* config/tc-aarch64.c (REG_TYPE_SVE_BASE, REG_TYPE_SVE_OFFSET): New
register types.
(get_reg_expected_msg): Handle them.
(aarch64_addr_reg_parse): New function, split out from
aarch64_reg_parse_32_64. Handle Z registers too.
(aarch64_reg_parse_32_64): Call it.
(parse_address_main): Add base_qualifier, offset_qualifier,
base_type and offset_type parameters. Handle SVE base and offset
registers.
(parse_address): Update call to parse_address_main.
(parse_sve_address): New function.
(parse_operands): Parse the new SVE address operands.
2016-09-21 17:55:49 +02:00
|
|
|
AARCH64_DECL_OPD_EXTRACTOR (ext_sve_addr_ri_u6);
|
|
|
|
AARCH64_DECL_OPD_EXTRACTOR (ext_sve_addr_rr_lsl);
|
|
|
|
AARCH64_DECL_OPD_EXTRACTOR (ext_sve_addr_rz_xtw);
|
|
|
|
AARCH64_DECL_OPD_EXTRACTOR (ext_sve_addr_zi_u5);
|
|
|
|
AARCH64_DECL_OPD_EXTRACTOR (ext_sve_addr_zz_lsl);
|
|
|
|
AARCH64_DECL_OPD_EXTRACTOR (ext_sve_addr_zz_sxtw);
|
|
|
|
AARCH64_DECL_OPD_EXTRACTOR (ext_sve_addr_zz_uxtw);
|
[AArch64][SVE 21/32] Add Zn and Pn registers
This patch adds the Zn and Pn registers, and associated fields and
operands.
include/
* opcode/aarch64.h (AARCH64_OPND_CLASS_SVE_REG): New
aarch64_operand_class.
(AARCH64_OPND_CLASS_PRED_REG): Likewise.
(AARCH64_OPND_SVE_Pd, AARCH64_OPND_SVE_Pg3, AARCH64_OPND_SVE_Pg4_5)
(AARCH64_OPND_SVE_Pg4_10, AARCH64_OPND_SVE_Pg4_16)
(AARCH64_OPND_SVE_Pm, AARCH64_OPND_SVE_Pn, AARCH64_OPND_SVE_Pt)
(AARCH64_OPND_SVE_Za_5, AARCH64_OPND_SVE_Za_16, AARCH64_OPND_SVE_Zd)
(AARCH64_OPND_SVE_Zm_5, AARCH64_OPND_SVE_Zm_16, AARCH64_OPND_SVE_Zn)
(AARCH64_OPND_SVE_Zn_INDEX, AARCH64_OPND_SVE_ZnxN)
(AARCH64_OPND_SVE_Zt, AARCH64_OPND_SVE_ZtxN): New aarch64_opnds.
opcodes/
* aarch64-tbl.h (AARCH64_OPERANDS): Add entries for new SVE operands.
* aarch64-opc.h (FLD_SVE_Pd, FLD_SVE_Pg3, FLD_SVE_Pg4_5)
(FLD_SVE_Pg4_10, FLD_SVE_Pg4_16, FLD_SVE_Pm, FLD_SVE_Pn, FLD_SVE_Pt)
(FLD_SVE_Za_5, FLD_SVE_Za_16, FLD_SVE_Zd, FLD_SVE_Zm_5, FLD_SVE_Zm_16)
(FLD_SVE_Zn, FLD_SVE_Zt, FLD_SVE_tzsh): New aarch64_field_kinds.
* aarch64-opc.c (fields): Add corresponding entries here.
(operand_general_constraint_met_p): Check that SVE register lists
have the correct length. Check the ranges of SVE index registers.
Check for cases where p8-p15 are used in 3-bit predicate fields.
(aarch64_print_operand): Handle the new SVE operands.
* aarch64-opc-2.c: Regenerate.
* aarch64-asm.h (ins_sve_index, ins_sve_reglist): New inserters.
* aarch64-asm.c (aarch64_ins_sve_index): New function.
(aarch64_ins_sve_reglist): Likewise.
* aarch64-asm-2.c: Regenerate.
* aarch64-dis.h (ext_sve_index, ext_sve_reglist): New extractors.
* aarch64-dis.c (aarch64_ext_sve_index): New function.
(aarch64_ext_sve_reglist): Likewise.
* aarch64-dis-2.c: Regenerate.
gas/
* config/tc-aarch64.c (NTA_HASVARWIDTH): New macro.
(AARCH64_REG_TYPES): Add ZN and PN.
(get_reg_expected_msg): Handle them.
(parse_vector_type_for_operand): Add a reg_type parameter.
Skip the width for Zn and Pn registers.
(parse_typed_reg): Extend vector handling to Zn and Pn. Update the
call to parse_vector_type_for_operand. Set HASVARTYPE for Zn and Pn,
expecting the width to be 0.
(parse_vector_reg_list): Restrict error about [BHSD]nn operands to
REG_TYPE_VN.
(vectype_to_qualifier): Use S_[BHSD] qualifiers for NTA_HASVARWIDTH.
(parse_operands): Handle the new Zn and Pn operands.
(REGSET16): New macro, split out from...
(REGSET31): ...here.
(reg_names): Add Zn and Pn entries.
2016-09-21 17:53:54 +02:00
|
|
|
AARCH64_DECL_OPD_EXTRACTOR (ext_sve_index);
|
|
|
|
AARCH64_DECL_OPD_EXTRACTOR (ext_sve_reglist);
|
[AArch64][SVE 24/32] Add AARCH64_OPND_SVE_PATTERN_SCALED
Some SVE instructions count the number of elements in a given vector
pattern and allow a scale factor of [1, 16] to be applied to the result.
This scale factor is written ", MUL #n", where "MUL" is a new operator.
E.g.:
UQINCD X0, POW2, MUL #2
This patch adds support for this kind of operand.
All existing operators were shifts of some kind, so there was a natural
range of [0, 63] regardless of context. This was then narrowered further
by later checks (e.g. to [0, 31] when used for 32-bit values).
In contrast, MUL doesn't really have a natural context-independent range.
Rather than pick one arbitrarily, it seemed better to make the "shift"
amount a full 64-bit value and leave the range test to the usual
operand-checking code. I've rearranged the fields of aarch64_opnd_info
so that this doesn't increase the size of the structure (although I don't
think its size is critical anyway).
include/
* opcode/aarch64.h (AARCH64_OPND_SVE_PATTERN_SCALED): New
aarch64_opnd.
(AARCH64_MOD_MUL): New aarch64_modifier_kind.
(aarch64_opnd_info): Make shifter.amount an int64_t and
rearrange the fields.
opcodes/
* aarch64-tbl.h (AARCH64_OPERANDS): Add an entry for
AARCH64_OPND_SVE_PATTERN_SCALED.
* aarch64-opc.h (FLD_SVE_imm4): New aarch64_field_kind.
* aarch64-opc.c (fields): Add a corresponding entry.
(set_multiplier_out_of_range_error): New function.
(aarch64_operand_modifiers): Add entry for AARCH64_MOD_MUL.
(operand_general_constraint_met_p): Handle
AARCH64_OPND_SVE_PATTERN_SCALED.
(print_register_offset_address): Use PRIi64 to print the
shift amount.
(aarch64_print_operand): Likewise. Handle
AARCH64_OPND_SVE_PATTERN_SCALED.
* aarch64-opc-2.c: Regenerate.
* aarch64-asm.h (ins_sve_scale): New inserter.
* aarch64-asm.c (aarch64_ins_sve_scale): New function.
* aarch64-asm-2.c: Regenerate.
* aarch64-dis.h (ext_sve_scale): New inserter.
* aarch64-dis.c (aarch64_ext_sve_scale): New function.
* aarch64-dis-2.c: Regenerate.
gas/
* config/tc-aarch64.c (SHIFTED_MUL): New parse_shift_mode.
(parse_shift): Handle it. Reject AARCH64_MOD_MUL for all other
shift modes. Skip range tests for AARCH64_MOD_MUL.
(process_omitted_operand): Handle AARCH64_OPND_SVE_PATTERN_SCALED.
(parse_operands): Likewise.
2016-09-21 17:55:22 +02:00
|
|
|
AARCH64_DECL_OPD_EXTRACTOR (ext_sve_scale);
|
2012-08-13 16:52:54 +02:00
|
|
|
|
|
|
|
#undef AARCH64_DECL_OPD_EXTRACTOR
|
|
|
|
|
|
|
|
#endif /* OPCODES_AARCH64_DIS_H */
|