Commit Graph

10641 Commits

Author SHA1 Message Date
Stam Markianos-Wright
74cb2ddeab gas: arm: Change warning message to not reference specific A-class architecture revision
We noticed that a warning message about the use of scalar fp16
instructions being UNPREDICTABLE when conditionalized in an IT
block referenced the specific A-class architecture revision
ARMv8.2-A.
Many of these instructions are now also part of ARMv8.1-M, so
the warning message had become misleading.  Here we just change
the message to not specify an architecture revision at all and
update all testing accordingly.  This was done with a simple
find-n-replace within the binutils sources.  No tests have
regressed for the arm target.

gas/ChangeLog:

        * config/tc-arm.c (do_scalar_fp16_v82_encode): Remove
        ARMv8.2-A from the warning message.
        (do_neon_movhf): Likewise
        * testsuite/gas/arm/armv8-2-fp16-scalar-bad.l: Likewise
        * testsuite/gas/arm/mve-vaddsub-it-bad.l: Likewise
        * testsuite/gas/arm/mve-vcvtne-it-bad.l: Likewise
        * testsuite/gas/arm/mve-vcvtne-it.d: Likewise
2023-04-06 15:29:52 +01:00
Stam Markianos-Wright
570b9c09bb gas: arm: Fix a further IT-predicated vcvt issue in the presense of MVE vcvtn
Previously we had experienced issues with assembling a "VCVTNE" instruction
in the presence of the MVE architecture extension, because it could be
interpreted both as:

* The base instruction VCVT + NE for IT predication when inside an IT block.
* The MVE instruction VCVTN + E in the Else of a VPT block.

Given a C reproducer of:
```
int test_function(float value)
{
  int ret_val = 10;
  if (value != 0.0)
  {
    ret_val = (int) value;
  }
  return ret_val;
}
```
GCC generates a VCVTNE instruction based on the `truncsisf2_vfp`
pattern, which will look like:
`vcvtne.s32.f32 s-reg, s-reg`
This still triggers an error due to being misidentified as "vcvtn+e"
Similar errors were found with other type combinations and instruction
patterns (these have all been added to the testing of this patch).

This class of errors was previously worked around by:
https://sourceware.org/pipermail/binutils/2020-August/112728.html
which addressed this by looking at the operand types, however,
that isn't adequate to cover all the extra cases that have been
found.  Instead, we add some special-casing logic earlier when
the instructions are parsed that is conditional on whether we are
in a VPT block or not, when the instruction is parsed.

gas/ChangeLog:

	* config/tc-arm.c (opcode_lookup): Add special vcvtn handling.
	* testsuite/gas/arm/mve-vcvtne-it-bad.l: Add further testing.
	* testsuite/gas/arm/mve-vcvtne-it-bad.s: Likewise.
	* testsuite/gas/arm/mve-vcvtne-it.d: Likewise.
	* testsuite/gas/arm/mve-vcvtne-it.s: Likewise.
2023-04-06 15:29:47 +01:00
Alan Modra
3d0046f39a PR30046, power cmpi leads to unknown architecture
PowerPC ELF always uses bfd_arch_powerpc, so we shouldn't allow the
gas -mpwr, -mpwr2 or -mpwrx options to choose bfd_arch_rs6000.
Given the possible values of ppc_cpu, I think the as_fatal at the end
of ppc_arch will never be reached, so it can be deleted and the code
simplified a little.

	PR 30046
	* config/tc-ppc.c (ppc_arch): Return bfd_arch_powerpc for ELF.
	Delete dead code.

