Commit Graph

10292 Commits

Author SHA1 Message Date
Alan Modra
e953510c3b ia64 gas: Remove unnecessary init
The whole struct is cleared by alloc_record.

	* config/tc-ia64.c (output_prologue, output_prologue_gr): Don't
	zero r.record.r.mask.
2022-05-31 21:14:00 +09:30
Alan Modra
99f647e200 Trailing spaces in objdump -r header
git commit 202be274a4 went a little wild in removing trailing spaces
in gas/testsuite/gas/i386/{secidx.d,secrel.d}, causing
x86_64-w64-mingw32  +FAIL: i386 secrel reloc
x86_64-w64-mingw32  +FAIL: i386 secidx reloc

I could have just replaced the trailing space, but let's fix the
objdump output instead.  Touches lots of testsuite files.
2022-05-31 11:25:09 +09:30
Luis Machado
c1d0eab1b1 Fix failing test for armeb-gnu-eabi
The following test fails on the armeb-gnu-eabi target:

FAIL: Unwind information for Armv8.1-M.Mainline PACBTI extension

This patch adjusts the expected output for big endian.
2022-05-30 10:39:49 +01:00
jiawei
292c7bf86d RISC-V: Add zhinx extension supports.
The zhinx extension is a sub-extension in zfinx, corresponding to
zfh extension but use GPRs instead of FPRs.

This patch expanded the zfh insn class define, since zfh and zhinx
use the same opcodes, thanks for Nelson's works.

changelog in V2: Add missing classes of 'zfh' and 'zhinx' in
"riscv_multi_subset_supports_ext".

bfd/ChangeLog:

        * elfxx-riscv.c (riscv_multi_subset_supports): New extensions.
        (riscv_multi_subset_supports_ext): New extensions.

gas/ChangeLog:

        * testsuite/gas/riscv/fp-zhinx-insns.d: New test.
        * testsuite/gas/riscv/fp-zhinx-insns.s: New test.

include/ChangeLog:

        * opcode/riscv.h (enum riscv_insn_class): New INSN classes.

opcodes/ChangeLog:

        * riscv-opc.c: Modify INSN_CLASS.
2022-05-30 11:42:08 +08:00
Andrew Burgess
202be274a4 opcodes/i386: remove trailing whitespace from insns with zero operands
While working on another patch[1] I had need to touch this code in
i386-dis.c:

  ins->obufp = ins->mnemonicendp;
  for (i = strlen (ins->obuf) + prefix_length; i < 6; i++)
    oappend (ins, " ");
  oappend (ins, " ");
  (*ins->info->fprintf_styled_func)
    (ins->info->stream, dis_style_mnemonic, "%s", ins->obuf);

What this code does is add whitespace after the instruction mnemonic
and before the instruction operands.

The problem I ran into when working on this code can be seen by
assembling this input file:

    .text
    nop
    retq

Now, when I disassemble, here's the output.  I've replaced trailing
whitespace with '_' so that the issue is clearer:

    Disassembly of section .text:

    0000000000000000 <.text>:
       0:	90                   	nop
       1:	c3                   	retq___

Notice that there's no trailing whitespace after 'nop', but there are
three spaces after 'retq'!

What happens is that instruction mnemonics are emitted into a buffer
instr_info::obuf, then instr_info::mnemonicendp is setup to point to
the '\0' character at the end of the mnemonic.

When we emit the whitespace, this is then added starting at the
mnemonicendp position.  Lets consider 'retq', first the buffer is
setup like this:

  'r' 'e' 't' 'q' '\0'

Then we add whitespace characters at the '\0', converting the buffer
to this:

  'r' 'e' 't' 'q' ' ' ' ' ' ' '\0'

However, 'nop' is actually an alias for 'xchg %rax,%rax', so,
initially, the buffer is setup like this:

  'x' 'c' 'h' 'g' '\0'

