11751 Commits

Author SHA1 Message Date
Andrew Carlotti
61f8adadd6 aarch64: Fix sve2p1 gating and add missing instructions
Many FEAT_SVE2p1 instructions need to be enabled by either of two
different features (one for streaming mode, and one for non-streaming
mode).  This patch adds correct gating conditions for these
instructions.

There were also a few sve2p1 instructions missing altogether, so add
those as well.

The testsuite is modified to check for all alternative enablement
conditions.  In many cases this is done by adding an alternative
assembler commands to existing test files.  For some SME/SME2 tests,
only some of the instructions are enabled by +sve2p1, so these are
copied into a separate test.  For original SVE2p1 tests, the non-SME2p1
instructions have been moved to a separate test file.

There are also new tests for the newly added instructions.  These
include a couple of fixme comments relating to bad error reporting,
which should be investigated later.
2025-01-17 16:42:54 +00:00
Andrew Carlotti
09bfea4a2f aarch64: Fix incorrect gating of sme-lutv2 instructions
Only the strided form of the luti4 intrinsic requires FEAT_SME2p1.
2025-01-10 16:33:51 +00:00
Jens Remus
d607533365 s390: Add arch15 Concurrent-Functions Facility insns
opcodes/
	* s390-opc.txt: Add arch15 Concurrent-Functions Facility
	instructions.
	* s390-opc.c (INSTR_SSF_RRDRD2, MASK_SSF_RRDRD2): New SSF
	instruction format variant.

gas/testsuite/
	* gas/s390/zarch-arch15.d: Tests for arch15 Concurrent-Functions
	Facility instructions.
	* gas/s390/zarch-arch15.s: Likewise.

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
(cherry picked from commit 76445f36a2f9e41b1744d0327e7ec243cb7fac12)
2024-11-18 11:05:32 +01:00
Andreas Krebbel
263e116833 s390: Add arch15 instructions
opcodes/
	* s390-mkopc.c (main) Accept arch15 as CPU string.
	* s390-opc.txt: Add arch15 instructions.

include/
	* opcode/s390.h (enum s390_opcode_cpu_val): Add
	S390_OPCODE_ARCH15.

gas/
	* config/tc-s390.c (s390_parse_cpu): New entry for arch15.
	* doc/c-s390.texi: Document arch15 march option.
	* doc/as.texi: Likewise.
	* testsuite/gas/s390/s390.exp: Run the arch15 related tests.
	* testsuite/gas/s390/zarch-arch15.d: Tests for arch15
	instructions.
	* testsuite/gas/s390/zarch-arch15.s: Likewise.

