Commit Graph

2866 Commits

Author SHA1 Message Date
Jim Wilson 21a186f280 RISC-V: Add compressed instruction hints, and a few misc cleanups.
gas/
	* config/tc-riscv.c (risc_ip) <o>: Add comment.
	* testsuite/gas/riscv/c-nonzero-imm.d,
	* testsuite/gas/riscv/c-nonzero-imm.l,
	* testsuite/gas/riscv/c-nonzero-imm.s,
	* testsuite/gas/riscv/c-nonzero-reg.d,
	* testsuite/gas/riscv/c-nonzero-reg.l,
	* testsuite/gas/riscv/c-nonzero-reg.s,
	* testsuite/gas/riscv/c-zero-imm-64.d,
	* testsuite/gas/riscv/c-zero-imm-64.s,
	* testsuite/gas/riscv/c-zero-imm.d, testsuite/gas/riscv/c-zero-imm.s,
	* testsuite/gas/riscv/c-zero-reg.d,
	* testsuite/gas/riscv/c-zero-reg.s: New.

	opcodes/
	* riscv-opc.c (match_c_add_with_hint, match_c_lui_with_hint): New.
	(riscv_opcodes) <li>: Delete "d,0" line.  Change Cj to Co.
	<andi, and, add, addiw, addw, c.addi>: Change Cj to Co.
	<add>: Add explanatory comment for 4-operand add instruction.
	<c.nop>: Add support for immediate operand.
	<c.mv, c.add>: Use match_c_add_with_hint instead of match_c_add.
	<c.lui>: Use match_c_lui_with_hint instead of match_c_lui.
	<c.li, c.slli>: Use match_opcode instead of match_rd_nonzero.
2017-12-20 13:37:44 -08:00
Tamar Christina 00c2093f69 Correct disassembly of dot product instructions.
Dot products deviate from the normal disassembly rules for lane indexed
instruction. Their canonical representation is in the form of:

v0.2s, v0.8b, v0.4b[0] instead of v0.2s, v0.8b, v0.b[0] to try to denote
that these instructions select 4x 1 byte elements instead of a single 1 byte
element.

Previously we were disassembling them following the normal rules, this patch
corrects the disassembly.

gas/

	PR gas/22559
	* config/tc-aarch64.c (vectype_to_qualifier): Support AARCH64_OPND_QLF_S_4B.
	* gas/testsuite/gas/aarch64/dotproduct.d: Update disassembly.

include/

	PR gas/22559
	* aarch64.h (aarch64_opnd_qualifier): Add AARCH64_OPND_QLF_S_4B.

opcodes/

	PR gas/22559
	* aarch64-asm.c (aarch64_ins_reglane): Change AARCH64_OPND_QLF_S_B to
	AARCH64_OPND_QLF_S_4B
	* aarch64-dis.c (aarch64_ext_reglane): Change AARCH64_OPND_QLF_S_B to
	AARCH64_OPND_QLF_S_4B
	* aarch64-opc.c (aarch64_opnd_qualifiers): Add 4b variant.
	* aarch64-tbl.h (QL_V2DOT): Change S_B to S_4B.
2017-12-19 12:21:12 +00:00
Tamar Christina a3b3345ae6 Add support for V_4B so we can properly reject it.
Previously parse_vector_type_for_operand was changed to allow the use of 4b
register size for indexed lane instructions. However this had the unintended
side effect of also allowing 4b for normal vector registers.

Because this support was only partial the rest of the tool silently treated
4b as 8b and continued. This patch adds full support for 4b so it can be
properly distinguished from 8b and the correct errors are generated.

With this patch you still can't encode any instruction which actually requires
v<num>.4b but such instructions don't exist so to prevent needing a workaround
in get_vreg_qualifier_from_value this was just omitted.

gas/

	PR gas/22529
	* config/tc-aarch64.c (vectype_to_qualifier): Support AARCH64_OPND_QLF_V_4B.
	* gas/testsuite/gas/aarch64/pr22529.s: New.
	* gas/testsuite/gas/aarch64/pr22529.d: New.
	* gas/testsuite/gas/aarch64/pr22529.l: New.

include/

	PR gas/22529
	* opcode/aarch64.h (aarch64_opnd_qualifier): Add AARCH64_OPND_QLF_V_4B.

opcodes/

	PR gas/22529
	* aarch64-opc.c (aarch64_opnd_qualifiers): Add 4b variant.
2017-12-19 12:19:15 +00:00
Jan Beulich 10c17abdd0 x86: fold certain AVX and AVX2 templates
Just like for instructions in GPRs, there's no need to have separate
templates for otherwise identical insns acting on XMM or YMM registers
(or memory of the same size).
2017-12-18 09:37:15 +01:00
Jan Beulich 1b54b8d7e4 x86: fold RegXMM/RegYMM/RegZMM into RegSIMD
... qualified by their respective sizes, allowing to drop FirstXmm0 at
the same time.
2017-12-18 09:36:14 +01:00
Jan Beulich ca0d63fe07 x86: drop FloatReg and FloatAcc
Express them as Reg|Tbyte and Acc|Tbyte respectively.
2017-12-18 09:35:01 +01:00
Jan Beulich dc821c5f9a x86: replace Reg8, Reg16, Reg32, and Reg64
Use a combination of a single new Reg bit and Byte, Word, Dword, or
Qword instead.

Besides shrinking the number of operand type bits this has the benefit
of making register handling more similar to accumulator handling (a
generic flag is being accompanied by a "size qualifier"). It requires,
however, to split a few insn templates, as it is no longer correct to
have combinations like Reg32|Reg64|Byte. This slight growth in size will
hopefully be outweighed by this change paving the road for folding a
presumably much larger number of templates later on.
2017-12-18 09:34:00 +01:00
Dimitar Dimitrov fbc2255575 Fix disassembly for PowerPC
* disassemble.c (disassemble_init_for_target): Don't put PRU
	between powerpc and rs6000 cases.
2017-12-15 19:52:49 +10:30
Jan Beulich 93b71a2666 x86: drop stray CheckRegSize uses
They are relevant only when multiple operands permit registers:
operand_type_register_match() returns true if either operand is not a
register one. IOW