Then in NOP_Fixup we spot that we have an instruction that is an alias
for 'nop', and adjust the buffer to this:

  'n' 'o' 'p' '\0' '\0'

The second '\0' is left over from the original buffer contents.
However, when we rewrite the buffer, we don't afjust mnemonicendp,
which still points at the second '\0' character.

Now, when we insert whitespace we get:

  'n' 'o' 'p' '\0' ' ' ' ' ' ' ' ' '\0'

Notice the whitespace is inserted after the first '\0', so, when we
print the buffer, the whitespace is not printed.

The fix for this is pretty easy, I can change NOP_Fixup to adjust
mnemonicendp, but now a bunch of tests start failing, we now produce
whitespace after the 'nop', which the tests don't expect.

So, I could update the tests to expect the whitespace....

...except I'm not a fan of trailing whitespace, so I'd really rather
not.

Turns out, I can pretty easily update the whitespace emitting code to
spot instructions that have zero operands and just not emit any
whitespace in this case.  So this is what I've done.

I've left in the fix for NOP_Fixup, I think updating mnemonicendp is
probably a good thing, though this is not really required any more.

I've then updated all the tests that I saw failing to adjust the
expected patterns to account for the change in whitespace.

[1] https://sourceware.org/pipermail/binutils/2022-April/120610.html
2022-05-27 14:12:33 +01:00
Alan Modra
6015985895 Replace bfd_hostptr_t with uintptr_t
bfd_hostptr_t is defined as a type large enough to hold either a long
or a pointer.  It mostly appears in the coff backend code in casts.
include/coff/internal.h struct internal_syment and union
internal_auxent have the only uses in data structures, where
comparison with include/coff/external.h and other code reveals that
the type only needs to be large enough for a 32-bit integer or a
pointer.  That should mean replacing with uintptr_t is OK.
2022-05-27 22:08:59 +09:30
Alan Modra
0e3c1eebb2 Remove use of bfd_uint64_t and similar
Requiring C99 means that uses of bfd_uint64_t can be replaced with
uint64_t, and similarly for bfd_int64_t, BFD_HOST_U_64_BIT, and
BFD_HOST_64_BIT.  This patch does that, removes #ifdef BFD_HOST_*
and tidies a few places that print 64-bit values.
2022-05-27 22:08:59 +09:30
Jan Beulich
7063667edb x86/Intel: allow MASM representation of embedded rounding / SAE
MASM doesn't support the separate operand form; the modifier belongs
after the instruction instead. Accept this form alongside the original
(now legacy) one. Short of having access to a MASM version to actually
check in how far "after the instruction" is a precise statement in their
documentation, allow both that and the SDM mandated form where the
modifier is on the last register operand (with a possible immediate
operand following).

Sadly the split out function, at least for the time being, needs to cast
away constness at some point, as the two callers disagree in this
regard.

Adjust some, but not all of the testcases.
2022-05-27 08:48:58 +02:00
Jan Beulich
cf665fee1d x86: re-work AVX512 embedded rounding / SAE
As a preparatory step to allowing proper non-operand forms of specifying
embedded rounding / SAE, convert the internal representation to non-
operand form. While retaining properties (and in a few cases perhaps
providing more meaningful diagnostics), this means doing away with a few
hundred standalone templates, thus - as a nice side effect - reducing
memory consumption / cache occupancy.
2022-05-27 08:48:09 +02:00
Jan Beulich
90a00d6c65 x86/Intel: adjust representation of embedded rounding / SAE
MASM doesn't consider {sae} and alike a separate operand; it is attached
to the last register operand instead, just like spelled out by the SDM.
Make the disassembler follow this first, before also adjusting the
assembler (such that it'll be easy to see that the assembler change
doesn't alter generated code).
2022-05-27 08:47:28 +02:00
Jan Beulich
a5748e0d8c x86/Intel: allow MASM representation of embedded broadcast
MASM doesn't support the {1to<n>} form; DWORD BCST (paralleling
DWORD PTR) and alike are to be used there instead. Accept these forms
alongside the original (now legacy) ones.

