Commit Graph

8263 Commits

Author SHA1 Message Date
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
Nick Clifton 4f588891ac Resolve PR 22493 - the encoding to be used when pushing the stack pointer onto the stack.
PR 22493
	* config/tc-arm.c (encode_ldmstm): Do not use A2 encoding of the
	PUSH insn when pushing the stack pointer.
2017-12-18 09:37:57 +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
H.J. Lu 390c91cfcf x86: Check pseudo prefix without instruction
Pseudo prefixes must be used on an instruction.  Issue an error when
pseudo prefix is used without instruction.

	PR gas/22623
	* gas/config/tc-i386.c (output_insn): Check pseudo prefix
	without instruction.
	* testsuite/gas/i386/i386.exp: Run inval-pseudo.
	* testsuite/gas/i386/inval-pseudo.l: New file.
	* testsuite/gas/i386/inval-pseudo.s: Likewise.
2017-12-17 09:49:11 -08:00
Jan Beulich 141975a1e5 x86: correct operand type checks
Again these look to be typos: No template currently allows for any two
(or all three) of RegXMM, RegYMM, and RegZMM in a single operand. Quite
clearly ! are missing, after the addition of which the checks for the
first and (if present) second operands also fully match up.
2017-12-15 09:14:52 +01:00
Jan Beulich c5d0745b0d x86: correct abort check
I'm rather certain the missing ! was just a typo, the more with the
similar check in mind that's in the same function a few hundred lines
down (in the body of "if (vex_reg != (unsigned int) ~0)"). Of course
this can't be demonstrated by a test case - internal data structure
consistency is being checked here, and neither form of the check
triggers with any current template.

It is also not really clear to me why operand_type_equal() is being used
in the {X,Y,Z}MM register check here, rather than just testing the
respective bits: Just like Reg32|Reg64 is legal in an operand template,
I don't see why e.g. RegXMM|RegYMM wouldn't be. For example it ought to
be possible to combine

vaddpd, 3, 0x6658, None, 1, CpuAVX, Modrm|Vex|VexOpcode=0|VexVVVV=1|VexW=1|IgnoreSize|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { Xmmword|Unspecified|BaseIndex|Disp8|Disp16|Disp32|Disp32S|RegXMM, RegXMM, RegXMM }
vaddpd, 3, 0x6658, None, 1, CpuAVX, Modrm|Vex=2|VexOpcode=0|VexVVVV=1|VexW=1|IgnoreSize|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { Ymmword|Unspecified|BaseIndex|Disp8|Disp16|Disp32|Disp32S|RegYMM, RegYMM, RegYMM }