grep -i CheckRegSize i386-opc.tbl | grep -Ev "(Reg[8136]|Acc).*,.*(Reg|Acc)"

should produce no output.
2017-12-15 09:13:54 +01:00
Jim Wilson 25982ee022 Add missing RISC-V fsrmi and fsflagsi instructions.
PR 22599
	gas/
	* testsuite/gas/riscv/fsxxi.d, testsuite/gas/riscv/fsxxi.s: New.
	opcodes/
	* riscv-opc.c (riscv_opcodes) <fsrmi, fsflagsi>: New.
2017-12-13 14:59:42 -08:00
Dimitar Dimitrov 024d185c10 This patch enables disassembler_needs_relocs for PRU. It is needed to print correct symbols when disassembling arguments of "call" instructions with a relocation.
opcodes	* disassemble.c: Enable disassembler_needs_relocs for PRU.

gas	* testsuite/gas/pru/extern.s: New test for print of U16_PMEMM
	relocation.
	* testsuite/gas/pru/extern.d: New test driver.
2017-12-13 13:09:59 +00:00
Renlin Li 4c5ae11b42 [Binutils][Objdump]Check symbol section information while search a mapping symbol backward.
When checking mapping symbols backwardly, the section which defines the symbol
is not considerted. This patch fixes this by moving the section checking code
into get_sym_code_type () function which is shared by forward and backword
mapping symbol searching.

opcodes/

2017-12-11  Petr Pavlu  <petr.pavlu@arm.com>
	    Renlin Li  <renlin.li@arm.com>

	* aarch64-dis.c (print_insn_aarch64): Move symbol section check ...
	(get_sym_code_type): Here.

binutils/

2017-12-11  Renlin Li  <renlin.li@arm.com>

	* testsuite/binutils-all/aarch64/objdump.d: New.
	* testsuite/binutils-all/aarch64/objdump.s: New.
2017-12-11 15:42:47 +00:00
Alan Modra f143cb5fc6 Fix "FAIL: VLE relocations 3"
Correct sign extension.

	* ppc-opc.c (extract_li20): Rewrite.
2017-12-03 21:54:47 +10:30
Peter Bergner 0f873fd58b Use consistent types for holding instructions, instruction masks, etc.
include/
	* opcode/ppc.h (PPC_INT_FMT): Define.
	(struct powerpc_opcode) <opcode>: Update type.
	(struct powerpc_opcode) <mask>: Likewise.
	(struct powerpc_opcode) <bitm>: Likewise.
	(struct powerpc_opcode) <insert>: Likewise.
	(struct powerpc_opcode) <extract>: Likewise.
	(ppc_optional_operand_value): Likewise.

gas/
	* config/tc-ppc.c (last_insn): Update type.
	(insn_validate) <omask, mask>: Likewise.
	(ppc_setup_opcodes) <mask, right_bit>: Likewise.
	<PRINT_OPCODE_TABLE>: Update types and printf format specifiers.
	(ppc_insert_operand): Update return and argument types and remove
	unneeded type casts.
	<min, max, right, tmp>: Update type.
	(md_assemble): Remove unneeded type casts.
	<insn, val, tmp_insn>: Update type.

opcodes/
	* opcodes/ppc-dis.c (disassemble_init_powerpc): Fix white space.
	(operand_value_powerpc): Update return and argument type.
	<value, top>: Update type.
	(skip_optional_operands): Update argument type.
	(lookup_powerpc): Likewise.
	(lookup_vle): Likewise.
	<table_opcd, table_mask, insn2>: Update type.
	(lookup_spe2): Update argument type.
	<table_opcd, table_mask, insn2>: Update type.
	(print_insn_powerpc) <insn, value>: Update type.
	Use PPC_INT_FMT for printing instructions and operands.
	* opcodes/ppc-opc.c (insert_arx, extract_arx, insert_ary, extract_ary,
	insert_rx, extract_rx, insert_ry, extract_ry, insert_bat, extract_bat,
	insert_bba, extract_bba, insert_bdm, extract_bdm, insert_bdp,
	extract_bdp, valid_bo_pre_v2, valid_bo_post_v2, valid_bo, insert_bo,
	extract_bo, insert_boe, extract_boe, insert_dcmxs, extract_dcmxs,
	insert_dxd, extract_dxd, insert_dxdn, extract_dxdn, insert_fxm,
	extract_fxm, insert_li20, extract_li20, insert_ls, extract_ls,
	insert_esync, extract_esync, insert_mbe, extract_mbe, insert_mb6,
	extract_mb6, extract_nb, insert_nbi, insert_nsi, extract_nsi,
	insert_ral, extract_ral, insert_ram, extract_ram, insert_raq,
	extract_raq, insert_ras, extract_ras, insert_rbs, extract_rbs,
	insert_rbx, extract_rbx, insert_sci8, extract_sci8, insert_sci8n,
	extract_sci8n, insert_sd4h, extract_sd4h, insert_sd4w, extract_sd4w,
	insert_oimm, extract_oimm, insert_sh6, extract_sh6, insert_spr,
	extract_spr, insert_sprg, extract_sprg, insert_tbr, extract_tbr,
	insert_xt6, extract_xt6, insert_xtq6, extract_xtq6, insert_xa6,
	extract_xa6, insert_xb6, extract_xb6, insert_xb6s, extract_xb6s,
	insert_xc6, extract_xc6, insert_dm, extract_dm, insert_vlesi,
	extract_vlesi, insert_vlensi, extract_vlensi, insert_vleui,
	extract_vleui, insert_vleil, extract_vleil, insert_evuimm1_ex0,
	extract_evuimm1_ex0, insert_evuimm2_ex0, extract_evuimm2_ex0,
	insert_evuimm4_ex0, extract_evuimm4_ex0, insert_evuimm8_ex0,
	extract_evuimm8_ex0, insert_evuimm_lt8, extract_evuimm_lt8,
	insert_evuimm_lt16, extract_evuimm_lt16, insert_rD_rS_even,
	extract_rD_rS_even, insert_off_lsp, extract_off_lsp, insert_off_spe2,
	extract_off_spe2, insert_Ddd, extract_Ddd): Update types.
	(OP, OPTO, OPL, OPVUP, OPVUPRT, A, AFRALFRC_MASK, B, BD8, BD8IO, BD15,
	BD24, BBO, Y_MASK  , AT1_MASK, AT2_MASK, BBOCB, C_LK, C, CTX, UCTX,
	DX, EVSEL, IA16, I16A, I16L, IM7, LI20, MME, MD, MDS, SC, SC_MASK,
	SCI8, SCI8BF, SD4, SE_IM5, SE_R, SE_RR, VX, VX_LSP, VX_RA_CONST,
	VX_RB_CONST, VX_SPE_CRFD, VX_SPE2_CLR, VX_SPE2_SPLATB, VX_SPE2_OCTET,
	VX_SPE2_DDHH, VX_SPE2_HH, VX_SPE2_EVMAR, VX_SPE2_EVMAR_MASK, VXA,
	VXR, VXASH, X, EX, XX2, XX3, XX3RC, XX4, Z, XWRA_MASK, XLRT_MASK,
	XRLARB_MASK, XLRAND_MASK, XRTLRA_MASK, XRTLRARB_MASK, XRTARARB_MASK,
	XRTBFRARB_MASK, XOPL, XOPL2, XRCL, XRT, XRTRA, XCMP_MASK, XCMPL_MASK,
	XTO, XTLB, XSYNC, XEH_MASK, XDSS, XFL, XISEL, XL, XLO, XLYLK, XLOCB,
	XMBAR, XO, XOPS, XS, XFXM, XSPR, XUC, XW, APU): Update types in casts.