Acceptance of the original {1to<n>} operand suffix is retained both for
backwards compatibility and to disambiguate VFPCLASSP{S,D,H} and vector
conversions with shrinking element sizes. I have no insight (yet) into
how MASM expects those to be disambiguated.

Adjust some, but not all of the testcases.
2022-05-27 08:46:29 +02:00
Jan Beulich
811f61d4c4 x86/Intel: adjust representation of embedded broadcast
MASM doesn't support the {1to<n>} form; DWORD BCST (paralleling
DWORD PTR) and alike are to be used there instead. Make the disassembler
follow this first, before also adjusting the assembler (such that it'll
be easy to see that the assembler change doesn't alter generated code).

For VFPCLASSP{S,D,H} and vector conversions with shrinking element sizes
the original {1to<n>} operand suffix is retained, to disambiguate
output. I have no insight (yet) into how MASM expects those to be
disambiguated.
2022-05-27 08:45:56 +02:00
Richard Earnshaw
20d814202a arm: avoid use of GNU builtin function in s_arm_unwind_save_mixed
Whilst reviewing Luis' proposed change to s_arm_unwind_save_mixed
yesterday I noticed that we were making use of __builting_clzl
directly within the main function, which is not guaranteed to be
portable.  Whilst studying the code further, I also realized that it
could be rewritten without using it and also reworked to remove a lot
of unnecessary iterations steps.  So this patch does that (and also
removes the source of the warning that Luis was trying to fix).
Finally, with the rewrite we can also simplify the caller of this
routine as the new version can handle all the cases directly.

	* config/tc-arm.c (s_arm_unwind_save_mixed): Rewrite without
	using __builtin_clzl.
	(s_arm_unwind_save): Simplify logic for simple/mixed register saves.
2022-05-26 11:05:59 +01:00
Tsukasa OI
51498ab9ab RISC-V: Fix RV32Q conflict
This commit makes RV32 + 'Q' extension (version 2.2 or later) not
conflicting since this combination is no longer prohibited by the
specification.

bfd/ChangeLog:

	* elfxx-riscv.c (riscv_parse_check_conflicts): Remove conflict
	detection that prohibits RV32Q on 'Q' version 2.2 or later.

gas/ChangeLog:

	* testsuite/gas/riscv/march-fail-rv32iq.d: Removed.
	* testsuite/gas/riscv/march-fail-rv32iq.l: Likewise.
	* testsuite/gas/riscv/march-fail-rv32iq2p0.d: New test
	showing RV32IQ fails on 'Q' extension version 2.0.
	* testsuite/gas/riscv/march-fail-rv32iq2p0.l: Likewise.
	* testsuite/gas/riscv/march-fail-rv32iq2.d: Likewise.
	* testsuite/gas/riscv/march-fail-rv32iq-isa-2p2.d: New test
	showing RV32IQ fails on ISA specification version 2.2.
	* testsuite/gas/riscv/march-ok-rv32iq2p2.d: New test
	showing RV32IQ succesds on 'Q' extension version 2.2.
	* testsuite/gas/riscv/march-ok-rv32iq-isa-20190608.d: New test
	showing RV32IQ succesds on ISA specification 20190608.
2022-05-25 11:19:59 +08:00
Dmitry Selyutin
dd4832bf3e opcodes: introduce BC field; fix isel
Per Power ISA Version 3.1B 3.3.12, isel uses BC field rather than CRB
field present in binutils sources. Also, per 1.6.2, BC has the same
semantics as BA and BB fields, so this should keep the same flags and
mask, only with the different offset.

opcodes/
        * ppc-opc.c
        (BC): Define new field, with the same definition as CRB field,
        but with the PPC_OPERAND_CR_BIT flag present.
gas/
        * testsuite/gas/ppc/476.d: Update.
        * testsuite/gas/ppc/a2.d: Update.
        * testsuite/gas/ppc/e500.d: Update.
        * testsuite/gas/ppc/power7.d: Update.
2022-05-25 12:13:44 +09:30
Dmitry Selyutin
8e5eb8e1b0 ppc: extend opindex to 16 bits
With the upcoming SVP64 extension[0] to PowerPC architecture, it became
evident that PowerPC operand indices no longer fit 8 bits. This patch
switches the underlying type to uint16_t, also introducing a special
typedef so that any future extension goes even smoother.

[0] https://libre-soc.org

include/
	* opcode/ppc.h (ppc_opindex_t): New typedef.
	(struct powerpc_opcode): Use it.
	(PPC_OPINDEX_MAX): Define.
gas/
	* write.h (struct fix): Increase size of fx_pcrel_adjust.
	Reorganise.
	* config/tc-ppc.c (insn_validate): Use ppc_opindex_t for operands.
	(md_assemble): Likewise.
	(md_apply_fix): Likewise.  Mask fx_pcrel_adjust with PPC_OPINDEX_MAX.
	(ppc_setup_opcodes): Adjust opcode index assertion.
opcodes/
	* ppc-dis.c (skip_optional_operands): Use ppc_opindex_t for
	operand pointer.
	(lookup_powerpc, lookup_prefix, lookup_vle, lookup_spe2): Likewise.
	(print_insn_powerpc): Likewise.
2022-05-25 12:13:44 +09:30
Jia-Wei Chen
9ecdcd1be1 RISC-V: Update zfinx implement with zicsr.
Update zfinx implement with zicsr, fix missing fcsr use by zfinx.
add zicsr imply by zfinx.

bfd/ChangeLog:

        * elfxx-riscv.c: New imply.

gas/ChangeLog:

        * testsuite/gas/riscv/csr-insns-pseudo-zfinx.d: New test.

opcodes/ChangeLog:

        * riscv-opc.c: Update insn class.
2022-05-20 22:21:34 +08:00
Tsukasa OI
aa8c9d60a6 RISC-V: Remove RV128-only fmv instructions
As fmv.x.q and fmv.q.x instructions are RV128-only (not RV64-only),
it should be removed until RV128 support for GNU Binutils is required
again.

gas/ChangeLog:

	* testsuite/gas/riscv/fmv.x.q-rv64-fail.d: New failure test.
	* testsuite/gas/riscv/fmv.x.q-rv64-fail.l: Likewise.
	* testsuite/gas/riscv/fmv.x.q-rv64-fail.s: Likewise.

include/ChangeLog:

	* opcode/riscv-opc.h (MATCH_FMV_X_Q, MASK_FMV_X_Q,
	MATCH_FMV_Q_X, MASK_FMV_Q_X): Remove RV128-only instructions.

opcodes/ChangeLog:

	* riscv-opc.c (riscv_opcodes): Remove RV128-only instructions.
2022-05-20 22:21:30 +08:00
Srinath Parvathaneni
ee3272d472 arm: Fix system register fpcxt_ns and fpcxt_s naming convention.
The current assembler accepts system registers FPCXTNS and FPCXTS for Armv8.1-M
Mainline Instructions VSTR, VLDR, VMRS and VMSR.
Assembler should be also allowing FPCXT_NS, fpcxt_ns, fpcxtns, FPCXT_S, fpcxt_s
and fpcxts. This patch fixes the issue.
2022-05-19 16:51:21 +01:00
Jan Beulich
15b7af6c87 Arm64: force emission of ILP32-dependent relocs
Like the placeholder types added in 04dfe7aa52 ("Arm64: follow-on to
PR gas/27217 fix"), these are also placeholders which are subsequently
resolved (albeit later, hence this being a separate issue). As for the
resolved types 1 is returned, these pseudo-relocs should also have 1
returned to force retaining of the [eventual] relocations. This is also
spelled out individually for each of them in md_apply_fix().
2022-05-19 12:46:21 +02:00
Jan Beulich
04dfe7aa52 Arm64: follow-on to PR gas/27217 fix
PR gas/27217

Prior to trying to address PR gas/28888 I noticed anomalies in how
certain insns would / wouldn't be affected in similar ways.

Commit eac4eb8ecb ("Fix a problem assembling AArch64 sources when a
relocation is generated against a symbol that has a defined value") had
two copy-and-paste mistakes, passing the wrong type to
aarch64_force_reloc().

It further failed to add placeholder relocation types to that function's
block of case labels leading to a return of 1. While not of interest for
aarch64_force_relocation() (these placeholders are resolved right in
parse_operands()), calls to aarch64_force_reloc() happen before that
resolution would take place.
2022-05-18 17:55:55 +02:00
Victor Do Nascimento
320f42099a oops - forgot changelog entry for the previous delta. 2022-05-18 16:26:21 +01:00
Victor Do Nascimento
3363d8560f arm: Add unwind support for mixed register lists
* config/tc-arm.c (parse_reg_list): Add handling of mixed register
	types.
	(reg_names): Enumerate pseudoregister according to mapped physical
	register number.
	(s_arm_unwind_save_pseudo): Modify function signature.
	(s_arm_unwind_save_core): Likewise.
	(s_arm_unwind_save_mixed): New function.
	(s_arm_unwind_save): Generate register list mask to pass to nested
	functions.
	* testsuite/gas/arm/unwind-pacbti-m.s: Expand test for mixed
 	register type lists.
 	* testsuite/gas/arm/unwind-pacbti-m.d: Likewise.
	* testsuite/gas/arm/unwind-pacbti-m-readelf.d: Likewise.
2022-05-18 16:25:12 +01:00
Jan Beulich
85aaf32e61 gas: avoid octal numbers being accepted when processing .linefile
Compilers would put decimal numbers there, so I think we should treat
finding octal numbers the same as finding bignums - ignore them as
actually being comments of some very specific form.
2022-05-18 09:38:40 +02:00
Jan Beulich
9c70556165 gas: avoid bignum related errors when processing .linefile
Any construct which to the scrubber looks like a C preprocessor
line/file "directive" is converted to .linefile, but the amount of
checking the scrubber does is minimal (albeit it does let through only
decimal digits for the line part of the contruct). Since the scrubber
conversion is further tied to # being a line comment character, anything
which upon closer inspection turns out not to be a line/file "directive"
is supposed to be treated as a comment, i.e. ignored. Therefore we
cannot use get_absolute_expression(), as this may raise errors. Open-
code the function instead, treating everything not resulting in
O_constant as a comment as well.

Furthermore also bounds-check the parsed value. This bounds check tries
to avoid implementation defined behavior (which may be the raising of an
implementation defined signal), but for now makes the assumption that
int has less than 64 bits. The way bfd_signed_vma (which is what offsetT
aliases) is defined in bfd.h for the BFD64 case I cannot really see a
clean way of avoiding this assumption. Omitting the #ifdef, otoh, would
risk "condition is always false" warnings by compilers.

Convert get_linefile_number() to return bool at this occasion as well.
2022-05-18 09:38:18 +02:00
Jan Beulich
7e6d6b62d8 gas: fold do_repeat{,_with_expander}()
do_repeat_with_expander() already deals with the "no expander" case
quite fine, so there's really little point having two functions. What it
lacks compared with do_repeat() is a call to sb_build(), which can
simply be moved (and the then redundant sb_new() be avoided). Along with
this moving also flip if the main if()'s condition such that the "no
expander" case is handled first.
2022-05-18 09:37:34 +02:00
Jan Beulich
43fe575c32 gas: don't ignore .linefile inside false conditionals
When assembling code previously pre-processed by a C compiler, long
enough comments may have been collapsed into "# <line> <file>"
constructs. If we skip these, line numbers (and possibly even file
names) will be off / wrong in both diagnostics and debug info.
2022-05-18 09:37:00 +02:00
Jan Beulich
2e55c34282 gas: simplify ignore_input()
First of all convert to switch(), in preparation of adding another
directive here which may not be ignored. While doing so drop dead code:
A string the first two characters of which do not match "if" also wont
match "ifdef" or "ifndef".
2022-05-18 09:36:00 +02:00
Jan Beulich
818432e841 gas: tweak .irp and alike file/line handling for M68K/MRI
In commit 2ee1792bec ("gas: further adjust file/line handling for .irp
and alike") I neglected the need to omit the leading . in M68K/MRI mode.
2022-05-18 09:35:29 +02:00
Nelson Chu
035784e345 RISC-V: Added half-precision floating-point v1.0 instructions.
bfd/
	* elfxx-riscv.c (riscv_implicit_subsets): Added implicit f
	and zicsr for zfh.
	(riscv_supported_std_z_ext): Added default v1.0 version for zfh.
	(riscv_multi_subset_supports): Handle INSN_CLASS_ZFH,
	INSN_CLASS_D_AND_ZFH and INSN_CLASS_Q_AND_ZFH.
gas/
	* config/tc-riscv.c (FLT_CHARS): Added "hH".
	(macro): Expand Pseudo M_FLH and M_FSH.
	(riscv_pseudo_table): Added .float16 directive.
	* testsuite/gas/riscv/float16-be.d: New testcase for .float16.
	* testsuite/gas/riscv/float16-le.d: Likewise.
	* testsuite/gas/riscv/float16.s: Likewise.
	* testsuite/gas/riscv/fp-zfh-insns.d: New testcase for zfh.
	* testsuite/gas/riscv/fp-zfh-insns.s: Likewise.
include/
	* opcode/riscv-opc.h: Added MASK and MATCH encodings for zfh.
	* opcode/riscv.h: Added INSN_CLASS and pseudo macros for zfh.
opcodes/
	* riscv-opc.c (riscv_opcodes): Added zfh instructions.
2022-05-17 13:31:38 +08:00
Ilya Leoshkevich
973773de93 IBM zSystems: Fix left-shifting negative PCRel32 values (PR gas/29152)
s390_insert_operand ()'s val, min and max are encoded PCRel32 values
and need to be left-shifted by 1 before being shown to the user.
Left-shifting negative values is undefined behavior in C, but the
current code does not try to prevent it, causing UBSan to complain.

Fix by casting the values to their unsigned equivalents before
shifting.
2022-05-16 22:00:17 +02:00
Alan Modra
a2d8448d1d Re: IBM zSystems: Accept (. - 0x100000000) PCRel32 operands
The new test failed on s390-linux due to bfd_sprintf_vma trimming
output to 32 bits for 32-bit targets.  The test was faulty anyway,
expecting zero as the min end of the range is plainly wrong, but
that's what you get if you cast min to int.

	* config/tc-s390.c (s390_insert_operand): Print range error using
	PRId64.
	* testsuite/gas/s390/zarch-z900-err.l: Correct expected output.
2022-05-12 11:49:45 +09:30
Alan Modra
2ec4ffc1c6 gas: remove use of PTR
* config/obj-evax.c (evax_symbol_new_hook): Don't cast to PTR.
2022-05-10 11:21:37 +09:30
Ilya Leoshkevich
0cfd6cffde IBM zSystems: Accept (. - 0x100000000) PCRel32 operands
as does not accept instructions like brasl %r0,.-0x100000000, because
of two problems with the generic overflow check:

1. PCRel32 operands are signed, but are treated as unsigned.

2. The allowed range for these operands is [-(1 << 32), (1 << 32) - 1],
   and not [-(1 << 31), (1 << 31) - 1].

Fix both by disabling the generic overflow check - it's not needed,
because s390_insert_operand () performs its own.

gas/

        * config/tc-s390.c (md_gather_operands): Set fx_no_overflow.
        * testsuite/gas/s390/s390.exp: Add zarch-z900-err.
        * testsuite/gas/s390/esa-z900.d: New test.
        * testsuite/gas/s390/esa-z900.s: New test.
        * testsuite/gas/s390/zarch-z900-err.l: New test.
        * testsuite/gas/s390/zarch-z900-err.s: New test.
2022-05-09 21:59:59 +02:00
H.J. Lu
0d29b1a462 x86: Disable 2 tests with large memory requirement
gas/

	* testsuite/gas/i386/i386.exp: Disable rept.

ld/

	* testsuite/ld-x86-64/x86-64.exp: Disable pr17618.
2022-04-27 11:51:35 -07:00
Jan Beulich
36b124126b x86: VFPCLASSSH is Evex.LLIG
This also was mistakenly flagged as Evex.128.
2022-04-27 11:08:57 +02:00
Alan Modra
96d2cea340 Delete unused COFF gas macro
* config/obj-coff.h (sy_obj): Don't define.
	(OBJ_SYMFIELD_TYPE): Revise comments.
2022-04-21 11:31:45 +09:30
Jan Beulich
1db5a7fe0b x86: reject all invalid SAE variants
So far an SAE-only specifier was accepted for static-rounding insns,
while SAE-only insns didn't accept static rounding specifiers. If
anything it would make sense the other way around, allowing SAE-only
insns to have the (ignored) rounding mode specified individually rather
than globally via -mevexrcig=. But for now make things match the SDM.
2022-04-20 16:56:05 +02:00
Alan Modra
c64242d8ab Revert "as: Reject unknown -gXXX option" testsuite
This reverts the test committed as part of 6ea673e2d6.
2022-04-20 23:47:19 +09:30
H.J. Lu
6ea673e2d6 as: Reject unknown -gXXX option
* as.c (parse_args): Reject unknown -gXXX option.
	* testsuite/gas/all/empty.s: New file.
	* testsuite/gas/all/pr29067.d: Likewise.
	* testsuite/gas/all/pr29067.err: Likewise.
	* testsuite/gas/all/gas.exp: Run pr29067.
2022-04-19 10:35:41 -07:00
Jan Beulich
2aaee75f81 x86: don't mistake ordinary immediates for SAE / rounding control
The way SAE templates are constructed was always puzzling me (including
the need for separate templates in the first place), and expressing the
extzra attribute via Imm8 actually has a bad effect: Ordinary immediates
would also be accepted, leading to an extra byte being added after the
instruction (i.e. generating bad code). Before re-working this (in
particular to accept proper Intel syntax there), fix the immediate issue
by adding the so far missing check.
2022-04-19 09:26:17 +02:00
Jan Beulich
bb80cf5b42 x86: VCMPSH is Evex.LLIG
These were mistakenly flagged as Evex.128. Getting the LLIG status right
for insns allowing for SAE is a prereq for planned further work.
2022-04-19 09:25:25 +02:00
Jan Beulich
b097040238 x86/Intel: test non-legacy VCVT{,U}SI2SH insn forms
For an unclear reason corresponding AVX512F tests were apparently not
cloned or used as reference here, and instead the bogus legacy forms of
the insns (with the embedded rounding specifier not last) were used.
2022-04-19 09:24:24 +02:00
Jan Beulich
2f399d995b x86: correct and simplify NOP disassembly
It's not just REX.W which is ignored with opcode 0x90. The same goes for
REX.R and REX.X as well as empty REX. None of these are forms of
"xchg %eax,%eax" (which would mean zero-extending %eax to %rax), so they
also shouldn't be disassembled this way.

While there simplify things: A single hook function suffices, thus
making it unnecessary to keep two expressions in sync. And checking
ins->address_mode for mode_64bit also is unnecessary, as "rex" can be
non-zero only in that case anyway.
2022-04-19 09:23:49 +02:00
Sergei Trofimovich
c641fe0dcb M68K: avoid quadratic slowdlow in label alignment check
Before the change tc-m68k maintained a list of seen labels.
Alignment check traversed label list to resolve symbol to label.
This caused quadratic slowdown as each symbol was checked against
each label. Worst affected files are the ones built with debugging
enabled as DWARF generates many labels.

The change embeds auxiliary label information right into symbol using
TC_SYMFIELD_TYPE.

Before the change test from PR 29058 did not finish in 10 minutes. After
the change it finishes in 2 seconds.

gas/ChangeLog:

	PR 29058
	* config/tc-m68k.h (TC_SYMFIELD_TYPE): define as m68k_tc_sy.
	* config/tc-m68k.c (m68k_frob_label): Use TC_SYMFIELD_TYPE to
	store label information.
2022-04-14 11:26:38 +01:00
Jan Beulich
66b39b8b9c gas: new_logical_line{,_flags}() can return "void"
With the sole user of the return value gone, convert the return type to
void. This in turn allows simplifying another construct, by moving it
slightly later in the function.
2022-04-12 09:04:42 +02:00
Jan Beulich
c39e89c3aa gas: drop .appfile and .appline
These were used originally to represent "# <line> <file>" constructs
inserted by (typically) compilers when pre-processing. Quite some time
ago they were replaced by .linefile though. Since the original
directives were never documented, we ought to be able to remove support
for them. As a result in a number of case function parameter aren't used
anymore and can hence be dropped.
2022-04-12 09:04:15 +02:00
Jan Beulich
657edeab38 gas: further adjust file/line handling for .macro
Commit 7992631e8c ("gas/Dwarf: improve debug info generation from .irp
and alike blocks"), while dealing okay with actual assembly source files
not using .file/.line and alike outside but not inside of .macro, has
undue effects when the logical file/line pair was already overridden:
Line numbers would continuously increment while processing the expanded
macro, while the goal of the PR gas/16908 workaround is to keep the
expansion associated with the line invoking the macro. However, as soon
as enough state was overridden _inside_ the macro to cause as_where() to
no longer fall back top as_where_physical(), honor this by resuming the
bumping of the logical line number.

Note that from_sb_is_expansion's initializer was 1 for an unknown
reason. While renaming the variable and changing its type, also change
the initializer to "expanding_none", which would have been "0" in the
original code. Originally the initializer value itself wasn't ever used
anyway (requiring sb_index != -1), as it necessarily had changed in
input_scrub_include_sb() alongside setting sb_index to other than -1.

Strictly speaking input_scrub_insert_line() perhaps shouldn't use
expanding_none, yet none of the other enumerators fit there either. And
then strictly speaking that function probably shouldn't exist in the
first place. It's used only by tic54x.
2022-04-12 09:03:43 +02:00
Jan Beulich
2ee1792bec gas: further adjust file/line handling for .irp and alike
Commit 7992631e8c ("gas/Dwarf: improve debug info generation from .irp
and alike blocks"), while dealing okay with actual assembly source files
not using .file/.line and alike outside but not inside of .irp et al,
has undue effects when the logical file/line pair was already
overridden: Line numbers would continuously increment upon every
iteration, thus potentially getting far off. Furthermore it left it to
the user to actually insert .file/.line inside such constructs. Note
though that before aforementioned change things weren't pretty either:
Diagnostics (and debug info) would be associated with the directive
terminating the iteration construct, rather than with the actual lines.

Handle this automatically by simply latching the present line and then
re-instating coordinates first thing on every iteration; note that the
file can't change from what was previously pushed on the scrubber's
state stack, and hence can be taken from there by using a new flavor of
.linefile (which is far better memory-footprint-wise than recording the
full path in the inserted directive). (This then leaves undisturbed any
file/line control occurring in the body of the construct, as these will
only be seen and processed afterwards.)
2022-04-12 09:03:13 +02:00
Jan Beulich
1a42a9fe4e x86: make {disp16} work similarly to {disp32}
In a few places {disp32} was handled specially when really {disp16}
wants handling just the same.
2022-04-12 09:01:55 +02:00