into a single template (with setting of VEX.L suitably handled elsewhere
if that's not already happening anyway).

Additionally I don't understand why this uses abort() instead of
gas_assert().

Both of these latter considerations then also apply to the
aforementioned other check in the same function.
2017-12-15 09:12:37 +01:00
Nick Clifton 863f7a5f48 Update the address of the FSF in the copyright notice of files which were using the old address.
top	* COPYING.LIBGLOSS: Update address of FSF in copyright notice.

bfd	* cpu-mt.c: Update address of FSF in copyright notice.
	* elf32-m32c.c: Likewise.
	* elf32-mt.c: Likewise.
	* elf32-rl78.c: Likewise.
	* elf32-rx.c: Likewise.
	* elf32-rx.h: Likewise.
	* elf32-spu.h: Likewise.
	* hosts/x86-64linux.h: Likewise.

etc	* add-log.el: Update address of FSF in copyright notice.

gas	* config/tc-m32c.c: Update address of FSF in copyright notice.
	* config/tc-m32c.h: Likewise.
	* config/tc-mt.c: Likewise.
	* config/tc-mt.h: Likewise.
	* config/tc-visium.c: Likewise.
	* config/tc-visium.h: Likewise.
	* testsuite/gas/rx/explode: Likewise.

ld	* testsuite/ld-mn10300/mn10300.exp: Update address of FSF in
	copyright notice.
2017-12-14 12:48:55 +00: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
Alan Modra 4b1c0f7e85 Don't mask X_add_number containing a register number
It's obviously wrong to mask SPRs to 8 bits.

	PR 21118
	* config/tc-ppc.c (md_assemble): Don't mask register number.
2017-12-12 11:03:58 +10:30
Max Filippov 10af2a65c8 gas: xtensa: fix comparison of trampoline chain symbols
Don't use address where symbol gets resolved, as during section
relaxation symbols will slide, instead canonicalize symbols and check
that they are are the same.
This fixes a bug when a relaxed jump goes into the wrong trampoline.

gas/
2017-12-07  Max Filippov  <jcmvbkbc@gmail.com>

	* config/tc-xtensa.c (xg_order_trampoline_chain): Replace
	xg_order_trampoline_chain_entry call with check for
	canonicalized symbol equality and offset equality.
2017-12-08 08:49:21 -08:00
Alan Modra e21126b7b3 Documentation fix
PR 22544
	* doc/as.texinfo (8byte): Correct.
2017-12-04 22:26:32 +10:30
Alan Modra 48f7f3036a Run powerpc vle gas tests for all powerpc ELF targets
* testsuite/gas/ppc/ppc.exp: Don't exclude VLE tests when little-endian.
	* testsuite/gas/ppc/efs.d: Add -mbig to assembler options.
	* testsuite/gas/ppc/efs2.d: Likewise.
	* testsuite/gas/ppc/lsp-checks.d: Likewise.
	* testsuite/gas/ppc/lsp.d: Likewise.
	* testsuite/gas/ppc/spe.d: Likewise.
	* testsuite/gas/ppc/spe2-checks.d: Likewise.
	* testsuite/gas/ppc/spe2.d: Likewise.
	* testsuite/gas/ppc/spe_ambiguous.d: Likewise.
	* testsuite/gas/ppc/vle-mult-ld-st-insns.d: Likewise.
	* testsuite/gas/ppc/vle-reloc.d: Likewise.
	* testsuite/gas/ppc/vle-simple-1.d: Likewise.
	* testsuite/gas/ppc/vle-simple-2.d: Likewise.
	* testsuite/gas/ppc/vle-simple-3.d: Likewise.
	* testsuite/gas/ppc/vle-simple-4.d: Likewise.
	* testsuite/gas/ppc/vle-simple-5.d: Likewise.
	* testsuite/gas/ppc/vle-simple-6.d: Likewise.
	* testsuite/gas/ppc/vle.d: Likewise.
2017-12-04 10:23:57 +10:30
Jim Wilson fed44c60b3 Fix for texinfo 4.8.
gas/
	* doc/c-riscv.texi (RISC-V-Directives): Move @section immediately after
	@node.
2017-12-03 15:14:11 -08:00
Jim Wilson b57e49f726 Update and clean up RISC-V gas documentation.
gas/
	* doc/as.texinfo (RISC-V): Alphabetize RISC-V entries.  Change
	RISC-V-Opts to RISC-V-Options.  Delete redundant space.  Add -fpic
	and related options to option list.
	* doc/c-riscv.texi: (RISC-V-Options): Renamed from RISC-V-Opts.
	(RISC-V Options): Renamed from Options.  Add missing period.
	(-fpic): Also mention -fPIC.
	(RISC-V Directives): New node.
2017-12-01 15:34:42 -08:00
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 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
Jan Beulich fd4e034759 x86/Intel: issue diagnostics for redundant segment override prefixes
While we shouldn't outright reject such (as was wrongly done by commit
4d36230d59 ("x86: Update segment register check in Intel syntax"), as
MASM accepts them even silently, issue (by default) a warning for such
questionable constructs.
2017-11-30 11:46:26 +01:00
Jan Beulich e21440ba62 Revert "x86: Update segment register check in Intel syntax"
This reverts commit 4d36230d59.
I was committed without maintainer ack and regresses intended
functionality. A replacement will be committed shortly.
2017-11-30 11:44:27 +01:00
Jim Wilson 6cf829987c Give Palmer co-credit for last patch. 2017-11-29 10:51:36 -08:00
Jim Wilson 36877bfb88 Fix riscv malloc error on small alignment after norvc.
gas/
	* config/tc-riscv.c (riscv_frag_align_code): New local insn_alignment.
	Early return if bytes less than or equal to insn_alignment.
	* testsuite/gas/riscv/align-1.l: New.
	* testsuite/gas/riscv/align-1.s: New.
	* testsuite/gas/riscv/riscv.exp: Use run_dump_tests.  Use run_list_test
	for align-1.
2017-11-29 10:36:46 -08:00
Jim Wilson f923328821 In x86 -n docs, mention that you need an explicit nop fill byte.
gas/
	PR gas/22464
	* doc/c-i386.texi (-n): Clarify docs.
2017-11-29 10:22:26 -08:00
Renlin Li f10e937a1c [GAS][AARCH64]Fix a typo for IP1 register alias.
This should be an obvious fix.
It corrects the register number for IP1 to 17.

gas/

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

	* config/tc-aarch64.c (reg_names): Fix IP1 register alias error.
	* testsuite/gas/aarch64/register_aliases.s: Add IP0 and IP1 tests.
	* testsuite/gas/aarch64/register_aliases.d: Update.
2017-11-29 17:19:59 +00: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 ed9c7ee037 Use the record_alignment function when creating a .note section, in case the user has already created the section.
PR 22492
	* config/obj-elf.c (obj_elf_version): Use record_alignment rather
	than bfd_set_section_alignment.
2017-11-29 09:32:49 +00:00
Jim Wilson f0531ed6a4 Compress loads/stores with implicit 0 offset.
gas/
	* config/tc-riscv.c (riscv_handle_implicit_zero_offset): New.
	(riscv_ip): Cases 'k', 'l', 'm', 'n', 'M', 'N', add call to
	riscv_handle_implicit_zero_offset.  At label load_store, replace
	existing code with call to riscv_handle_implicit_zero_offset.
	* testsuite/gas/riscv/c-ld.d, testsuite/gas/riscv/c-ld.s: New.
	* testsuite/gas/riscv/c-lw.d, testsuite/gas/riscv/c-lw.s: New.
	* testsuite/gas/riscv/riscv.exp: Run new tests.
2017-11-27 19:20:53 -08:00
Max Filippov 407e114084 gas: xtensa: speed up find_trampoline_seg
find_trampoline_seg takes noticeable time when assembling source with
many sections. Cache the result of the most recent search and check it
first. No functional changes.

gas/
2017-11-27  Max Filippov  <jcmvbkbc@gmail.com>

	* config/tc-xtensa.c (find_trampoline_seg): Add static variable
	that caches the result of the most recent search.
2017-11-27 15:16:22 -08:00
Max Filippov 148d638429 gas: xtensa: implement trampoline coalescing
There is a recurring pattern in assembly files generated by a compiler
where a lot of jumps in a function are going to the same place. When
these jumps are relaxed with trampolines the assembler generates a
separate jump thread from each source.
Create an index of trampoline jump targets for each segment and see if a
jump being relaxed goes to a location from that index, in which case
replace its target with a location of existing trampoline jump that
results in the shortest path to the original target.

gas/
2017-11-27  Max Filippov  <jcmvbkbc@gmail.com>

	* config/tc-xtensa.c (trampoline_chain_entry, trampoline_chain)
	(trampoline_chain_index): New structures.
	(trampoline_index): Add chain_index field.
	(xg_order_trampoline_chain_entry, xg_sort_trampoline_chain)
	(xg_find_chain_entry, xg_get_best_chain_entry)
	(xg_order_trampoline_chain, xg_get_trampoline_chain)
	(xg_find_best_eq_target, xg_add_location_to_chain)
	(xg_create_trampoline_chain, xg_get_single_symbol_slot): New
	functions.
	(xg_relax_fixups): Call xg_find_best_eq_target to adjust jump
	target to point to an existing jump. Call
	xg_create_trampoline_chain to create new jump target. Call
	xg_add_location_to_chain to add newly created trampoline jump
	to the corresponding chain.
	(add_jump_to_trampoline): Extract loop searching for a single
	slot with a symbol into a separate function, replace that code
	with a call to that function.
	(relax_frag_immed): Call xg_find_best_eq_target to adjust jump
	target to point to an existing jump.
	* testsuite/gas/xtensa/all.exp: Add trampoline-2 test.
	* testsuite/gas/xtensa/trampoline.d: Adjust absolute addresses
	as many duplicate trampoline chains are now coalesced.
	* testsuite/gas/xtensa/trampoline.s: Add _nop so that objdump
	stays in sync with instruction stream.
	* testsuite/gas/xtensa/trampoline-2.l: New test result file.
	* testsuite/gas/xtensa/trampoline-2.s: New test source file.
2017-11-27 15:15:46 -08:00
Max Filippov 76a493ab99 gas: xtensa: reuse trampoline placement code
There's almost exact copy of the trampoline placement code in the
search_trampolines function that is used for jumps generated for relaxed
branch instructions. Get rid of the duplication and reuse
xg_find_best_trampoline function for that.

gas/
2017-11-27  Max Filippov  <jcmvbkbc@gmail.com>

	* config/tc-xtensa.c (search_trampolines, get_best_trampoline):
	Remove definitions.
	(xg_find_best_trampoline_for_tinsn): New function.
	(relax_frag_immed): Replace call to get_best_trampoline with a
	call to xg_find_best_trampoline_for_tinsn.
	* testsuite/gas/xtensa/trampoline.d: Adjust absolute addresses
	as the placement of trampolines for relaxed branches has been
	changed.
2017-11-27 15:14:48 -08:00
Max Filippov fe6c2f1b64 gas: xtensa: rewrite xg_relax_trampoline
Replace linked list of trampoline frags with an ordered array, so that
instead of indexing fixups trampolines could be indexed. Keep each array
in the trampoline_seg structure, so there's no need to rebuild it for
every new processed segment. Don't run relaxation for each trampoline
frag, instead run it for each fixup in the current segment that needs
relaxation at the beginning of each relaxation pass. This way the
complexity of this process drops from about O(n^2 * m) to about
O(log n * m), where n is the number of trampoline frags and m is the
number of fixups that need relaxation in the segment.

gas/
2017-11-27  Max Filippov  <jcmvbkbc@gmail.com>

	* config/tc-xtensa.c (trampoline_index): New structure.
	(trampoline_seg): Replace trampoline list with trampoline index.
	(xg_find_trampoline, xg_add_trampoline_to_index)
	(xg_remove_trampoline_from_index, xg_add_trampoline_to_seg)
	(xg_is_trampoline_frag_full, xg_get_fulcrum)
	(xg_find_best_trampoline, xg_relax_fixup, xg_relax_fixups)
	(xg_is_relaxable_fixup): New functions.
	(J_MARGIN): New macro.
	(xtensa_create_trampoline_frag): Use xg_add_trampoline_to_seg
	instead of open-coded addition to the linked list.
	(dump_trampolines): Iterate through the trampoline_seg::index.
	(cached_fixupS, cached_fixup, fixup_cacheS, fixup_cache)
	(fixup_order, xtensa_make_cached_fixup)
	(xtensa_realloc_fixup_cache, xtensa_cache_relaxable_fixups)
	(xtensa_find_first_cached_fixup, xtensa_delete_cached_fixup)
	(xtensa_add_cached_fixup, check_and_update_trampolines): Remove
	definitions.
	(xg_relax_trampoline): Extract logic into separate functions,
	replace body with a call to xg_relax_fixups.
	(search_trampolines): Replace search in linked list with search
	in index. Change data type of address-tracking variables from
	int to offsetT. Replace abs with labs.
	(xg_append_jump): Finish the trampoline frag if it's full.
	(add_jump_to_trampoline): Remove trampoline frag from the index
	if the frag is full.
	* config/tc-xtensa.h (xtensa_frag_type): Remove next_trampoline.
	* testsuite/gas/xtensa/trampoline.d: Adjust absolute addresses
	as the placement of trampolines has slightly changed.
	* testsuite/gas/xtensa/trampoline.s: Add _nop so that objdump
	stays in sync with instruction stream.
2017-11-27 15:13:52 -08:00
Max Filippov 46888d7100 gas: xtensa: merge trampoline_frag into xtensa_frag_type
The split between fragS and trampoline_frag doesn't save much space, but
makes trampolines management much more awkward. Merge trampoline_frag
data into the xtensa_frag_type, which is a part of fragS. No functional
changes.

gas/
2017-11-27  Max Filippov  <jcmvbkbc@gmail.com>

	* config/tc-xtensa.c (init_trampoline_frag): Replace pointer to
	struct trampoline_frag parameter with pointer to fragS.
	(xg_append_jump): Remove jump_around parameter.
	(struct trampoline_frag): Remove.
	(struct trampoline_seg): Change type of trampoline_list from
	struct trampoline_frag to fragS.
	(xtensa_create_trampoline_frag): Don't allocate struct
	trampoline_frag. Initialize new fragS::tc_frag_data fields.
	(dump_trampolines, xg_relax_trampoline, search_trampolines)
	(get_best_trampoline, init_trampoline_frag)
	(add_jump_to_trampoline, relax_frag_immed): Replace pointer to
	struct trampoline_frag with a pointer to fragS.
	(xg_append_jump): Remove jump_around parameter, use
	fragS::tc_frag_data.jump_around_fix instead.
	(xg_relax_trampoline, init_trampoline_frag)
	(add_jump_to_trampoline): Don't pass jump_around parameter to
	xg_append_jump.
	* config/tc-xtensa.h (struct xtensa_frag_type): Add new fields:
	needs_jump_around, next_trampoline and jump_around_fix.
2017-11-27 15:13:00 -08:00
Max Filippov 1c2649f50f gas: xtensa: reuse find_trampoline_seg
xtensa_create_trampoline_frag has opencoded fragment equivalent to
find_trampoline_seg. Drop the fragment and use find_trampoline_seg
instead. No functional changes.

gas/
2017-11-27  Max Filippov  <jcmvbkbc@gmail.com>

	* config/tc-xtensa.c (find_trampoline_seg): Move above the first
	use.
	(xtensa_create_trampoline_frag): Replace trampoline seg search
	code with a call to find_trampoline_seg.
2017-11-27 15:12:21 -08:00
Max Filippov fec68fb168 gas: xtensa: extract jump assembling for trampolines
init_trampoline_frag, add_jump_to_trampoline and xg_relax_trampoline add
a jump to the end of a trampoline frag. Extract it into a separate
funciton and use it in all these places. No functional changes.

gas/
2017-11-27  Max Filippov  <jcmvbkbc@gmail.com>

	* config/tc-xtensa.c (xg_append_jump): New function.
	(xg_relax_trampoline, init_trampoline_frag)
	(add_jump_to_trampoline): Replace trampoline jump assembling
	code with a call to xg_append_jump.
2017-11-27 15:11:38 -08:00
Max Filippov 120bc8b8b9 gas: extract xg_relax_trampoline from xtensa_relax_frag
To make measurement and changes easier extract trampoline relaxation
function. No functional changes.

gas/
2017-11-27  Max Filippov  <jcmvbkbc@gmail.com>

	* config/tc-xtensa.c (xg_relax_trampoline): New function.
	(xtensa_relax_frag): Replace trampoline relaxation code with a
	call to xg_relax_trampoline.
2017-11-27 15:10:49 -08:00
Nick Clifton e3d4058216 When creating a .note section to contain a version note, set the section alignment to 4 bytes.
PR 22492
	* config/obj-elf.c (obj_elf_version): Set the alignment of the
	.note section.
2017-11-27 11:04:17 +00:00
H.J. Lu 8e2495f2f7 gas: Update x86 sse-noavx tests
This fixed:

FAIL: i386 SSE without AVX equivalent
FAIL: x86-64 SSE without AVX equivalent
FAIL: x86-64 (ILP32) SSE without AVX equivalent

on x86-64.

	* testsuite/gas/i386/sse-noavx.s: Add tests for fisttps and
	fisttpl.
	* testsuite/gas/i386/x86-64-sse-noavx.s: Likewise.
	* testsuite/gas/i386/ilp32/x86-64-sse-noavx.d: Updated.
	* testsuite/gas/i386/sse-noavx.d: Likewise.
	* testsuite/gas/i386/x86-64-sse-noavx.d: Likewise.
2017-11-26 08:32:26 -08:00
Jim Wilson 0fbc35681f Add reference to implicit use in _bfd_elf_is_local_label_name.
gas/
	* write.h (FAKE_LABEL_CHAR): Expand comment.
2017-11-24 09:31:59 -08:00
Jan Beulich 6d2cd6b208 x86: reject further invalid AVX-512 masking constructs
For one the register type used for masking should be validated. And then
we shouldn't accept input producing encodings which will #UD when
executed, as is the case when EVEX.Z is set while EVEX.AAA is zero.
2017-11-24 08:42:57 +01: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
Jim Wilson c139731b13 Fix vax/ns32k/mmix gas testsuite regression.
gas/
	* testsuite/gas/all/err-fakelabel.s (dg-error): Also accept fatal error
	string.
2017-11-23 13:11:40 -08:00
Jim Wilson 5f71e59e1a Fix build error with --enable-targets=all.
gas/
	* as.c (INITIALIZING_EMULS): Define.
	* config/obj-multi.h (FAKE_LABEL_NAME): When INITIALIZING_EMULS set,
	don't define it.
2017-11-23 12:30:47 -08: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 43083a502b x86-64: always use unsigned 32-bit reloc for 32-bit addressing w/o base reg
Except for %eip-relative addressing, where we don't have a suitable
relocation type silently wrapping at the 4G boundary, consistently
force use of R_X86_64_32 (in ELF terms) instead of its sign-extending
counterpart. This wasn't right in case there was no base register in
the addressing expression.
2017-11-23 11:02:30 +01:00
Jan Beulich 9bb129e82f x86: drop redundant VSIB handling code
The vecsib && !base_reg case is already being handled (in a more correct
manner) by earlier code.
2017-11-23 11:00:44 +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