2017-12-01 11:20:15 -06:00
Jan Beulich 7ac2002247 x86: derive DispN from BaseIndex
BaseIndex implies - with the exception of string instructions the
optional presence of a displacement. This is almost completely uniform
for all instructions (the sole exception being MPX ones, which don't
allow 16-bit addressing and hence Disp16), so there's no point in
explicitly stating this in the main opcode table. Drop those explict
specifications in favor of adding logic to i386-gen, shrinking the
table size quite a bit and hence making it more readable.

The opcodes/i386-tbl.h changes are due to a few cases where pointless
Disp* still hadn't been removed from their insns.
2017-11-30 11:48:13 +01:00
Jan Beulich b5014f7af2 x86: drop Vec_Disp8
This is fully redundant with Disp8MemShift being non-zero, and hence can
be folded with normal Disp8 handling.
2017-11-30 11:47:38 +01:00
Stefan Stroe ca39c2f4dd Support --localedir, --datarootdir and --datadir
bfd/
	* po/Make-in (datadir): Define as @datadir@.
	(localedir): Define as @localedir@.
	(gnulocaledir, gettextsrcdir): Use @datarootdir@.
binutils/
	* po/Make-in (datadir): Define as @datadir@.
	(localedir): Define as @localedir@.
	(gnulocaledir, gettextsrcdir): Use @datarootdir@.
gas/
	* po/Make-in (datadir): Define as @datadir@.
	(localedir): Define as @localedir@.
	(gnulocaledir, gettextsrcdir): Use @datarootdir@.
gold/
	* po/Make-in (datadir): Define as @datadir@.
	(localedir): Define as @localedir@.
	(gnulocaledir, gettextsrcdir): Use @datarootdir@.
gprof/
	* po/Make-in (datadir): Define as @datadir@.
	(localedir): Define as @localedir@.
	(gnulocaledir, gettextsrcdir): Use @datarootdir@.
ld/
	* po/Make-in (datadir): Define as @datadir@.
	(localedir): Define as @localedir@.
	(gnulocaledir, gettextsrcdir): Use @datarootdir@.
opcodes/
	* po/Make-in (datadir): Define as @datadir@.
	(localedir): Define as @localedir@.
	(gnulocaledir, gettextsrcdir): Use @datarootdir@.
2017-11-29 20:10:52 +10:30
Nick Clifton 64973b0ac4 Update the simplified Chinese translation of the messages in the opcodes library.
* po/zh_CN.po: Updated simplified Chinese translation.
2017-11-27 11:14:38 +00:00
Jan Beulich ac465521a5 x86: don't omit disambiguating suffixes from "fi*"
"fi*" typically come in two (loads/stores: three) flavors, distinguished
by the suffix. Don't omit the 's' one when disassembling.
2017-11-24 08:42:04 +01:00
Igor Tsimbalist be7d1531e1 Add Disp8MemShift for AVX512 VAES instructions.
opcodes/
	* i386-opc.tbl: Add Disp8MemShift for AVX512 VAES instructions.
	* i386-tbl.h: Regenerate.

gas/
	* testsuite/gas/i386/avx512f_vaes-intel.d: Regenerate.
	* testsuite/gas/i386/avx512f_vaes.d: Likewise.
	* testsuite/gas/i386/avx512f_vaes-wig1-intel.d: Likewise.
	* testsuite/gas/i386/avx512f_vaes-wig1.d: Likewise.
	* testsuite/gas/i386/avx512vl_vaes-intel.d: Likewise.
	* testsuite/gas/i386/avx512vl_vaes.d: Likewise.
	* testsuite/gas/i386/x86-64-avx512f_vaes.s: Add instructions with disp8*N.
	* testsuite/gas/i386/x86-64-avx512f_vaes-intel.d: Regenerate.
	* testsuite/gas/i386/x86-64-avx512f_vaes.d: Likewise.
	* testsuite/gas/i386/x86-64-avx512f_vaes-wig.s: Add instructions with disp8*N.
	* testsuite/gas/i386/x86-64-avx512f_vaes-wig1-intel.d: Regenerate.
	* testsuite/gas/i386/x86-64-avx512f_vaes-wig1.d: Likewise.
	* testsuite/gas/i386/x86-64-avx512vl_vaes-intel.d: Regenerate.
	* testsuite/gas/i386/x86-64-avx512vl_vaes.d: Likewise.
	* testsuite/gas/i386/x86-64-avx512vl_vaes-wig.s: Add instructions with disp8*N.
	* testsuite/gas/i386/x86-64-avx512vl_vaes-wig1-intel.d: Regenerate.
	* testsuite/gas/i386/x86-64-avx512vl_vaes-wig1.d: Regenerate.