(cherry picked from commit 4d826e132c)
2023-03-02 11:34:57 +10:30
Jan Beulich
b2bc62b7b4 gas: correct symbol name comparison in .startof./.sizeof. handling
In 162c6aef1f ("gas: fold symbol table entries generated for
.startof.() / .sizeof.()") I screwed up quite badly, inverting the case
sensitive and case insensitive comparison functions.
2023-02-14 08:38:36 +01:00
Alan Modra
1fc096a4c5 Regen config files
For the version update to 2.40.0
2023-02-06 10:48:59 +10:30
Jan Beulich
27f59ec47a RISC-V: make C-extension JAL available again for (32-bit) assembly
Along with the normal JAL alias, the C-extension one should have been
moved as well by 839189bc93 ("RISC-V: re-arrange opcode table for
consistent alias handling"), for the assembler to actually be able to
use it where/when possible.

Since neither this nor any other compressed branch insn was being tested
so far, take the opportunity and introduce a new testcase covering those.
2023-01-31 09:49:32 +01:00
Nick Clifton
36795a207d Updated translations for the gas and binutils sub-directories 2023-01-16 10:44:44 +00:00
Nick Clifton
78eca0130f Re-enable development. Update version to 2.40.0 2023-01-14 15:34:17 +00:00
Nick Clifton
32778522c7 Fix snafu in version number. Regenerate files 2023-01-14 13:52:46 +00:00
Nick Clifton
c203a2e3a8 Set development and experimental to false. Update version number to 2.40. Add release markers. Regenerate files 2023-01-14 13:42:32 +00:00
Jan Beulich
ad2021a0f7 gas/RISC-V: adjust assembler for opcode table re-ordering
PR gas/29940

With the single-operand JAL entry now sitting ahead of the two-operand
one, the parsing of a two-operand insn would first try to parse an 'a'-
style operand, resulting in the insertion of bogus (and otherwise
unused) undefined symbols in the symbol table, having register names.
Since 'a' is used as 1st operand only with J and JAL, and since JAL is
the only insn _also_ allowing for a register as 1st operand (and then
there being a 2nd one), special case this parsing aspect right there.

Reviewed-by: Palmer Dabbelt <palmer@rivosinc.com>
2023-01-11 10:35:54 +01:00
Indu Bhagat
b6250e0b72 sframe: fix the defined SFRAME_FRE_TYPE_*_LIMIT constants
An earlier commit 3f107464 defined the SFRAME_FRE_TYPE_*_LIMIT
constants.  These constants are used (by gas and libsframe) to pick an
SFrame FRE type based on the function size.  Those constants, however,
were buggy, causing the generated SFrame sections to be bloated as
SFRAME_FRE_TYPE_ADDR2/SFRAME_FRE_TYPE_ADDR4 got chosen more often than
necessary.

gas/
	* sframe-opt.c (sframe_estimate_size_before_relax): Use
	typecast.
	(sframe_convert_frag): Likewise.

libsframe/
	* sframe.c (sframe_calc_fre_type): Use a more appropriate type
	for argument.  Adjust the check for SFRAME_FRE_TYPE_ADDR4_LIMIT
	to keep it warning-free but meaningful.

include/
	* sframe-api.h (sframe_calc_fre_type): Use a more appropriate
	type for the argument.
	* sframe.h (SFRAME_FRE_TYPE_ADDR1_LIMIT): Correct the constant.
	(SFRAME_FRE_TYPE_ADDR2_LIMIT): Likewise.
	(SFRAME_FRE_TYPE_ADDR4_LIMIT): Likewise.

(cherry picked from commit 725a19bfd1)
2023-01-09 09:47:42 -08:00
Alan Modra
1061395368 Update some more copyright year ranges
These files disappear in commit 3002e78a7d but are still on the branch.
2023-01-04 22:14:03 +10:30
Alan Modra
6d53c0962c Update year range in copyright notice of binutils files
The newer update-copyright.py fixes file encoding too, removing cr/lf
on binutils/bfdtest2.c and ld/testsuite/ld-cygwin/exe-export.exp, and
embedded cr in binutils/testsuite/binutils-all/ar.exp string match.
2023-01-04 22:14:02 +10:30
Nick Clifton
447625978d Updated translations for various languages and sub-directories 2023-01-03 11:37:29 +00:00
Nick Clifton
a6452fe932 Update version number and regenerate files 2022-12-31 12:25:20 +00:00
Nick Clifton
a72b07181d Add markers for 2.40 branch 2022-12-31 12:05:28 +00:00
Alan Modra
a984f112b0 PR29948, heap-buffer-overflow in display_debug_lines_decoded
This fixes a couple of places in display_debug_lines_decoded that were
off by one in checking DWARF5 .debug_line directory indices.  It also
displays the DWARF5 entry 0 for the program current directory rather
than "." as is done for pre-DWARF5.  I decided against displaying
DW_AT_comp_dir for pre-DWARF5 since I figure it is better for readelf
to minimally interpret debug info.

binutils/
	PR 29948
	* dwarf.c (display_debug_lines_decoded): Display the given
	directory entry 0 for DWARF5.  Properly check directory index
	against number of entries in the table.  Revert to using
	unsigned int for n_directories and associated variables.
	Correct warning messages.
gas/
	* testsuite/gas/elf/dwarf-5-loc0.d: Update.
2022-12-30 21:31:19 +10:30
Tsukasa OI
c509db05e4 RISC-V: Simplify riscv_csr_address logic on state enable extensions
This commit makes CSR class handling for 'Smstateen' and 'Ssstateen'
extensions simpler using fall-throughs (as used in CSR_CLASS_I{,_32}).

gas/ChangeLog:

	* config/tc-riscv.c (riscv_csr_address): Simplify the logic for
	'Smstateen' and 'Ssstateen' extensions.
2022-12-29 01:00:13 +00:00
Christoph Müllner
767e2daed4 RISC-V: Fix T-Head Fmv vendor extension encoding
A recent change in the XTheadFmv spec fixed an encoding bug in the
document. This patch changes the code to follow this bugfix.

Spec patch can be found here:
  https://github.com/T-head-Semi/thead-extension-spec/pull/11

Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
2022-12-27 20:43:30 +01:00
Nelson Chu
fa6f3b911f RISC-V: Relax the order checking for the architecture string
* riscv-toolchain-conventions,
PR, https://github.com/riscv-non-isa/riscv-toolchain-conventions/pull/14
Issue, https://github.com/riscv-non-isa/riscv-toolchain-conventions/issues/11

* Refer to the commit afc41ffb,
RISC-V: Reorder the prefixed extensions which are out of order.

In the past we only allow to reorder the prefixed extensions.  But according
to the PR 14 in the riscv-toolchain-convention, we can also relax the order
checking to allow the whole extensions be written out of orders, including
the single standard extensions and the prefixed multi-letter extensions.
Just that we still need to follow the following rules as usual,

1. prefixed extensions need to be seperated with `_'.
2. prefixed extensions need complete <major>.<minor> version if set.

Please see the details in the march-ok-reorder gas testcase.

Passed the riscv-gnu-toolchain regressions.

bfd/
    * elfxx-riscv.c (enum riscv_prefix_ext_class): Changed RV_ISA_CLASS_UNKNOWN
    to RV_ISA_CLASS_SINGLE, since everything that does not belong to the
    multi-keyword will possible be a single extension for the current parser.
    (parse_config): Likewise.
    (riscv_get_prefix_class): Likewise.
    (riscv_compare_subsets): Likewise.
    (riscv_parse_std_ext): Removed, and merged with riscv_parse_prefixed_ext
    into riscv_parse_extensions.
    (riscv_parse_prefixed_ext): Likewise.
    (riscv_parse_subset): Only need to call riscv_parse_extensions to parse
    both single standard and prefixed extensions.
gas/
    * testsuite/gas/riscv/march-fail-order-std.d: Removed since the relaxed
    order checking.
    * testsuite/gas/riscv/march-fail-order-std.l: Likewise.
    * testsuite/gas/riscv/march-fail-order-x-std.d: Likewise.
    * testsuite/gas/riscv/march-fail-order-z-std.d: Likewise.
    * testsuite/gas/riscv/march-fail-order-zx-std.l: Likewise.
    * testsuite/gas/riscv/march-fail-unknown-std.l: Updated.
    * testsuite/gas/riscv/march-ok-reorder.d: New testcase.
2022-12-23 10:00:37 +08:00
Indu Bhagat
d429702d9e gas: sframe: testsuite: add testcase for .cfi_b_key_frame
This is actually a composite test that checks SFrame unwind information
generation for both the .cfi_negate_ra_state and .cfi_b_key_frame
directives on aarch64.

ChangeLog:

	* testsuite/gas/cfi-sframe/cfi-sframe-aarch64-pac-ab-key-1.d:
	New test.
	* testsuite/gas/cfi-sframe/cfi-sframe-aarch64-pac-ab-key-1.s:
	Likewise.
	* testsuite/gas/cfi-sframe/cfi-sframe.exp: Run new test.
2022-12-22 09:57:52 -08:00
Indu Bhagat
3369de90b8 gas: sframe: add support for .cfi_b_key_frame
Gather the information from the DWARF FDE on whether frame's return
addresses are signed using the B key or A key.  Reflect the information in
the SFrame counterpart data structure, the SFrame FDE.

ChangeLog:

	* gas/gen-sframe.c (get_dw_fde_pauth_b_key_p): New definition.
	(sframe_v1_set_func_info): Add new argument for pauth_key.
	(sframe_set_func_info): Likewise.
	(output_sframe_funcdesc): Likewise.
	* gas/gen-sframe.h (struct sframe_version_ops): Add new argument
	to the function pointer declaration.
	* gas/sframe-opt.c (sframe_convert_frag): Handle pauth_key.
2022-12-22 09:57:16 -08:00
Jan Beulich
a5ce326cfe gas: re-arrange listing output for .irp and alike
It is kind of odd to have the expansions of such constructs ahead of
their definition in listings with macro expansion enabled. Adjust this
by pulling ahead the output of the definition lines, taking care to
avoid producing a listing line for (non-existing) line 0 when the source
is stdin.

Note that with the code movement the conditional operator isn't
necessary anymore - list->line now match up.
2022-12-22 14:31:11 +01:00
Jan Beulich
760ab3d0db x86: correct/improve TSX controls
TSXLDTRK takes RTM as a prereq. Additionally introduce an umbrella "tsx"
extension option covering both RTM and HLE, paralleling the "abm" one we
already have.
2022-12-22 09:36:16 +01:00
Jan Beulich
0919e770af x86: add dependencies on SVME
SEV-ES is an extension to SVME. SNP in turn is an extension to SEV-ES,
and yet in turn RMPQUERY is a SNP extension.

Note that cpu_arch[] has no SNP entry, so CPU_ANY_SNP_FLAGS remains
unused (just like CPU_SNP_FLAGS already is).
2022-12-22 09:35:53 +01:00
Jan Beulich
25626f7939 x86: add dependencies on VMX
Both EPT and VMFUNC are extensions to VMX.
2022-12-22 09:35:32 +01:00
Jan Beulich
9a019125a6 x86: correct dependencies of a few AVX512 sub-features
Like AVX512-FP16, several other extensions require wider than 16-bit
mask registers. As a result they take AVX512BW as a prereq, not (just)
AVX512F. Which in turn points out wrong expectations in the noavx512-1
testcase.
2022-12-22 09:34:50 +01:00
Jan Beulich
b236b82a1a x86: rework noavx512-1 testcase
So far the set of ".noavx512*" has been accumulating, which isn't ideal.
In particular this hides issues with dependencies between features.
Switch back to the default ISA before disabling a particular subset.
Furthermore limit redundancy by wrapping the repeated block of insns in
an .irp.
2022-12-22 09:34:17 +01:00
Jan Beulich
b20f426174 x86: add dependencies on AVX2
Like AVX-VNNI both VAES and VPCLMUL take AVX2 as a prereq, for operating
on up to 256-bit packed integer vectors.
2022-12-22 09:33:53 +01:00
Jan Beulich
88bd2203ef x86: correct SSE dependencies
SSE itself takes FXSR as a prereq. Like AES, PCLMUL, and SHA both GFNI
and KL take SSE2 as a prereq, for operating on packed integers. And
while correcting KL also record it as a prereq to WIDEKL.
2022-12-22 09:33:26 +01:00
Jan Beulich
5091b9ee34 x86: correct what gets disabled by certain ".arch .no*"
Features with prereqs as well as features with dependents cannot re-use
CPU_*_MASK for the 3rd argument of SUBARCH() - they need to use
CPU_ANY_*_MASK in order to avoid disabling too many (when there are
prereqs) and/or too few (when there are dependents) features.

Generally any CPU_ANY_*_MASK which exist should not remain unused.
Exceptions are
- FISTTP which has no corresponding entry in cpu_arch[],
- IAMCU which is a base architecture and hence uses ARCH(), not
  SUBARCH() (only extensions can be disabled, but unlike for Cpu*86 it
  would be a little more clumsy to suppress generating of the #define).
2022-12-22 09:33:01 +01:00
Jan Beulich
4d97c5c833 x86: re-work ISA extension dependency handling
Getting both forward and reverse ISA dependencies right / consistent has
been a permanent source of mistakes. Reduce what needs specifying
manually to just the direct forward dependencies. Transitive forward
dependencies as well as reverse ones are now derived and hence cannot go
out of sync anymore (at least in the vast majority of cases; there are a
few special cases to still take care of manually). In the course of this
several CPU_ANY_*_FLAGS disappear, requiring adjustment to the
assembler's cpu_arch[].

Note that to retain the correct reverse dependency of AVX512F wrt
AVX512-VP2INTERSECT, the latter has the previously missing AVX512F
prereq added.

Note further that to avoid adding the following undue prereqs:
* ATHLON, K8, and AMDFAM10 gain CMOV and FXSR,
* IAMCU gains 387,
auxiliary table entries (including a colon-separated modifier) are
introduced in addition to the ones representing from converting the old
table.

To maintain forward-only dependencies between AVX (XOP) and SSE* (SSE4a)
(i.e. "nosse" not disabling AVX), reverse dependency tracking is
artifically suppressed.

As a side effect disabling of SSE or SSE2 will now also disable AES,
PCLMUL, and SHA (respective elements were missing from
CPU_ANY_SSE2_FLAGS).
2022-12-22 09:32:29 +01:00
Jan Beulich
9c19e9ec4d x86: rename CheckRegSize to CheckOperandSize
While originally indeed used for register size checking only, the
attribute has been used for memory operand size checking as well already
for quite a while, with more such uses recently having been added.
2022-12-21 09:07:03 +01:00
Jan Beulich
8e0eb7c6b3 Arm: break gas dependency on libopcodes
gas doesn't use anything from libopcodes (anymore?) - suppress linking
in that library.
2022-12-19 09:23:13 +01:00
Indu Bhagat
5bec250b5a gas: sframe: testsuite: add testcase for .cfi_negate_ra_state
Add a new test to check that .cfi_negate_ra_state on aarch64 is handled
well (a non-empty SFrame section with valid SFrame FREs is generated).

ChangeLog:

	* testsuite/gas/cfi-sframe/cfi-sframe-aarch64-2.d: New test.
	* testsuite/gas/cfi-sframe/cfi-sframe-aarch64-2.s: Likewise.
	* testsuite/gas/cfi-sframe/cfi-sframe.exp: Adjust the list
	accordingly.
2022-12-16 22:02:07 -08:00
Indu Bhagat
28f69152b9 gas: sframe: add support for .cfi_negate_ra_state
DW_CFA_AARCH64_negate_ra_state in aarch64 is multiplexed with
DW_CFA_GNU_window_save in the DWARF format.

Remove the common-empty-4 testcase because the generated SFrame section
will not be be empty anymore.  A relevant test will be added in a later
commit.

ChangeLog:

	* gas/gen-sframe.c (sframe_v1_set_fre_info): Add new argument
	for mangled_ra_p.
	(sframe_set_fre_info): Likewise.
	(output_sframe_row_entry): Handle mangled_ra_p.
	(sframe_row_entry_new): Reset mangled_ra_p.
	(sframe_row_entry_initialize): Initialize mangled_ra_p.
	(sframe_xlate_do_gnu_window_save): New definition.
	(sframe_do_cfi_insn): Handle DW_CFA_GNU_window_save.
	* gas/gen-sframe.h (struct sframe_row_entry): New member.
	(struct sframe_version_ops): Add a new argument for
	mangled_ra_p.
	* gas/testsuite/gas/cfi-sframe/cfi-sframe.exp: Remove test.
	* gas/testsuite/gas/cfi-sframe/common-empty-4.d: Removed.
	* gas/testsuite/gas/cfi-sframe/common-empty-4.s: Removed.
2022-12-16 22:01:51 -08:00
Jan Beulich
22a8433e00 gas: restore Dwarf info generation after macro diagnostic adjustments
While 6fdb723799 ("gas: re-work line number tracking for macros and
their expansions") was meant to leave generated Dwarf as is, it really
didn't (and the testcase intended to catch that wasn't covering the case
which broke). Its adjustment to buffer_and_nest() didn't go far enough,
leading to the "linefile" directive inserted at the top to also be
processed later in the PR gas/16908 workaround (which clearly isn't
intended - it's being put there for processing during macro expansion
only). That unnoticed flaw in turn led me to work around it by a
(suspicious to me already at the time) conditional in as_where().
2022-12-16 09:01:14 +01:00
Li Xu
207cc92d92 RISC-V: Add string length check for operands in AS
The current AS accepts invalid operands due to miss of operands length check.
For example, "e6" is an invalid operand in (vsetvli a0, a1, e6, mf8, tu, ma),
but it's still accepted by assembler.  In detail, the condition check "strncmp
(array[i], *s, len) == 0" in arg_lookup function passes with "strncmp ("e64",
"e6", 2)" in the case above.  So the generated encoding is same as that of
(vsetvli a0, a1, e64, mf8, tu, ma).

This patch fixes issue above by prompting an error in such case and also adds
a new testcase.

gas/ChangeLog:

        * config/tc-riscv.c (arg_lookup): Add string length check for operands.
        * testsuite/gas/riscv/vector-insns-fail-vsew.d: New testcase for an illegal vsew.
        * testsuite/gas/riscv/vector-insns-fail-vsew.l: Likewise.
        * testsuite/gas/riscv/vector-insns-fail-vsew.s: Likewise.
2022-12-14 17:23:12 +08:00
Jan Beulich
eb99386180 x86: adjust type checking constructs
As Alan points out, ASAN takes issue with these constructs, for
current_templates being NULL. Wrap them in sizeof(), so the expressions
aren't actually evaluated.
2022-12-14 10:07:44 +01:00
Jan Beulich
969b9a3650 gas: re-work line number tracking for macros and their expansions
The PR gas/16908 workaround aimed at uniformly reporting line numbers
to reference macro invocation sites. As mentioned in a comment this may
be desirable for small macros, but often isn't for larger ones. As a
first step improve diagnostics to report both locations, while aiming at
leaving generated debug info unaltered.

Note that macro invocation context is lost for any diagnostics issued
only after all input was processed (or more generally for any use of
as_*_where(), as the functions can't know whether the passed in location
is related to [part of] the present stack of locations). To maintain the
intended workaround behavior for PR gas/16908, a new as_where() is
introduced to "look through" macro invocations, while the existing
as_where() is renamed (and used in only very few places for now). Down
the road as_where() will likely want to return a list of (file,line)
pairs.
2022-12-13 09:11:53 +01:00
Jan Beulich
f2e469cb47 Arm: avoid unhelpful uses of .macro in testsuite
Macros with just a single use site are a little pointless to have, and
even in further cases .irp is more suitable for the purpose. Expand such
inline, avoiding the need to touch the testcases when diagnostics are
changed for code resulting from macro expansion.

While there also make what was "iter_mla" in sp-usage-thumb2-relax cover
smlatt as well, rather than testing smlabt twice.
2022-12-13 09:11:16 +01:00
Jan Beulich
a28fedbc3f x86: further re-work insn/suffix recognition to also cover MOVSX
PR gas/29524

Having templates with a suffix explicitly present has always been
quirky. After prior adjustment all that's left to also eliminate the
anomaly from move-with-sign-extend is to consolidate the insn templates
and to make may_need_pass2() cope (plus extend testsuite coverage).
2022-12-12 14:01:02 +01:00
Jan Beulich
77a19f0e19 x86: drop (now) stray IsString
The need for them on the operand-less string insns has gone away with
the removal of maybe_adjust_templates() and associated logic. Since
i386_index_check() needs adjustment then anyway, take the opportunity
and also simplify it, possible again as a result of said removal (plus
the opcode template adjustments done here).
2022-12-12 13:53:40 +01:00
Jan Beulich
e3669c7f7b x86: move bad-use-of-TLS-reloc check
Having it in match_template() is unhelpful. Neither does looking for the
next template to possibly match make any sense in that case, nor is the
resulting diagnostic making clear what the problem is.

While moving the check, also generalize it to include all SIMD and VEX-
encoded insns. This way an existing conditional can be re-used in
md_assemble(). Note though that this still leaves a lof of insns which
are also wrong to use with these relocations.

Further fold the remaining check (BFD_RELOC_386_GOT32) with the XRELEASE
related one a few lines down. This again allows re-using an existing
conditional.
2022-12-12 13:53:13 +01:00
Jan Beulich
e2b983d47e x86-64: allow HLE store of accumulator to absolute 32-bit address
In commit 1212781b35 ("ix86: allow HLE store of accumulator to
absolute address") I was wrong to exclude 64-bit code. Dropping the
check also leads to better diagnostics in 64-bit code ("MOV", after
all, isn't invalid with "XRELEASE").

While there also limit the amount of further checks done: The operand
type checks that were there were effectively redundant with other ones
anyway, plus it's quite fine to also have "xrelease mov <disp>, %eax"
look for the next MOV template (in fact again also improving
diagnostics).
2022-12-12 13:52:47 +01:00
Jan Beulich
9db83a3277 ix86: don't recognize/derive Q suffix in the common case
Have its use, except where actually legitimate, result in the same "only
supported in 64-bit mode" diagnostic as emitted for other 64-bit only
insns. Also suppress deriving of the suffix in Intel mode except in the
legitimate cases. This in exchange allows dropping the respective code
from match_template().

To maintain reasonable diagnostics (in particular to avoid "`mov' is
only supported in 64-bit mode" on the SIMD forms of MOVQ) we need to
defer parse_insn()'s emitting of errors unrelated to prefix parsing.
Utilize i.error just like match_template() does.

Oddly enough despite gcc's preference towards FILDQ and FIST{,T}Q we
had no testcase whatsoever for these. Therefore such tests are being
added. Note that the removed line in the x86-64-lfence-load testcase
was redundant with the exact same one a few lines up.
2022-12-12 13:52:15 +01:00
Jan Beulich
04784e33fa x86: re-work insn/suffix recognition
Having templates with a suffix explicitly present has always been
quirky. Introduce a 2nd matching pass in case the 1st one couldn't find
a suitable template _and_ didn't itself already need to trim off a
suffix to find a match at all. This requires error reporting adjustments
(albeit luckily fewer than I was afraid might be necessary), as errors
previously reported during matching now need deferring until after the
2nd pass (because, obviously, we must not emit any error if the 2nd pass
succeeds). While also related to PR gas/29524, it was requested that
move-with-sign-extend be left as broken as it always was.

PR gas/29525
Note that with the dropped CMPSD and MOVSD Intel Syntax string insn
templates taking operands, mixed IsString/non-IsString template groups
(with memory operands) cannot occur anymore. With that
maybe_adjust_templates() becomes unnecessary (and is hence being
removed).

PR gas/29526
Note further that while the additions to the intel16 testcase aren't
really proper Intel syntax, we've been permitting all of those except
for the MOVD variant. The test therefore is to avoid re-introducing such
an inconsistency.
2022-12-12 13:51:46 +01:00
Jan Beulich
5317ad2ccc x86: constify parse_insn()'s input
The function doesn't alter its input buffer: Reflect this in its
prototype. To avoid using any kind of cast, simply calculate the update
of "line" from the function's input and output.
2022-12-12 13:50:31 +01:00
Jan Beulich
6825a3bc86 x86: revert disassembler parts of "x86: Allow 16-bit register source for LAR and LSL"
This reverts the disassembler parts of 859aa2c86d ("x86: Allow 16-bit
register source for LAR and LSL"), adjusting testcases as necessary.
That change was itself a partial revert of c9f5b96bda ("x86: correct
handling of LAR and LSL"), without actually saying so. While the earlier
commit was properly agreed upon, the partial revert was not, and hence
should not have been committed. This is even more so that the revert
part of that change wasn't even necessary to address PR gas/29844.
2022-12-12 13:49:56 +01:00