Signed-off-by: Andreas Krebbel <krebbel@linux.ibm.com>
Reviewed-by: Jens Remus <jremus@linux.ibm.com>
(cherry picked from commit a98a6fa2d8ef5eb61534b07db80850dcdf07bdb4)
2024-10-24 14:29:45 +02:00
Jens Remus
645da6d426 s390: Relax risbg[n]z, risb{h|l}gz, {rns|ros|rxs}bgt operand constraints
This leverages commit ("s390: Simplify (dis)assembly of insn operands
with const bits") to relax the operand constraints of the immediate
operand that contains the constant Z- or T-bit of the following extended
mnemonics:
risbgz, risbgnz, risbhgz, risblgz, rnsbgt, rosbgt, rxsbgt

Previously those instructions were the only ones where the assembler
on s390 restricted the specification of the subject I3/I4 operand values
exactly according to their specification to an unsigned 6- or 5-bit
unsigned integer. For any other instructions the assembler allows to
specify any operand value allowed by the instruction format, regardless
of whether the instruction specification is more restrictive.

Allow to specify the subject I3/I4 operand as unsigned 8-bit integer
with the constant operand bits being ORed during assembly.
Relax the instructions subject significant operand bit masks to only
consider the Z/T-bit as significant, so that the instructions get
disassembled as their *z or *t flavor regardless of whether any reserved
bits are set in addition to the Z/T-bit.
Adapt the rnsbg, rosbg, and rxsbg test cases not to inadvertently set
the T-bit in operand I3, as they otherwise get disassembled as their
rnsbgt, rosbgt, and rxsbgt counterpart.

This aligns GNU Assembler to LLVM Assembler.

opcodes/
	* s390-opc.c (U6_18, U5_27, U6_26): Remove.
	(INSTR_RIE_RRUUU2, INSTR_RIE_RRUUU3, INSTR_RIE_RRUUU4): Define
	as INSTR_RIE_RRUUU while retaining insn fmt mask.
	(MASK_RIE_RRUUU2, MASK_RIE_RRUUU3, MASK_RIE_RRUUU4): Treat only
	Z/T-bit of I3/I4 operand as significant.

gas/testsuite/
	* gas/s390/zarch-z10.s (rnsbg, rosbg, rxsbg): Do not set T-bit.

Reported-by: Dominik Steenken <dost@de.ibm.com>
Suggested-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
(cherry picked from commit b8b60e2d0cb0ab1f235f082dbb8a4e8bc43aadf6)
2024-10-24 14:29:45 +02:00
Jens Remus
7f7047a9c6 s390: Simplify (dis)assembly of insn operands with const bits
Simplify assembly and disassembly of extended mnemonics with operands
with constant ORed bits:
Their instruction template already contains the respective constant
operand bits, as they are significant to distinguish the extended from
their base mnemonic. Operands are ORed into the instruction template.
Therefore it is not necessary to OR the constant bits into the operand
value during assembly in s390_insert_operand.
Additionally the constant operand bits from the instruction template
can be used to mask them from the operand value during disassembly in
s390_print_insn_with_opcode. For now do so for non-length unsigned
integer operands only.

The separate instruction formats need to be retained, as their masks
differ, which is relevant during disassembly to distinguish the base
and extended mnemonics from each other.

This affects the following extended mnemonics:
- vfaebs, vfaehs, vfaefs
- vfaezb, vfaezh, vfaezf
- vfaezbs, vfaezhs, vfaezfs
- vstrcbs, vstrchs, vstrcfs
- vstrczb, vstrczh, vstrczf
- vstrczbs, vstrczhs, vstrczfs
- wcefb, wcdgb
- wcelfb, wcdlgb
- wcfeb, wcgdb
- wclfeb, wclgdb
- wfisb, wfidb, wfixb
- wledb, wflrd, wflrx

include/
	* opcode/s390.h (S390_OPERAND_OR1, S390_OPERAND_OR2,
	S390_OPERAND_OR8): Remove.

opcodes/
	* s390-opc.c (U4_OR1_24, U4_OR2_24, U4_OR8_28): Remove.
	(INSTR_VRR_VVV0U1, INSTR_VRR_VVV0U2, INSTR_VRR_VVV0U3): Define
	as INSTR_VRR_VVV0U0 while retaining respective insn fmt mask.
	(INSTR_VRR_VV0UU8): Define as INSTR_VRR_VV0UU while retaining
	respective insn fmt mask.
	(INSTR_VRR_VVVU0VB1, INSTR_VRR_VVVU0VB2, INSTR_VRR_VVVU0VB3):
	Define as INSTR_VRR_VVVU0VB while retaining respective insn fmt
	mask.
	* s390-dis.c (s390_print_insn_with_opcode): Mask constant
	operand bits set in insn template of non-length unsigned
	integer operands.

gas/
	* config/tc-s390.c (s390_insert_operand): Do not OR constant
	operand value bits.

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
(cherry picked from commit a3f1e7c56a60573562e8578ae8b675ec1f4448e7)
2024-10-24 14:29:45 +02:00
Jens Remus
d6ab1d2efd s390: Document syntax to omit base register operand
Document the s390-specific assembler syntax introduced by commit
aacf780bca29 ("s390: Allow to explicitly omit base register operand in
assembly") to omit the base register operand B in D(X,B) and D(L,B) by
coding D(X,) and D(L,).

While at it document the alternative syntax to omit the index register
operand X in D(X,B) by coding D(,B) instead of D(B).

gas/
	* doc/c-s390.texi (s390 Operands): Document syntax to omit base
	register operand.

Fixes: aacf780bca29 ("s390: Allow to explicitly omit base register operand in assembly")
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
(cherry picked from commit e75cfa9f0f81f70389b6d81d22b664c37f2403db)
2024-10-24 14:29:45 +02:00
H.J. Lu
ad2ce1e645 x86: Turn PLT32 to PC32 only for PC-relative relocations
commit 292676c15a615b5a95bede9ee91004d3f7ee7dfd
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Feb 13 13:44:17 2020 -0800

    x86: Resolve PLT32 reloc aganst local symbol to section

resolved PLT32 relocation against local symbol to section and

commit 2585b7a5ce5830e60a089aa2316a329558902f0c
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sun Jul 19 06:51:19 2020 -0700

    x86: Change PLT32 reloc against section to PC32

turned PLT32 relocation against section into PC32 relocation.  But these
transformations are valid only for PC-relative relocations.  Add fx_pcrel
check for PC-relative relocations when performing these transformations
to keep PLT32 relocation in `movq $foo@PLT, %rax`.

gas/

	PR gas/32196
	* config/tc-i386.c (tc_i386_fix_adjustable): Return fixP->fx_pcrel
	for PLT32 relocations.
	(i386_validate_fix): Turn PLT32 relocation into PC32 relocation
	only if fixp->fx_pcrel is set.
	* testsuite/gas/i386/reloc32.d: Updated.
	* testsuite/gas/i386/reloc64.d: Likewise.
	* testsuite/gas/i386/reloc32.s: Add PR gas/32196 test.
	* testsuite/gas/i386/reloc64.s: Likewise.

ld/

	PR gas/32196
	* testsuite/ld-x86-64/plt3.s: New file.
	* testsuite/ld-x86-64/x86-64.exp: Run plt3.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
(cherry picked from commit 1b714c14e40f37ea8ea02a4998c4d95f25aff7f3)
2024-09-26 07:11:13 +08:00
H.J. Lu
68d5dbd315 x86-64: Never make R_X86_64_GOT64 section relative
R_X86_64_GOT64 relocation should never be made section relative.  Change
tc_i386_fix_adjustable to return 0 for BFD_RELOC_X86_64_GOT64.

gas/

	PR gas/32189
	* config/tc-i386.c (tc_i386_fix_adjustable): Return 0 for
	BFD_RELOC_X86_64_GOT64.
	* testsuite/gas/i386/reloc64.d: Updated.
	* testsuite/gas/i386/reloc64.s: Add more tests for R_X86_64_GOT64
	and R_X86_64_GOTOFF64.

ld/

	PR gas/32189
	* testsuite/ld-x86-64/x86-64.exp: Run PR gas/32189 test.
	* testsuite/ld-x86-64/pr32189.s: New file.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
(cherry picked from commit 8015b1b0c1a1d3a581099c4855f95e4adfa3c0ad)
2024-09-21 05:52:53 +08:00
H.J. Lu
d77d08180d x86/APX: Don't promote AVX/AVX2 instructions out of APX spec
V{BROADCAST,EXTRACT,INSERT}{F,I}128 and VROUND{P,S}{S,D} aren't promoted
to support EGPR in APX spec.  Don't promote them out of APX spec.  This
commit effectively reverted:

ec3babb8c10 x86/APX: V{BROADCAST,EXTRACT,INSERT}{F,I}128 can also be expressed
5a635f1f59a x86/APX: VROUND{P,S}{S,D} encodings require AVX512{F,VL}
eea4357967b x86/APX: VROUND{P,S}{S,D} can generally be encoded

gas/

	PR gas/32171
	* testsuite/gas/i386/x86-64-apx-egpr-promote-inval.s: Add
	V{BROADCAST,EXTRACT,INSERT}{F,I}128 tests with EGPR.
	* testsuite/gas/i386/x86-64-apx-evex-promoted.s: Remove
	V{BROADCAST,EXTRACT,INSERT}{F,I}128 and VROUND{P,S}{S,D} tests
	with EGPR.
	* testsuite/gas/i386/x86-64-apx-egpr-inval.l: Updated.
	* testsuite/gas/i386/x86-64-apx-egpr-promote-inval.l: Likewise.
	* testsuite/gas/i386/x86-64-apx-evex-promoted-intel.d: Likewise.
	* testsuite/gas/i386/x86-64-apx-evex-promoted-wig.d: Likewise.
	* testsuite/gas/i386/x86-64-apx-evex-promoted.d: Likewise.

opcodes/

	PR gas/32171
	* i386-opc.tbl: Remove V{BROADCAST,EXTRACT,INSERT}{F,I}128 and
	VROUND{P,S}{S,D} entries with EGPR.
	* i386-tbl.h: Regenerated.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
(cherry picked from commit 2963d7d80dffc9feb391ce7b5f3bc1c87e932b9d)
2024-09-21 05:31:18 +08:00
Nick Clifton
beb2cdbcda This is the 2.43.1 release 2024-08-17 17:54:56 +01:00
Jan Beulich
cb204acaff gas: correct .irpc handling with empty string
Following 69cab370cf66 ("gas: adjust handling of quotes for .irpc") the
closing quote was mistakenly treated as the first quoted character.
2024-08-14 11:28:19 +02:00
Jan Beulich
d13452d18a x86: correct .insn with opcode extension and VEX/XOP/EVEX encoding
When VexVVVV handling was re-worked, .insn broke: When an opcode
extension is in use, VexVVVV_DST needs using now, as ModR/M.reg is
already occupied, matching what c8866e3ec5e2 ("x86: Drop using
extension_opcode to encode vvvv register") did.

While adding (bad) POP2 forms, also slightly adjust existing ones:
No need to use XMM registers, and no need to specify %r8 when really
%rax is meant twice (EVEX.vvvv not really being the culprit there, or
else EVEX.V' would also have needed mentioning).
2024-08-14 11:28:18 +02:00
Richard Henderson
4fe3091816 gas: sparc: Fix faligndatai assembly and disassembly
The first operand is a general register, not an fp register;
the third operand is encoded into RS2, not RS3;
the second operand must match the destination operand.
2024-08-09 08:37:41 +10:00
Xiao Zeng
bb566d7fa0 RISC-V: Add support for Zcmop extension
This implements the Zcmop (Compressed Zimop) extension, as of version 1.0.

View detailed information in:
<https://github.com/riscv/riscv-isa-manual/blob/main/src/zimop.adoc>

The Zcmop extension requires the Zca extension.

bfd/ChangeLog:

	* elfxx-riscv.c (riscv_multi_subset_supports): Handle Zcmop.
	(riscv_multi_subset_supports_ext): Ditto.

gas/ChangeLog:

	* NEWS: Updated.
	* testsuite/gas/riscv/march-help.l: Ditto.
	* testsuite/gas/riscv/zcmop.d: New test.
	* testsuite/gas/riscv/zcmop.s: New test.

include/ChangeLog:

	* opcode/riscv-opc.h (DECLARE_INSN): New declarations for Zcmop.
	(MATCH_C_MOP_1, MATCH_C_MOP_3, MATCH_C_MOP_5, MATCH_C_MOP_7,
	MATCH_C_MOP_9, MATCH_C_MOP_11, MATCH_C_MOP_13, MATCH_C_MOP_15): Define.
	(MASK_C_MOP_1, MASK_C_MOP_3, MASK_C_MOP_5, MASK_C_MOP_7,
	MASK_C_MOP_9, MASK_C_MOP_11, MASK_C_MOP_13, MASK_C_MOP_15): Ditto.
	* opcode/riscv.h (enum riscv_insn_class): Add INSN_CLASS_ZCMOP.

opcodes/ChangeLog:

	* riscv-opc.c: Add Zcmop instructions.
2024-08-07 16:10:35 +08:00
Xiao Zeng
305fe5ed3f RISC-V: Add support for Zimop extension
This implements the Zimop (May-Be-Operations) extension, as of version 1.0.

View detailed information in:
<https://github.com/riscv/riscv-isa-manual/blob/main/src/zimop.adoc>

bfd/ChangeLog:

	* elfxx-riscv.c (riscv_multi_subset_supports): Handle Zimop
	(riscv_multi_subset_supports_ext): Ditto.

gas/ChangeLog:

	* NEWS: Updated.
	* testsuite/gas/riscv/march-help.l: Ditto.
	* testsuite/gas/riscv/zimop.d: New test.
	* testsuite/gas/riscv/zimop.s: New test.

include/ChangeLog:

	* opcode/riscv-opc.h (DECLARE_INSN): New declarations for Zimop.
	(MATCH_MOP_R_0, MATCH_MOP_R_1, MATCH_MOP_R_2, MATCH_MOP_R_3,
	MATCH_MOP_R_4, MATCH_MOP_R_5, MATCH_MOP_R_6, MATCH_MOP_R_7,
	MATCH_MOP_R_8, MATCH_MOP_R_9, MATCH_MOP_R_10, MATCH_MOP_R_11,
	MATCH_MOP_R_12, MATCH_MOP_R_13, MATCH_MOP_R_14, MATCH_MOP_R_15,
	MATCH_MOP_R_16, MATCH_MOP_R_17, MATCH_MOP_R_18, MATCH_MOP_R_19,
	MATCH_MOP_R_20, MATCH_MOP_R_21, MATCH_MOP_R_22, MATCH_MOP_R_23,
	MATCH_MOP_R_24, MATCH_MOP_R_25, MATCH_MOP_R_26, MATCH_MOP_R_27,
	MATCH_MOP_R_28, MATCH_MOP_R_29, MATCH_MOP_R_30, MATCH_MOP_R_31,
	MATCH_MOP_RR_0, MATCH_MOP_RR_1, MATCH_MOP_RR_2, MATCH_MOP_RR_3,
	MATCH_MOP_RR_4, MATCH_MOP_RR_5, MATCH_MOP_RR_6, MATCH_MOP_RR_7): Define.
	(MASK_MOP_R_0, MASK_MOP_R_1, MASK_MOP_R_2, MASK_MOP_R_3, MASK_MOP_R_4,
	MASK_MOP_R_5, MASK_MOP_R_6, MASK_MOP_R_7, MASK_MOP_R_8, MASK_MOP_R_9,
	MASK_MOP_R_10, MASK_MOP_R_11, MASK_MOP_R_12, MASK_MOP_R_13,
	MASK_MOP_R_14, MASK_MOP_R_15, MASK_MOP_R_16, MASK_MOP_R_17,
	MASK_MOP_R_18, MASK_MOP_R_19, MASK_MOP_R_20, MASK_MOP_R_21,
	MASK_MOP_R_22, MASK_MOP_R_23, MASK_MOP_R_24, MASK_MOP_R_25,
	MASK_MOP_R_26, MASK_MOP_R_27, MASK_MOP_R_28, MASK_MOP_R_29,
	MASK_MOP_R_30, MASK_MOP_R_31, MASK_MOP_RR_0, MASK_MOP_RR_1,
	MASK_MOP_RR_2, MASK_MOP_RR_3, MASK_MOP_RR_4, MASK_MOP_RR_5,
	MASK_MOP_RR_6, MASK_MOP_RR_7): Ditto.
	* opcode/riscv.h (enum riscv_insn_class): Add INSN_CLASS_ZIMOP.

opcodes/ChangeLog:

	* riscv-opc.c: Add Zimop instructions.
2024-08-07 16:09:08 +08:00
Nick Clifton
02e488d0c7 Re-enable development on 2.43 branch 2024-08-04 17:45:00 +01:00
Nick Clifton
57f3676f3e this-is-the-2.43-release 2024-08-04 14:23:51 +01:00
Lulu Cai
a348bc2fcc gas/NEWS, ld/NEWS: Announce LoongArch changes in 2.43
(cherry picked from commit f722345809f9881ae99f981308ec5b5815c4a6f5)
2024-07-30 09:24:27 +08:00
Nick Clifton
633c6ac971 Updated translations for the bfd, binutils, gas, ld and opcodes directories 2024-07-29 11:57:49 +01:00
YunQiang Su
3e77f3faf9 microMIPS: Add MT ASE instruction set support
Add the MT ASE instruction operand types and encodings to the microMIPS
opcode table and enable the assembly of these instructions in GAS from
MIPSr2 onwards.  Update the binutils and GAS testsuites accordingly.

References:

"MIPS Architecture for Programmers, Volume IV-f: The MIPS MT Module for
the microMIPS32 Architecture", MIPS Technologies, Inc., Document Number:
MD00768, Revision 1.12, July 16, 2013

Co-Authored-By: Maciej W. Rozycki <macro@redhat.com>

(cherry picked from commit 08e6af1bac935c0820c51a9e6a52294b4ae4d832)
2024-07-26 18:03:40 +01:00
Nick Clifton
e23fef3eb2 Update version number to 2.42.90 2024-07-20 13:06:51 +01:00
Nick Clifton
b33c4f8f82 Add markers for 2.43 branch/release 2024-07-20 12:43:19 +01:00
Maciej W. Rozycki
ad781af697 MIPS/GAS/testsuite: Run the MT ASE test across architectures
Verify that MT ASE instructions assemble and disassemble correctly
across the compatible architectures.
2024-07-19 19:01:53 +01:00
Maciej W. Rozycki
31bd9f4682 MIPS/opcodes: Output thread context registers numerically with MFTR/MTTR
We print MFTR and MTTR instructions' thread context register operand in
disassembly using the ABI name the register number would correspond to
should the targeted register be a general-purpose register.

However in most cases it is wrong, because general-purpose registers are
only referred when the 'u' and 'sel' operands are 1 and 0 respectively.
And even in these cases the MFGPR and MTGPR aliases take precedence over
the corresponding generic instruction encodings, so you won't see the
valid case to normally trigger.

Conversely decoding the thread context register operand numerically is
always valid, so switch to using it.  Adjust test coverage accordingly.
2024-07-19 19:01:52 +01:00
Jan Beulich
91a082c1ba Sparc: relax gas testsuite whitespace expectations
In a subsequent change the scrubber is going to be changed to retain
further whitespace. Test case expectations generally would better not
depend on the specific whitespace treatment by the scrubber, unless of
course a test is specifically about it. Adjust relevant test cases to
permit blanks where those will subsequently appear.
2024-07-19 11:58:58 +02:00
Jan Beulich
6e892703fe TilePro: correct macro use in gas testsuite
Whitespace in macro arguments either needs quoting / parenthesizing to
reliably not be mistaken for an argument separator, or respective macro
parameters need to be marked as covering all remaining arguments. The
latter appears more appropriate (and far less intrusive) here.
2024-07-19 11:58:26 +02:00
Jan Beulich
c0e9aca554 MIPS: correct macro use in gas and ld testsuites
Whitespace in macro arguments either needs quoting / parenthesizing to
reliably not be mistaken for an argument separator, or respective macro
parameters need to be marked as covering all remaining arguments. The
former appears more appropriate here, as the macro parameters already
have ":req".
2024-07-19 11:58:04 +02:00
Jan Beulich
2231ac9b9e ia64: correct macro use in gas testsuite
Whitespace in macro arguments either needs quoting / parenthesizing to
reliably not be mistaken for an argument separator, or respective macro
parameters need to be marked as covering all remaining arguments. The
latter appears more appropriate here.
2024-07-19 11:57:12 +02:00
Jan Beulich
1cc4b7d755 bfin: drop _ASSIGN_BANG
A few testcases demonstrate that "=!" isn't supposed to be an
individual token, since "= !" is used in a number of places. So far
lexing that to a single token worked because of the scrubber being
overly aggressive in removing whitespace. As that's going to change,
replace uses by separate ASSIGN and BANG.
2024-07-19 11:56:46 +02:00
Jan Beulich
a1b7023447 bfin: correct macro use in gas testsuite
Whitespace in macro arguments either needs quoting / parenthesizing to
reliably not be mistaken for an argument separator, or respective macro
parameters need to be marked as covering all remaining arguments. The
latter really isn't an option here.
2024-07-19 11:56:20 +02:00
Jan Beulich
cfa18744d4 Arm: correct macro use in gas testsuite
The way the inner macro invocations are written doesn't quite work as
expected (and would actually break subsequently): Due to overly
aggressive removal of whitespace by the scrubber, the incoming \sym and
\offset arguments actually get concatenated; an empty 3rd argument is
being passed to ldrtest2. That just so happened to work as intended; any
use of \offset alone would have exposed the problem. Quote the 3rd
argument, thus retaining enough whitespace to be independent of scrubber
internals.
2024-07-19 11:55:54 +02:00
Jan Beulich
fd05d6b739 gas: adjust impossible/bogus M68K/MRI special case when scrubbing
State 1 is uniformly handled further up. And it is highly questionable
that in state 10 (i.e. after having seen not only a possible label, but
also an opcode), which is about to go away anyway, a line comment char
could still be meant to take effect. With the state checking dropped,
the immediately preceding logic can then also be simplified.
2024-07-19 11:54:45 +02:00
Jan Beulich
0d96d156ac gas: consistently drop trailing whitespace when scrubbing
From especially the checks for the two separator forms it appears to
follow that the construct being touched is about trailing whitespace. In
such a case, considering that for many targets ordinary and line comment
chars overlap, take into account that line comment chars override
ordinary ones in lex[] (logic elsewhere in do_scrub_chars() actually
depends on that ordering, and also accounts for this overriding).

Plus of course IS_NEWLINE() would better also be consulted. Note also
that the DOUBLESLASH_LINE_COMMENTS change should generally have no
effect just yet; it's a prereq for a later change but better fits here.

Leave respective comments as well, and update documentation to correct
which comment form is actually replaced by a single blank (i.e. neither
the ones starting with what {,tc_}comment_chars[] has nor the ones
starting with what line_comment_chars[] has).
2024-07-19 11:54:09 +02:00
Jan Beulich
da0fa10a4e gas: drop tic6x scrubber special case
Two successive PUT() without a state change in between can't be right:
The first PUT() may take the "goto tofull" path, leading to the
subsequent character being processed later in the previously set state
(1 in this case), rather than the state we were in upon entry to the
switch() (13 in this case).

However, the original purpose of that logic appears to be to not mistake
"|| ^" for "||^". This effect, sadly, looks to not have been achieved.
Therefore drop the special case altogether; something that actually
achieves the (presumably) intended effect may then be introduced down
the road.
2024-07-19 11:53:24 +02:00
Jan Beulich
75d0166b71 gas: pre-init the scrubber's lex[]
While we can't - unlike an old comment suggests - do this fully, we can
certainly do part of this at compile time.

Since it's adjacent, also drop the unnecessary forward declaration of
process_escape().
2024-07-19 11:52:50 +02:00
Jan Beulich
3fea91b17d x86: accept whitespace inside curly braces
Other than documented /**/ comments currently aren't really converted to
a single space, at least not for x86 in its most common configurations.
That'll be fixed subsequently, at which point blanks may appear where so
far none were expected. Furthermore not permitting blanks immediately
inside curly braces wasn't quite logical anyway - such constructs are
composite ones, and hence components ought to have been permitted to be
separated by whitespace from the very beginning.

With this we also don't care anymore whether the scrubber would remove
whitespace around curly braces, so move them from extra_symbol_chars[]
to operand_special_chars[].

Note: The new testcase doesn't actually exercise much (if any) of the
added code. It is being put in place to ensure that subsequently, when
that code actually comes into play, behavior remains the same.
2024-07-19 11:52:21 +02:00
Jan Beulich
0ff4e567db x86: undo '{' being a symbol-start character
Having it that way has undue side effects, in permitting not only
pseudo-prefixes to be parsed correctly, but also permitting odd symbol
names which ought to be possible only when quoted.  Borrow what other
architectures do: Put in place an "unrecognized line" hook to parse off
any pseudo prefixes, while using the "start of line" hook to reject ones
not actually followed by an insn. For that parsing re-use parse_insn()
in yet a slightly different mode (dealing with only pseudo-prefixes).

With that, pp may no longer be cleared from init_globals(), but instead
needs clearing after a line was fully processed. Since md_assemble() has
pretty many return paths, convert that into a local helper, with a
trivial wrapper around it.

Similarly pp may no longer be updated (by check_register()) when
processing anything other than insn operands. To be able to (easily)
recognize the case, clear current_templates.start when done with an insn
(or with .insn).
2024-07-19 11:44:07 +02:00
Jan Beulich
e3bfcef3f2 x86: split pseudo-prefix state from i386_insn
Subsequently we will want to update that ahead of md_assemble(), with
that function needing to take into account such earlier updating.
Therefore it'll want resetting separately from i.
2024-07-19 11:43:37 +02:00
Jan Beulich
8ba953169c x86/APX: add CMPcc/CTESTcc cases to noreg64 tests
This was missed when support for the insns was added. Just like for
DATA16, in

	rex64 neg (%rax)
	rex64 neg (%r16)
	rex64 {nf} neg (%rax)

it is not logical why the last one shouldn't be permitted. Bypassing
that check requires other adjustments, though, to actually properly
consume (and then squash) the prefix.
2024-07-19 10:54:22 +02:00
zhangxianting
88e7d674ef bfin: free the allocated memory 2024-07-19 10:53:12 +02:00
Maciej W. Rozycki
6eac8a3064 MIPS/GAS/testsuite: Also verify trap expansions of multiplication macros
Provide 'mul' test variants for trap expansions as requested by the
'-trap' command-line option, and run them across all the compatible
architectures.
2024-07-19 09:42:56 +01:00
Maciej W. Rozycki
37b8310680 MIPS/GAS/testsuite: Split mul test into 32-bit and 64-bit parts
Enable full 32-bit and 64-bit multiplication macro verification, by
splitting the 'mul' test into two parts respectively, and run them
across all the compatible architectures.
2024-07-19 09:42:56 +01:00
Maciej W. Rozycki
37ed5bd27a MIPS/GAS/testsuite: Run the mul macro test across architectures
The multiplication macros expand differently based on the ISA chosen, so
run the 'mul' macro test across compatible architectures, adopting the
'mul-ilocks' test orphaned by commit 23fce1e31156 ("MIPS16 intermix test
failure"), <https://sourceware.org/ml/binutils/2009-01/msg00335.html>,
and providing coverage for the expansion variants.

Only run from MIPS III up for now and remove the ISA override from the
source, so that the 64-bit instructions are covered for individual
64-bit architectures.
2024-07-19 09:42:56 +01:00
Maciej W. Rozycki
dec718565a MIPS/GAS/testsuite: Also verify trap expansions of division macros
Provide 'div' test variants for trap expansions as requested by the
'-trap' command-line option, and run them across all the compatible
architectures.
2024-07-19 09:42:56 +01:00
Maciej W. Rozycki
b734aebe68 MIPS/GAS/testsuite: Split div test into 32-bit and 64-bit parts
Enable full 32-bit and 64-bit division macro verification, by splitting
the 'div' test into two parts respectively, and run them across all the
compatible architectures.
2024-07-19 09:42:56 +01:00
Maciej W. Rozycki
a70e2bc4fc MIPS/GAS/testsuite: Run the div macro test across architectures
The division macros expand differently depending on the ISA selected, so
run the 'div' macro test across compatible architectures, adopting the
'div-ilocks' test orphaned by commit 23fce1e31156 ("MIPS16 intermix test
failure"), <https://sourceware.org/ml/binutils/2009-01/msg00335.html>,
and providing coverage for the expansion variants.

Only run from MIPS III up for now and remove the ISA override from the
source, so that the 64-bit instructions are covered for individual
64-bit architectures.
2024-07-19 09:42:56 +01:00
Maciej W. Rozycki
875ac09b12 MIPS/GAS: Handle --trap command-line option dynamically
We have an ISA check for the '--trap' command-line option that reports
its incompatibility with the MIPS I architecture.  It doesn't prevent
trap instructions from being enabled though, so when attempt is made to
emit one in an expansion of one of the division or multiplication macros
an assertion failure triggers:

.../gas/testsuite/gas/mips/brtr-opt.s: Assembler messages:
.../gas/testsuite/gas/mips/brtr-opt.s:3: Error: trap exception not supported at ISA 1
.../gas/testsuite/gas/mips/brtr-opt.s:9: Warning: divide by zero
.../gas/testsuite/gas/mips/brtr-opt.s:9: Internal error in macro_build at .../gas/config/tc-mips.c:9064.
Please report this bug.

The same assertion failure triggers without an earlier error message
when the initial ISA is compatible with the '--trap', however at the
time an attempt is made to emit a trap instruction from a division or
multiplication macro the ISA has been changed by a '.set' pseudo-op to
an incompatible one.

With the way the situations are mishandled it seems unlikely that anyone
relies on the current semantics and a sane approach is to decide on the
fly according to the currently selected ISA as to whether to emit trap
or breakpoint instructions in the case where '--trap' has been used.

Change our code to do so then and clarify that in the manual, which is
not explicit about how '--trap' is handled with a changing ISA.  Mention
the change in NEWS too since it's a applies to a user option.
2024-07-19 09:42:56 +01:00
Maciej W. Rozycki
5dd9c473f6 MIPS/GAS/testsuite: Add R10000 CPU architecture
Add a fully interlocked MIPS IV CPU so that we can have coverage for
MIPS IV instruction sequences with and without instruction separation
required for a HI/LO data anti-dependency.
2024-07-19 09:42:56 +01:00
Maciej W. Rozycki
71ddc7006b MIPS/GAS/testsuite: Reorder R5900 CPU architecture definition
The R5900 CPU architecture is based on MIPS III, so move it ahead of
MIPS IV CPU architecture definitions.  No functional change.
2024-07-19 09:42:56 +01:00