2017-11-23 18:25:49 +03:00
Jan Beulich 65f3ed048f x86: fix AVX-512 16-bit addressing
Despite EVEX encodings not being available in real and VM86 modes,
16-bit addressing still needs to be handled properly for 16-bit
protected mode as well as 16-bit addressing in 32-bit mode. Neither
should displacements be dropped silently by the assembler, nor should
the disassembler fail to correctly scale 8-bit displacements.
2017-11-23 11:04:18 +01:00
Jan Beulich 66f1eba0b7 x86: correct UDn
Make the assembler recognize UD0, supporting only the newer form
expecting a ModR/M byte.

Make assembler and disassembler properly emit / expect a ModR/M byte for
UD1.

For the testsuite, as arch-4 already tests all UDn, avoid producing a
huge delta for other tests using UD2B by making them use UD2 instead.
2017-11-23 10:59:48 +01:00
Igor Tsimbalist 94b98370de Remove Vec_Disp8 field for vgf2p8mulb for AVX flavor.
* i386-opc.tbl: Remove Vec_Disp8 from vgf2p8mulb.
	* i386-tbl.h: Regenerate.
2017-11-22 17:41:04 +03:00
Igor Tsimbalist 6f19e86dac Update ChangeLog 2017-11-22 17:23:38 +03:00
Igor Tsimbalist c7478d028e Remove Vec_Disp8 from vpcompressb and vpexpandb.
* i386-opc.tbl: Remove Vec_Disp8 from vpcompressb and vpexpandb.
	* i386-tbl.h: Regenerate.
2017-11-22 17:13:55 +03:00
claziss dc95848142 [ARC] Fix handling of ARCv2 H-register class.
For ARCv2, h-regs are only valid unitl r31.

gas/
2017-11-21  Claudiu Zissulescu <claziss@synopsys.com>

        * testsuite/gas/arc/hregs-err.s: New test.

opcodes/
2017-11-21  Claudiu Zissulescu <claziss@synopsys.com>

        * arc-opc.c (insert_rhv2): Check h-regs range.
2017-11-22 10:46:45 +01:00
claziss 50d2740d56 [ARC] Improve printing of pc-relative instructions.
opcodes/
2017-11-21  Claudiu Zissulescu <claziss@synopsys.com>

	* arc-dis.c (print_insn_arc): Pretty print pc-relative offsets.
	* arc-opc.c (SIMM21_A16_5): Make it pc-relative.

gas/
2017-11-21  Claudiu Zissulescu <claziss@synopsys.com>

	* testsuite/gas/arc/b.d : Update test.
	* testsuite/gas/arc/bl.d: Likewise.
	* testsuite/gas/arc/jli-1.d: Likewise.
	* testsuite/gas/arc/lp.d: Likewise.
	* testsuite/gas/arc/pcl-relocs.d: Likewise.
	* testsuite/gas/arc/pcrel-relocs.d: Likewise.
	* testsuite/gas/arc/pic-relocs.d: Likewise.
	* testsuite/gas/arc/plt-relocs.d: Likewise.
	* testsuite/gas/arc/pseudos.d: Likewise.
	* testsuite/gas/arc/relax-avoid2.d: Likewise.
	* testsuite/gas/arc/relax-avoid3.d: Likewise.
	* testsuite/gas/arc/relax-b.d: Likewise.
	* testsuite/gas/arc/tls-relocs.d: Likewise.
	* testsuite/gas/arc/relax-add01.d: Likewise.
	* testsuite/gas/arc/relax-add04.d: Likewise.
	* testsuite/gas/arc/relax-ld01.d: Likewise.
	* testsuite/gas/arc/relax-sub01.d: Likewise.
	* testsuite/gas/arc/relax-sub02.d: Likewise.
	* testsuite/gas/arc/relax-sub04.d: Likewise.
	* testsuite/gas/arc/pcl-print.s: New file.
	* testsuite/gas/arc/pcl-print.d: Likewise.
	* testsuite/gas/arc/nps400-12.d: Likewise.

ld/
2017-11-21  Claudiu Zissulescu <claziss@synopsys.com>

	* testsuite/ld-arc/jli-simple.d: Update test.
2017-11-21 14:56:16 +01:00
Tamar Christina d0f7791c66 Add new AArch64 FP16 FM{A|S} instructions.
This patch separates the new FP16 instructions backported from Armv8.4-a to Armv8.2-a
into a new flag order to distinguish them from the rest of the already existing optional
FP16 instructions in Armv8.2-a.

The new flag "+fp16fml" is available from Armv8.2-a and implies +fp16 and is mandatory on
Armv8.4-a.

gas/

	* config/tc-aarch64.c (fp16fml): New.
	* doc/c-aarch64.texi (fp16fml): New.
	* testsuite/gas/aarch64/armv8_2-a-crypto-fp16.d (fp16): Make fp16fml.
	* testsuite/gas/aarch64/armv8_3-a-crypto-fp16.d (fp16): Make fp16fml.

include/

	* opcode/aarch64.h: (AARCH64_FEATURE_F16_FML): New.
	(AARCH64_ARCH_V8_4): Enable AARCH64_FEATURE_F16_FML by default.

opcodes/

	* aarch64-tbl.h (aarch64_feature_fp_16_v8_2): Require AARCH64_FEATURE_F16_FML
	and AARCH64_FEATURE_F16.
2017-11-16 16:27:35 +00:00
Tamar Christina fadfa6b002 Correct AArch64 crypto dependencies.
The crypto options depend on SIMD and FP, the documentation states so but the dependency is not there the code.

We have mostly gotten away with this due to the default flags
for the architectures (e.g. Armv8.2-a  implies +simd) but this
discrepancy needs to be addressed.

gas/

2017-11-16  Tamar Christina  <tamar.christina@arm.com>

	* opcodes/aarch64-tbl.h
	(aarch64_feature_crypto): Add ARCH64_FEATURE_SIMD and AARCH64_FEATURE_FP.
	(aarch64_feature_crypto_v8_2, aarch64_feature_sm4): Likewise.
	(aarch64_feature_sha3): Likewise.
2017-11-16 16:27:35 +00:00
Tamar Christina e9dbdd80cb Add assembler and disassembler support for the new Armv8.4-a instructions for AArch64.
Some of these instructions have been back-ported as optional extensions to
Armv8.2-a and higher, but others are only available for Armv8.4-a.

opcodes/

	* aarch64-tbl.h (sha512h, sha512h2, sha512su0, sha512su1, eor3): New.
	(rax1, xar, bcax, sm3ss1, sm3tt1a, sm3tt1b, sm3tt2a, sm3tt2b): New.
	(sm3partw1, sm3partw2, sm4e, sm4ekey, fmlal, fmlsl): New.
	(fmlal2, fmlsl2, cfinv, rmif, setf8, setf16, stlurb): New.
	(ldapurb, ldapursb, stlurh, ldapurh, ldapursh, stlur): New.
	(ldapur, ldapursw, stlur): New.
	* aarch64-dis-2.c: Regenerate.

gas/

	* testsuite/gas/aarch64/armv8_4-a-illegal.d: New.
	* testsuite/gas/aarch64/armv8_4-a-illegal.l: New.
	* testsuite/gas/aarch64/armv8_4-a-illegal.s: New.
	* testsuite/gas/aarch64/armv8_4-a.d: New.
	* testsuite/gas/aarch64/armv8_4-a.s: New.
	* testsuite/gas/aarch64/armv8_2-a-crypto-fp16.s: New.
	* testsuite/gas/aarch64/armv8_2-a-crypto-fp16.d: New.
	* testsuite/gas/aarch64/armv8_3-a-crypto-fp16.d: New.
	* testsuite/gas/aarch64/armv8_4-a-crypto-fp16.d: New.
	* testsuite/gas/aarch64/armv8_2-a-crypto-fp16-illegal.s: New.
	* testsuite/gas/aarch64/armv8_2-a-crypto-fp16-illegal.l: New.
	* testsuite/gas/aarch64/armv8_2-a-crypto-fp16-illegal.d: New.
2017-11-16 16:27:35 +00:00
Jan Beulich 5f847646ee x86: ignore high register select bit(s) in 32- and 16-bit modes
While commits 9889cbb14e ("Check invalid mask registers") and
abfcb414b9 ("X86: Ignore REX_B bit for 32-bit XOP instructions") went a
bit into the right direction, this wasn't quite enough:
- VEX.vvvv has its high bit ignored
- EVEX.vvvv has its high bit ignored together with EVEX.v'
- the high bits of {,E}VEX.vvvv should not be prematurely zapped, to
  allow proper checking of them when the fields has to hold al ones
- when the high bits of an immediate specify a register, bit 7 is
  ignored
2017-11-16 13:56:45 +01:00
Jan Beulich 390a67891e x86: use correct register names
VEX.W may be legitimately set (and is then ignored by the CPU) for
non-64-bit code. Don't print 64-bit register names in such a case, by
utilizing that REX_W would never be set for non-64-bit code, and that
it is being set from VEX.W by generic decoding.

A test for this is going to be introduced in the next patch of this
series.
2017-11-15 08:52:05 +01:00
Jan Beulich 3a2430e05b x86: drop VEXI4_Fixup()
The low four bits of an immediate being set when the high bits specify a
fourth register operand is not a problem: CPUs ignore these bits rather
than raising #UD. Take care of incrementing codep in OP_EX_VexW()
instead.
2017-11-15 08:51:03 +01:00
Jan Beulich 0645f0a2a7 x86-64: don't allow use of %axl as accumulator
Just like %cxl can't be used as shift count register. Otherwise for
consistency %cxl would need to gain "ShiftCount" and use of both ought
to properly cause REX prefixes to be emitted.
2017-11-15 08:48:51 +01:00
Jan Beulich be92cb147d x86: add disassembler support for XOP VPCOM* pseudo-ops
Matching up with the assembler, which already supports them.
2017-11-14 08:43:26 +01:00
Jan Beulich 2645e1d079 x86: add support for AVX-512 VPCMP*{B,W} pseudo-ops
... matching up with VPCMP*{D,Q}.
2017-11-14 08:42:26 +01:00
Jan Beulich df145ef656 x86: string insns don't allow displacements
Remove the misleading indicators from the table.
2017-11-14 08:40:48 +01:00
Jan Beulich 897e603cb9 x86: {f,}xsave64 / {f,}xrstor64 / xsaveopt64 should not allow q suffix
Just like is the case for xsave{s,c}64 and xrstors64 already. I wonder
though why xsave{s,c} and xrstors don't allow for the q suffix, other
than the other insns without the "64" suffix do.
2017-11-13 12:21:29 +01:00
Tamar Christina 793a194839 Add assembler and disassembler support for the new Armv8.4-a registers for AArch64.
Some of these instructions have been back-ported as optional extensions to
Armv8.2-a and higher, but others are only available for Armv8.4-a.

opcodes/

	* aarch64-opc.c (aarch64_sys_regs): Add ARMv8.4-a registers;
	dit, vstcr_el2, vsttbr_el2, cnthvs_tval_el2, cnthvs_cval_el2,
	cnthvs_ctl_el2, cnthps_tval_el2, cnthps_cval_el2, cnthps_ctl_el2,
	sder32_el2, vncr_el2.
	(aarch64_sys_reg_supported_p): Likewise.
	(aarch64_pstatefields): Add dit register.
	(aarch64_pstatefield_supported_p): Likewise.
	(aarch64_sys_regs_tlbi): Add vmalle1os, vae1os, aside1os, vaae1os,
	vale1os, vaale1os, ipas2e1os, ipas2le1os, vae2os, vale2os, vmalls12e1os,
	vae3os, vale3os, alle2os, alle1os, alle3os, rvae1, rvaae1, rvale1,
	rvaale1, rvae1is, rvaae1is, rvale1is, rvaale1is, rvae1os, rvaae1os,
	rvale1os, rvaale1os, ripas2e1is, ripas2le1is, ripas2e1, ripas2le1,
	ripas2e1os, ripas2le1os, rvae2, rvale2, rvae2is, rvale2is, rvae2os,
	rvale2os, rvae3, rvale3, rvae3is, rvale3is, rvae3os, rvale3os.

gas/testsuite

	* gas/aarch64/armv8_4-a-registers-illegal.d: New.
	* gas/aarch64/armv8_4-a-registers-illegal.l: New.
	* gas/aarch64/armv8_4-a-registers-illegal.s: New.
	* gas/aarch64/armv8_4-a-registers.d: New.
	* gas/aarch64/armv8_4-a-registers.s: New.
2017-11-09 16:29:16 +00:00
Tamar Christina 1a7ed57c84 Add the operand encoding types for the new Armv8.2-a back-ported instructions. These are to be used later when the new instructions are added.
opcodes/
	* aarch64-tbl.h (QL_SHA512UPT, QL_V2SAME2D, QL_V3SAME2D): New.
	(QL_V4SAME16B, QL_V4SAME4S, QL_XAR, QL_SM3TT, QL_V3FML2S): New.
	(QL_V3FML4S, QL_V2FML2S, QL_V2FML4S, QL_RMIF, QL_SETF): New.
	(QL_STLW, QL_STLX): New.
2017-11-09 16:29:07 +00:00
Tamar Christina f42f1a1d6c Adds the new Fields and Operand types for the new instructions in Armv8.4-a.
gas/
	* config/tc-aarch64.c (process_omitted_operand):
	Add AARCH64_OPND_Va, AARCH64_OPND_SM3_IMM2
	and AARCH64_OPND_IMM_2.
	(parse_operands): Add AARCH64_OPND_Va, AARCH64_OPND_SM3_IMM2,
	AARCH64_OPND_IMM_2, AARCH64_OPND_MASK
	and AARCH64_OPND_ADDR_OFFSET.

include/
	* opcode/aarch64.h:
	(aarch64_opnd): Add AARCH64_OPND_Va, AARCH64_OPND_MASK,
	AARCH64_OPND_IMM_2, AARCH64_OPND_ADDR_OFFSET
	and AARCH64_OPND_SM3_IMM2.
	(aarch64_insn_class): Add cryptosm3 and cryptosm4.
	(arch64_feature_set): Make uint64_t.

opcodes/
	* aarch64-asm.h (ins_addr_offset): New.
	* aarch64-asm.c (aarch64_ins_reglane): Add cryptosm3.
	(aarch64_ins_addr_offset): New.
	* aarch64-asm-2.c: Regenerate.
	* aarch64-dis.h (ext_addr_offset): New.
	* aarch64-dis.c (aarch64_ext_reglane): Add cryptosm3.
	(aarch64_ext_addr_offset): New.
	* aarch64-dis-2.c: Regenerate.
	* aarch64-opc.h (aarch64_field_kind): Add FLD_imm6_2,
	FLD_imm4_2 and FLD_SM3_imm2.
	* aarch64-opc.c (fields): Add FLD_imm6_2,
	FLD_imm4_2 and FLD_SM3_imm2.
	(operand_general_constraint_met_p): Add AARCH64_OPND_ADDR_OFFSET.
	(aarch64_print_operand): Add AARCH64_OPND_Va, AARCH64_OPND_SM3_IMM2,
	AARCH64_OPND_MASK, AARCH64_OPND_IMM_2 and AARCH64_OPND_ADDR_OFFSET.
	* aarch64-opc-2.c (Va, MASK, IMM_2, ADDR_OFFSET, SM3_IMM2): New.
	* aarch64-tbl.h
	(aarch64_opcode_table): Add Va, MASK, IMM_2, ADDR_OFFSET, SM3_IMM2.
2017-11-09 16:29:04 +00:00
Tamar Christina b6b9ca0c3e Split the ARM Crypto ISA extensions for AES and SHA1+2 into their own options (+aes and +sha2). The reason for the split is because with the introduction of Armv8.4-a the implementation of AES has explicitly been made independent of the implementation of the other crypto extensions.
gas	* config/tc-aarch64.c (aarch64_arch_option_table): Add armv8.4-a.
	(aarch64_features):	Added SM4 and SHA3.

include	* opcode/aarch64.h:
	(AARCH64_FEATURE_V8_4, AARCH64_FEATURE_SM4): New.
	(AARCH64_ARCH_V8_4, AARCH64_FEATURE_SHA3): New.

opcodes	* aarch64-tbl.h
	(aarch64_feature_v8_4, aarch64_feature_crypto_v8_2): New.
	(aarch64_feature_sm4, aarch64_feature_sha3): New.
	(aarch64_feature_fp_16_v8_2): New.
	(ARMV8_4, SHA3, SM4, CRYPTO_V8_2, FP_F16_V8_2): New.
	(V8_4_INSN, CRYPTO_V8_2_INSN): New.
	(SHA3_INSN, SM4_INSN, FP16_V8_2_INSN): New.
2017-11-09 11:21:31 +00:00
Nick Clifton c0e7cef715 Split the AArch64 Crypto instructions for AES and SHA1+2 into their own options (+aes and +sha2).
The new options are:

	+aes: Enables the AES instructions of Armv8-a,
	      enabled by default with +crypto.

	+sha2: Enables the SHA1 and SHA2 instructions of Armv8-a,
	       enabled by default with +crypto.

These options have been turned on by default when +crypto
is used, as such no breakage is expected.

The reason for the split is because with the introduction of Armv8.4-a
the implementation of AES has explicitly been made independent of the
implementation of the other crypto extensions. Backporting the split does
not break any of the previous requirements and so is safe to do.

gas	* config/tc-aarch64.c
	(aarch64_features): Include AES and SHA2 in CRYPTO.
	Add SHA2 and AES.

include	* opcode/aarch64.h:
	(AARCH64_FEATURE_SHA2, AARCH64_FEATURE_AES): New.

opcodes	* aarch64-tbl.h (aarch64_feature_crypto): Add AES and SHA2.
	(aarch64_feature_sha2, aarch64_feature_aes): New.
	(SHA2, AES): New.
	(AES_INSN, SHA2_INSN): New.
	(pmull, pmull2, aese, aesd, aesmc, aesimc): Change to AES_INS.
	(sha1h, sha1su1, sha256su0, sha1c, sha1p,
	 sha1m, sha1su0, sha256h, sha256h2, sha256su1):
	Change to SHA2_INS.
2017-11-08 14:30:53 +00:00
Jiong Wang dec41383ff Adds command line support for Armv8.4-A, via the new command line option -march=armv8.4-a. Add support for "+dotprod" ARM feature (required for ARMv8.4-A). Add assembler and disassembler support for new FP16 instructions introduced in Armv8.4-A
gas	* config/tc-arm.c (arm_extensions):
	(arm_archs): New entry for "armv8.4-a".
	Add FPU_ARCH_DOTPROD_NEON_VFP_ARMV8.
	(arm_ext_v8_2): New variable.
	(enum arm_reg_type): New enumeration REG_TYPE_NSD.
	(reg_expected_msgs): New entry for REG_TYPE_NSD.
	(parse_typed_reg_or_scalar): Handle REG_TYPE_NSD.
	(parse_scalar): Support REG_TYPE_VFS.
	(enum operand_parse_code): New enumerations OP_RNSD and OP_RNSD_RNSC.
	(parse_operands): Handle OP_RNSD and OP_RNSD_RNSC.
	(NEON_SHAPE_DEF): New entries for DHH and DHS.
	(neon_scalar_for_fmac_fp16_long): New function to generate Rm encoding
	for new FP16 instructions in ARMv8.2-A.
	(do_neon_fmac_maybe_scalar_long): New function to encode new FP16
	instructions in ARMv8.2-A.
	(do_neon_vfmal): Wrapper function for vfmal.
	(do_neon_vfmsl): Wrapper function for vfmsl.
	(insns): New entries for vfmal and vfmsl.
	* doc/c-arm.texi (-march): Document "armv8.4-a".
	* testsuite/gas/arm/dotprod-mandatory.d: New test.
	* testsuite/gas/arm/armv8_2-a-fp16.s: New test source.
	* testsuite/gas/arm/armv8_2-a-fp16-illegal.s: New test source.
	* testsuite/gas/arm/armv8_2-a-fp16.d: New test.
	* testsuite/gas/arm/armv8_3-a-fp16.d: New test.
	* testsuite/gas/arm/armv8_4-a-fp16.d: New test.
	* testsuite/gas/arm/armv8_2-a-fp16-thumb2.d: New test.
	* testsuite/gas/arm/armv8_2-a-fp16-illegal.d: New test.
	* testsuite/gas/arm/armv8_2-a-fp16-illegal.l: New error file.

opcodes	* arm-dis.c (coprocessor_opcodes): New entries for ARMv8.2-A new
	FP16 instructions, including vfmal.f16 and vfmsl.f16.

include	* opcode/arm.h (ARM_AEXT2_V8_4A): Include Dot Product feature.
	(ARM_EXT2_V8_4A): New macro.
	(ARM_AEXT2_V8_4A): Likewise.
	(ARM_ARCH_V8_4A): Likewise.
2017-11-08 13:15:12 +00:00
Andrew Burgess 52eab766df opcodes/arc: Fix incorrect insn_class for some nps insns
A small number of NPS400 instruction incorrectly used NONE as an
insn_class_t, which would trigger a build warning.  Fixed by changing to
MISC.

opcodes/ChangeLog:

	* arc-nps400-tbl.h: Change incorrect use of NONE to MISC.
2017-11-07 20:24:21 +00:00
Alan Modra 6003e27e76 ngettext support
binutils has lacked proper pluralization of output messages for a long
time, for example, readelf will display information about a section
that "contains 1 entries" or "There are 1 section headers".  Fixing
this properly requires us to use ngettext, because other languages
have different rules to English.

This patch defines macros for ngettext and friends to handle builds
with --disable-nls, and tidies the existing nls support.  I've
redefined gettext rather than just defining "_" as dgettext in bfd and
opcodes in case someone wants to use gettext there (which might
conceivably happen with generated code).

bfd/
	* sysdep.h: Formatting, comment fixes.
	(gettext, ngettext): Redefine when ENABLE_NLS.
	(ngettext, dngettext, dcngettext): Define when !ENABLE_NLS.
	(_): Define using gettext.
	(textdomain, bindtextdomain): Use safer "do nothing".
	* hosts/alphavms.h (textdomain, bindtextdomain): Likewise.
	(ngettext, dngettext, dcngettext): Define when !ENABLE_NLS.
opcodes/
	* opintl.h: Formatting, comment fixes.
	(gettext, ngettext): Redefine when ENABLE_NLS.
	(ngettext, dngettext, dcngettext): Define when !ENABLE_NLS.
	(_): Define using gettext.
	(textdomain, bindtextdomain): Use safer "do nothing".
binutils/
	* sysdep.h (textdomain, bindtextdomain): Use safer "do nothing".
	(ngettext, dngettext, dcngettext): Define when !ENABLE_NLS.
gas/
	* asintl.h (textdomain, bindtextdomain): Use safer "do nothing".
	(ngettext, dngettext, dcngettext): Define when !ENABLE_NLS.
gold/
	* system.h (textdomain, bindtextdomain): Use safer "do nothing".
	(ngettext, dngettext, dcngettext): Define when !ENABLE_NLS.
ld/
	* ld.h (textdomain, bindtextdomain): Use safer "do nothing".
	(ngettext, dngettext, dcngettext): Define when !ENABLE_NLS.
2017-11-07 15:52:52 +10:30
claziss fdddd2900f [ARC] Force the disassam to use the hexadecimal number for printing
Force printing of the short/signed values using hexadecimal
representation via disassembler option.

opcode/
2017-11-03  Claudiu Zissulescu  <claziss@synopsys.com>

        * arc-dis.c (print_hex): New variable.
        (parse_option): Check for hex option.
        (print_insn_arc): Use hexadecimal representation for short
        immediate values when requested.
        (print_arc_disassembler_options): Add hex option to the list.

binutils/
2017-11-03  Claudiu Zissulescu  <claziss@synopsys.com>

        * doc/binutils.texi (ARC): Update disassembler options.
        * testsuite/binutils-all/arc/hexprint.s: New file.
        * testsuite/binutils-all/arc/objdump.exp: Test hex printing feature.
2017-11-03 15:36:54 +01:00
claziss 3334eba7f4 [ARC] Sync opcode data base.
New EM and HS variants are developed, sync the data base to match them.

opcodes/
2017-11-03  Claudiu Zissulescu  <claziss@synopsys.com>

        * arc-tbl.h (abss, abssh, adc, adcs, adds, aslacc, asls, aslsacc)
        (asrs, asrsr, cbflyhf0r, cbflyhf1r, cmacchfr, cmacchnfr, cmachfr)
        (cmachnfr, cmpychfr, cmpychnfr, cmpyhfmr, cmpyhfr, cmpyhnfr, divf)
        (dmachbl, dmachbm, dmachf, dmachfr, dmacwhf, dmpyhbl, dmpyhbm)
        (dmpyhf, dmpyhfr, dmpyhwf, dmpywhf, dsync, flagacc, getacc, macdf)
        (macf, macfr, macwhfl, macwhflr, macwhfm, macwhfmr, macwhkl)
        (macwhkul, macwhl, macwhul, mpydf, mpyf, mpyfr, mpywhfl, mpywhflr)
        (mpywhfm, mpywhfmr, mpywhkl, mpywhkul, mpywhl, mpywhul, msubdf)
        (msubf, msubfr, msubwhfl, msubwhflr, msubwhfm, msubwhfmr, mul64)
        (negs, negsh, normacc, qmachf, qmpyh, qmpyhf, rndh, satf, sath)
        (sbcs, setacc, sflag, sqrt, sqrtf, subs, swi_s, vabs2h, vabss2h)
        (vadd4b, vadds2, vadds2h, vadds4h, vaddsubs, vaddsubs2h)
        (vaddsubs4h, valgn2h, vasl2h, vasls2h, vasr2h, vasrs2h, vasrsr2h)
        (vext2bhl, vext2bhlf, vext2bhm, vext2bhmf, vlsr2h, vmac2hf)
        (vmac2hfr, vmac2hnfr, vmax2h, vmin2h, vmpy2h, vmpy2hf, vmpy2hfr)
        (vmpy2hwf, vmsub2hf, vmsub2hfr, vmsub2hnfr, vneg2h, vnegs2h)
        (vnorm2h, vpack2hbl, vpack2hblf, vpack2hbm, vpack2hbmf, vpack2hl)
        (vpack2hm, vperm, vrep2hl, vrep2hm, vsext2bhl, vsext2bhm, vsub4b)
        (vsubadds, vsubadds2h, vsubadds4h, vsubs2, vsubs2h, vsubs4h):
        Changed opcodes.
        (prealloc, prefetch*): Place them before ld instruction.
        * arc-opc.c (skip_this_opcode): Add ARITH class.
2017-11-03 14:38:05 +01:00
Alan Modra e5d70d6b5a PR22348, conflicting global vars in crx and cr16
include/
	PR 22348
	* opcode/cr16.h (instruction): Delete.
	(cr16_words, cr16_allWords, cr16_currInsn): Delete.
	* opcode/crx.h (crx_cst4_map): Rename from cst4_map.
	(crx_cst4_maps): Rename from cst4_maps.
	(crx_no_op_insn): Rename from no_op_insn.
	(instruction): Delete.
opcodes/
	PR 22348
	* cr16-dis.c (cr16_cinvs, instruction, cr16_currInsn): Make static.
	(cr16_words, cr16_allWords, processing_argument_number): Likewise.
	(imm4flag, size_changed): Likewise.
	* crx-dis.c (crx_cinvs, NUMCINVS, instruction, currInsn): Likewise.
	(words, allWords, processing_argument_number): Likewise.
	(cst4flag, size_changed): Likewise.
	* crx-opc.c (crx_cst4_map): Rename from cst4_map.
	(crx_cst4_maps): Rename from cst4_maps.
	(crx_no_op_insn): Rename from no_op_insn.
gas/
	PR 22348
	* config/tc-crx.c (instruction, output_opcode): Make static.
	(relocatable, ins_parse, cur_arg_num): Likewise.
	(parse_insn): Adjust for renamed opcodes globals.
	(check_range): Likewise
2017-10-25 22:14:58 +10:30
Andrew Waterman 63a25ea0de RISC-V: Fix disassembly of c.addi4spn, c.addi16sp, c.lui when imm=0
These are all invalid instructions, so they should not disassemble.

opcodes/ChangeLog

2017-10-24  Andrew Waterman  <andrew@sifive.com>

        * riscv-opc.c (match_c_addi16sp) : New function.
        (match_c_addi4spn): New function.
        (match_c_lui): Don't allow 0-immediate encodings.
        (riscv_opcodes) <addi>: Use the above functions.
        <add>: Likewise.
        <c.addi4spn>: Likewise.
        <c.addi16sp>: Likewise.

gas/ChangeLog

2017-10-24  Andrew Waterman  <andrew@sifive.com>

        * testsuite/gas/riscv/c-addi16sp-fail.d: New test.
        testsuite/gas/riscv/c-addi16sp-fail.l: Likewise.
        testsuite/gas/riscv/c-addi16sp-fail.s: Likewise.
        testsuite/gas/riscv/c-addi4spn-fail.d: Likewise.
        testsuite/gas/riscv/c-addi4spn-fail.l: Likewise.
        testsuite/gas/riscv/c-addi4spn-fail.s: Likewise.
        testsuite/gas/riscv/riscv.exp: Add new tests.
2017-10-24 09:47:36 -07:00