11313 Commits

Author SHA1 Message Date
Jan Beulich
cd75cd859e x86: respect ".arch nonop" when selecting which NOPs to emit
Making GENERIC64 a special case was never correct; prior to the
generalization of ".arch .no*" to cover all ISA extensions other
processor families supporting long NOPs should have been covered as
well. When introducing ".arch .nonops" (among others) it wasn't
apparent that a hidden implication of .cpunop not being possible to
separately turn off existed here. Seeing that the two large case label
blocks in the 2nd switch() already had identical behavior, simply
collapse all of the (useful) case labels into a single "default" one.
2023-10-23 10:32:32 +02:00
Jan Beulich
5e0729b655 x86: don't use operand size override with NOP in 16-bit code
Since we don't key the NOP selection to user-controlled properties, we
may not use i386 features; otherwise we would violate a possible .arch
directive restricting ISA to pre-386.
2023-10-23 10:30:55 +02:00
Jan Beulich
d164359dbc x86: don't use 32-bit LEA as NOP surrogate in 64-bit code
Except for the shared 1- and 2-byte cases, the LEA uses corrupt %rsi
(by zero-extending %esi to %rsi). Introduce separate 64-bit patterns
which keep %rsi intact.
2023-10-23 10:30:30 +02:00
Jan Beulich
d12c7ab814 x86: i386_generate_nops() may not derive decisions from global variables
What matters is what was in effect at the time the original directive
was issued. Later changes to global state (bitness or ISA) must not
affect what code is generated.
2023-10-23 10:29:54 +02:00
Jan Beulich
ed71929492 x86: record flag_code in tc_frag_data
The recorded value, and not the global variable, will want using in
TC_FRAG_INIT(). The so far file scope variable therefore needs to become
external, to be accessible there.
2023-10-23 10:28:44 +02:00
Neal Frager
1fa80e4c81 gas: testsuite: microblaze: cosmetic fix
This patch makes a cosmetic change to the reloc_weaksym.s
by making the bneid instruction all lower case like all of
the other instructions in the example.

Signed-off-by: Neal Frager <neal.frager@amd.com>
Signed-off-by: Michael J. Eager <eager@eagercon.com>
2023-10-20 11:47:09 -07:00
Neal Frager
d605374748 bfd: microblaze: Add 32_NONE reloc type
This patch adds the R_MICROBLAZE_32_NONE relocation type.
This is a 32-bit reloc that stores the 32-bit pc relative
value in two words (with an imm instruction).

Add test case to gas test suite.

Signed-off-by: Neal Frager <neal.frager@amd.com>
Signed-off-by: Michael J. Eager <eager@eagercon.com>
2023-10-20 07:12:30 -07:00
Neal Frager
2d1777b530 opcodes: microblaze: Fix bit masking bug
There is currently a bug in the bit masking for the barrel shift
instructions because the bit mask is not including all of the
register bits which must be zero.  With this patch, the disassembler
can be sure that the 32-bit value is indeed a barrel shift instruction
and not a data value in memory.

This fix can be verified by assembling and disassembling the following:

	.text
	.long 0x65005f5f

With this patch, the bug is fixed, and the objdump will know that
0x65005f5f is not a barrel shift instruction.

Signed-off-by: Neal Frager <neal.frager@amd.com>
Signed-off-by: Michael J. Eager <eager@eagercon.com>
2023-10-19 17:59:06 -07:00
Nelson Chu
4352c0ac04 RISC-V: Make sure rv32q conflict won't affect the zfa gas testcases.
According to the commit 51498ab9abc6, the q extension was no longer allowed
for rv32 since version 2.2.  Therefore, make sure the version of q is larger
than 2.2, in case the new extension conflict breaks the toolchain regressions,
which built with the old -misa-spec.

gas/
	* testsuite/gas/riscv/zfa-zvfh.d: Set q to v2.2.
	* testsuite/gas/riscv/zfa.d: Likewise.
2023-10-18 09:48:35 +08:00
Neal Frager
1a5e256f20 gas: testsuite: microblaze: Add new bit-field tests
This patch adds new gas tests for the
microblaze bsefi and bsifi instructions.

Signed-off-by: Neal Frager <neal.frager@amd.com>
Signed-off-by: Michael J. Eager <eager@eagercon.com>
2023-10-17 15:57:24 -07:00
Tsukasa OI
6674b23fe6 RISC-V: Add "lp64e" ABI support
Since RV32E and RV64E are now ratified, this commit prepares the ABI
support for LP64E (LP64 with reduced GPRs).

gas/ChangeLog:

	* config/tc-riscv.c (riscv_set_abi_by_arch): Update the error
	message.  (md_parse_option): Accept "lp64e".
	* doc/c-riscv.texi: Update the documentation to allow "lp64e".
	* testsuite/gas/riscv/mabi-fail-rv32e-lp64f.l:
	Change error message.
	* testsuite/gas/riscv/mabi-fail-rv32e-lp64d.l: Likewise.
	* testsuite/gas/riscv/mabi-fail-rv32e-lp64q.l: Likewise.
2023-10-16 04:11:07 +00:00
Tsukasa OI
f1a0961ee0 RISC-V: Remove RV64E conflict
Since RV32E *and* RV64E are ratified, RV64E is no longer invalid.

This commit removes a restriction that prevents making base ISA with
reduced GPRs with XLEN > 32.

bfd/ChangeLog:

	* elfxx-riscv.c (riscv_parse_check_conflicts): Remove RV64E
	conflict since the ratified 'E' base ISAs include RV64E.

gas/ChangeLog:

	* testsuite/gas/riscv/march-fail-base-02.d: Removed.
	* testsuite/gas/riscv/march-fail-base-02.l: Removed.
2023-10-16 04:11:07 +00:00
Neal Frager
bb0d05ff74 opcodes: microblaze: Add new bit-field instructions
This patches adds new bsefi and bsifi instructions.
BSEFI- The instruction shall extract a bit field from a
register and place it right-adjusted in the destination register.
The other bits in the destination register shall be set to zero.
BSIFI- The instruction shall insert a right-adjusted bit field
from a register at another position in the destination register.
The rest of the bits in the destination register shall be unchanged.

Further documentation of these instructions can be found here:
https://docs.xilinx.com/v/u/en-US/ug984-vivado-microblaze-ref

With version 6 of the patch, no new relocation types are added as
this was unnecessary for adding the bsefi and bsifi instructions.

FIXED: Segfault caused by incorrect termination of microblaze_opcodes.

Signed-off-by: nagaraju <nagaraju.mekala@amd.com>
Signed-off-by: Ibai Erkiaga <ibai.erkiaga-elorza@amd.com>
Signed-off-by: Neal Frager <neal.frager@amd.com>
Signed-off-by: Michael J. Eager <eager@eagercon.com>
2023-10-15 09:28:10 -07:00
mengqinggang
1fb3cdd87e LoongArch/GAS: Add support for branch relaxation
For the instructions of R_LARCH_B16/B21, if the immediate overflow,
add a B instruction and R_LARCH_B26 relocation.

For example:

.L1
  ...
  blt $t0, $t1, .L1
    R_LARCH_B16

change to:

.L1
  ...
  bge $t0, $t1, .L2
  b .L1
    R_LARCH_B26
.L2
2023-10-10 16:34:33 +08:00
cailulu
8f12a1a841 Add testsuits for new assembler option of mthin-add-sub. 2023-10-08 09:18:12 +08:00
cailulu
816029e067 as: add option for generate R_LARCH_32/64_PCREL.
Some older kernels cannot handle the newly generated R_LARCH_32/64_PCREL,
so the assembler generates R_LARCH_ADD32/64+R_LARCH_SUB32/64 by default,
and use the assembler option mthin-add-sub to generate R_LARCH_32/64_PCREL
as much as possible.

The Option of mthin-add-sub does not affect the generation of R_LARCH_32_PCREL
relocation in .eh_frame.
2023-10-08 09:18:12 +08:00
Michael J. Eager
a3f6124483 Revert "opcodes: microblaze: Add new bit-field instructions"
This reverts commit 6bbf249557ba17cfebe01c67370df4da9e6a56f9.

Maciej W. Rozycki <macro@orcam.me.uk>:
 Yet it has caused numerous regressions:

microblaze-elf  +FAIL: unordered .debug_info references to .debug_ranges
microblaze-elf  +FAIL: binutils-all/pr26548
microblaze-elf  +FAIL: readelf -Wwi pr26548e (reason: unexpected output)
microblaze-elf  +FAIL: readelf --debug-dump=loc locview-1 (reason: unexpected output) Yet it has caused numerous regressions:
microblaze-elf  +FAIL: unordered .debug_info references to .debug_ranges
microblaze-elf  +FAIL: binutils-all/pr26548
microblaze-elf  +FAIL: readelf -Wwi pr26548e (reason: unexpected output)
...
2023-10-07 15:33:10 -07:00
Neal Frager
6bbf249557 opcodes: microblaze: Add new bit-field instructions
This patches adds new bsefi and bsifi instructions.
BSEFI- The instruction shall extract a bit field from a
register and place it right-adjusted in the destination register.
The other bits in the destination register shall be set to zero.
BSIFI- The instruction shall insert a right-adjusted bit field
from a register at another position in the destination register.
The rest of the bits in the destination register shall be unchanged.

Further documentation of these instructions can be found here:
https://docs.xilinx.com/v/u/en-US/ug984-vivado-microblaze-ref

This patch has been tested for years of AMD Xilinx Yocto
releases as part of the following patch set:

https://github.com/Xilinx/meta-xilinx/tree/master/meta-microblaze/recipes-devtools/binutils/binutils

Signed-off-by: nagaraju <nagaraju.mekala@amd.com>
Signed-off-by: Ibai Erkiaga <ibai.erkiaga-elorza@amd.com>
Signed-off-by: Neal Frager <neal.frager@amd.com>
Signed-off-by: Michael J. Eager <eager@eagercon.com>
2023-10-06 10:53:45 -07:00
Saurabh Jha
0515a7b643 aarch64: Enable Cortex-X4 CPU 2023-10-05 11:09:45 +01:00
Nick Clifton
dc63d5682e Fix memory leak in RiscV assembler.
PR 30861
  * config/tc-riscv.c (riscv_insert_uleb128_fixes): Release duplicated memory.
2023-10-02 16:23:14 +01:00
Neal Frager
2677a57064 tc-microblaze.c - int compare for X_add_number.
The range check should be checking for the range
ffffffff80000000..7fffffff, not ffffffff70000000.

This patch has been tested for years of AMD Xilinx Yocto
releases as part of the following patch set:

https://github.com/Xilinx/meta-xilinx/tree/master/meta-microblaze/recipes-devtools/binutils/binutils

Signed-off-by: nagaraju <nagaraju.mekala@amd.com>
Signed-off-by: Neal Frager <neal.frager@amd.com>
Signed-off-by: Michael J. Eager <eager@eagercon.com>
2023-09-29 08:47:28 -07:00
Michael J. Eager
1a64c35996 Added support in gas for mlittle-endian and mbig-endian flags as options.
Updated show usage for MicroBlaze specific assembler options
to include new entries.

This patch has been tested for years of AMD Xilinx Yocto
releases as part of the following patch set:

https://github.com/Xilinx/meta-xilinx/tree/master/meta-microblaze/recipes-devtools/binutils/binutils

Signed-off-by: nagaraju <nagaraju.mekala@amd.com>
Signed-off-by: Neal Frager <neal.frager@amd.com>

---
V1->V2:
 - removed new options which were unnecessary
 - added documentation for MicroBlaze specific options

Signed-off-by: Michael J. Eager <eager@eagercon.com>
2023-09-28 13:14:37 -07:00
Jan Beulich
58bceb1827 x86: prefer VEX encodings over EVEX ones when possible
AVX-* features / insns paralleling earlier introduced AVX512* ones can
be encoded more compactly when the respective feature was explicitly
enabled by the user.
2023-09-27 16:53:09 +02:00
Jan Beulich
fb2637073b x86: drop cpu_arch_tune_flags
Apparently from its introduction the variable was only ever written (the
only read is merely to determine whether to write it with another value).
(Since, due to the need to re-indent, the adjacent lines setting
cpu_arch_tune need touching anyway, switch to using PREOCESSOR_*
constants where applicable, to make more obvious what the resulting
state is going to be.)
2023-09-27 16:52:08 +02:00
Jan Beulich
bd483d213a x86: correct cpu_arch_isa_flags maintenance
These may not be set from a value derived from cpu_arch_flags: That
starts with (almost) all functionality enabled, while cpu_arch_isa_flags
is supposed to track features that were explicitly enabled (and perhaps
later disabled) by the user.

To avoid needing to do any such adjustment in two places (each),
introduce helper functions used by both command line handling and
directive processing.
2023-09-27 16:51:46 +02:00
Jan Beulich
da0784f961 x86: fold FMA VEX and EVEX templates
Following the folding of some generic AVX/AVX2 templates with their
AVX512F counterpart ones, do this for FMA ones as well, requiring one
further adjustment to cpu_flags_match().
2023-09-27 14:16:09 +02:00
Jan Beulich
f94f390ef8 x86: fold VAES/VPCLMULQDQ VEX and EVEX templates
Following the folding of some generic AVX/AVX2 templates with their
AVX512F counterpart ones, do this for VAES and VPCLMULQDQ ones as well.
2023-09-27 14:15:44 +02:00
Jan Beulich
a6f3add002 x86: fold certain VEX and EVEX templates
In anticipation of APX introduce logic to reduce the number of templates
we have now, allowing to limit some the number of ones we then need to
gain.

The fundamental requirements are that
- attributes be compatible, which specifically means VexW needs to be
  the same in the templates (which often isn't the case, for VEX
  encodings having far more WIG tha, EVEX ones),
- the EVEX form being AVX512F (with or without AVX512VL), not any of its
  extensions (the same will then be required for APX - it'll need to be
  APX_F).

Note that in check_register() there's now a redundant zmm check. Since
this logic will need revisiting for APX anyway, I'd like to keep it that
way for now. (Similarly a couple of if()-s which could be folded are
kept separate, to reduce code churn when adding APX support.)
2023-09-27 14:15:19 +02:00
Jan Beulich
f586e3409b x86: tighten .insn SAE and broadcast checking
SAE / embedded rounding are invalid when there's the memory operand, as
the bit encoding this specifies broadcast in that case.

Broadcast needs to be specified on the memory operand.
2023-09-27 10:54:23 +02:00
Jan Beulich
f79d55e124 x86-64: REX.W overrides DATA_PREFIX
REX.W needs to be respected when immediate size and relocation type are
determined.
2023-09-27 10:53:59 +02:00
Jan Beulich
fb1c10585e x86-64: fix suffix-less PUSH of symbol address
PR gas/30856

In 5cc007751cdb ("x86: further adjust extend-to-32bit-address
conditions") I neglected the case of PUSH, which is the only insn
allowing (proper) symbol addresses to be used as immediates (not
displacements, like CALL/JMP) in the absence of any register operands.
Since it defaults to 64-bit operand size, guessing an L suffix is wrong
there.
2023-09-27 10:53:38 +02:00
mengqinggang
f07dd5f7dd Add support for "pcaddi rd, symbol"
Add a macro pcaddi instruction to support "pcaddi rd, symbol".

pcaddi has a 20-bit signed immediate, it can address a +/- 2MB pc relative
address, and the address should be 4-byte aligned.
2023-09-27 15:07:51 +08:00
Richard Sandiford
4abb672ac1 aarch64: Restructure feature flag handling
The AArch64 feature-flag code is currently limited to a maximum
of 64 features.  This patch reworks it so that the limit can be
increased more easily.  The basic idea is:

(1) Turn the ARM_FEATURE_FOO macros into an enum, with the enum
    counting bit positions.

(2) Make the feature-list macros take an array index argument
    (currently always 0).  The macros then return the
    aarch64_feature_set contents for that array index.

    An N-element array would then be initialised as:

      { MACRO (0), ..., MACRO (N - 1) }

(3) Provide convenience macros for initialising an
    aarch64_feature_set for:

    - a single feature
    - a list of individual features
    - an architecture version
    - an architecture version + a list of additional features

(2) and (3) use the preprocessor to generate static initialisers.
The main restriction was that uses of the same preprocessor macro
cannot be nested.  So if a macro wants to do something for N individual
arguments, it needs to use a chain of N macros to do it.  There then
needs to be a way of deriving N, as a preprocessor token suitable for
pasting.

The easiest way of doing that was to precede each list of features
by the number of features in the list.  So an aarch64_feature_set
initialiser for three features A, B and C would be written:

  AARCH64_FEATURES (3, A, B, C)

This scheme makes it difficult to keep AARCH64_FEATURE_CRYPTO as a
synonym for SHA2+AES, so the patch expands the former to the latter.
2023-09-26 15:01:21 +01:00
Claudiu Zissulescu
35d21ea02d Revert "arc: Add new GAS tests for ARCv3."
This reverts commit 462693a455f04fc52c1c91ffc52ea2446a086444.
2023-09-25 17:03:35 +03:00
Claudiu Zissulescu
6ba813bf38 Revert "arc: Update ARC's Gnu Assembler backend with ARCv3 ISA."
This reverts commit f3d38d7d0b7346515ba603454feeddc58a3fc451.
2023-09-25 17:02:29 +03:00
Claudiu Zissulescu
efd35d85fc Revert "arc: Update arc's gas tests"
This reverts commit ef90c0991e78c28bebdd3ed31a77c05be0444191.
2023-09-25 17:01:58 +03:00
Claudiu Zissulescu
f14cd06ba4 Revert "arc: Update NEWS files"
This reverts commit a47d304b1229ecf8912fac17ee9c48d1bf3c729a.
2023-09-25 17:01:47 +03:00
Claudiu Zissulescu
a47d304b12 arc: Update NEWS files
Add ARCv3 support in NEWS files.

Signed-off-by: Claudiu Zissulescu <claziss@gmail.com>
2023-09-25 11:33:12 +03:00
Claudiu Zissulescu
ef90c0991e arc: Update arc's gas tests
The disassembler can recognize the alternative register names ILINK1
and ILINK2.  Update tests.

gas/testsuite/gas/arc
xxxx-xx-xx  Claudiu Zissulescu <claziss@synopsys.com>

	* gas/testsuite/gas/arc/adc.d: Update ILINK1/INLINK2 reg names.
	* gas/testsuite/gas/arc/add.d: Likewise.
	* gas/testsuite/gas/arc/and.d: Likewise.
	* gas/testsuite/gas/arc/asl.d: Likewise.
	* gas/testsuite/gas/arc/asr.d: Likewise.
	* gas/testsuite/gas/arc/bic.d: Likewise.
	* gas/testsuite/gas/arc/lsr.d: Likewise.
	* gas/testsuite/gas/arc/nps400-1.d: Likewise.
	* gas/testsuite/gas/arc/or.d: Likewise.
	* gas/testsuite/gas/arc/ror.d: Likewise.
	* gas/testsuite/gas/arc/sbc.d: Likewise.
	* gas/testsuite/gas/arc/sub.d: Likewise.
	* gas/testsuite/gas/arc/textinsn3op.d: Likewise.
	* gas/testsuite/gas/arc/warn.exp: Update predicate.
	* gas/testsuite/gas/arc/arc.exp: Likewise.

Signed-off-by: Claudiu Zissulescu <claziss@synopsys.com>
2023-09-25 10:55:51 +03:00
Claudiu Zissulescu
f3d38d7d0b arc: Update ARC's Gnu Assembler backend with ARCv3 ISA.
The new Synopsys ARCv3 ISA has a similar instruction format like
the old ARCv1 and ARCv2 ISA.  Thus, the ARCv3 addition is using
whatever we have for old ARC processors plus some ARCv3 spcific mods.

To distinguish between various ARC variants, we introduced two new
configure defines named TARGET_ARCv3_32 and TARGET_ARCv3_64 which are
set when we choose either an ARC32 (ARCv3/32) ISA toolchain or an
ARC64 (ARCv3/64) ISA toolchain.

gas/
xxxx-xx-xx  Claudiu Zissulescu <claziss@synopsys.com>

	* gas/config/tc-arc.h: Selectively define default target macros.
	* gas/configure.ac: Add ARC64 target.
	* gas/configure.tgt: Likewise.
	* gas/configure: Regenerate
	* gas/config.in: Regenerate.
	* gas/config/tc-arc.c (DEFAULT_ARCH): New macro.
	(default_arch): New variable.
	(md_pseudo_table): Add xword.
	(md_shortopts): Only a few options are recognized by the new ARC64
	assembler.
	(md_longopts): Likewise.
	(ARC_CPU_TYPE_A64x): New define.
	(ARC_CPU_TYPE_A32x): Likewise.
	(cpu_type): New arch field.
	(selected_cpu): Update fields.
	(arc_opcode_hash_entry_iterator_init): Formating.
	(arc_opcode_hash_entry_iterator_next): Likewise.
	(arc_select_cpu): Likewise.
	(arc_option): Likewise.
	(check_cpu_feature): Likewise.
	(debug_exp): Recognize new expression operands.
	(parse_reloc_symbol): Parse new signed/unsigend cases.
	(parse_opcode_flags): Update for the case when the flags needs
	insert/extract functions.
	(find_opcode_match): Match new signed/unsigned 32-bit immediates.
	(autodetect_attributes): PLT34 only available for ARC64.
	(md_assemble): Extend match characters.
	(declare_fp_set): New function.
	(init_default_arch): Likewise.
	(md_begin): Detect and initialize the correct CPU and coresponding
	registers.
	(md_pcrel_from_section): Add new relocs.
	(arc_target_format): New function.
	(md_apply_fix): Add new relocs.
	(md_parse_option): Update options.
	(arc_show_cpu_list): Update with ARC64 cpus.
	(md_show_usage): Update messages.
	(may_relax_expr): Add PLT34 case.
	(assemble_insn): Update for ARC64.
	(arc_make_nops): New function.
	(arc_handle_align): Refurbish this function, use arc_make_nops.
	(tc_arc_fix_adjustable): Update messages.

Signed-off-by: Claudiu Zissulescu <claziss@synopsys.com>
2023-09-25 10:55:51 +03:00
Claudiu Zissulescu
462693a455 arc: Add new GAS tests for ARCv3.
Add new assembler tests for ARCv3 ISA. All the new tests are added in
a distinct folder named arc64.

gas/
xxxx-xx-xx  Claudiu Zissulescu <claziss@synopsys.com>

	* gas/testsuite/gas/arc64/arc64.exp: New file.
	* gas/testsuite/gas/arc64/float01.d: Likewise.
	* gas/testsuite/gas/arc64/float01.s: Likewise.
	* gas/testsuite/gas/arc64/ldd.d: Likewise.
	* gas/testsuite/gas/arc64/ldd.s: Likewise.
	* gas/testsuite/gas/arc64/lddl.d: Likewise.
	* gas/testsuite/gas/arc64/lddl.s: Likewise.
	* gas/testsuite/gas/arc64/load.d: Likewise.
	* gas/testsuite/gas/arc64/load.s: Likewise.
	* gas/testsuite/gas/arc64/st.d: Likewise.
	* gas/testsuite/gas/arc64/st.s: Likewise.
	* gas/testsuite/gas/arc64/std.d: Likewise.
	* gas/testsuite/gas/arc64/std.s: Likewise.
	* gas/testsuite/gas/arc64/stdl.d: Likewise.
	* gas/testsuite/gas/arc64/stdl.s: Likewise.
	* gas/testsuite/gas/arc64/stl.d: Likewise.
	* gas/testsuite/gas/arc64/stl.s: Likewise.

Signed-off-by: Claudiu Zissulescu <claziss@synopsys.com>
2023-09-25 10:55:51 +03:00
Alan Modra
a1d1634d00 elf-attrs.c memory allocation fail
Report errors rather than segfaulting.

bfd/
	* elf-attrs.c (elf_new_obj_attr): Return NULL on bfd_alloc fail.
	(bfd_elf_add_obj_attr_int): Handle NULL return from the above,
	and propagate return to callers.
	(elf_add_obj_attr_string, elf_add_obj_attr_int_string): Likewise.
	(bfd_elf_add_obj_attr_string): Similarly.
	(_bfd_elf_copy_obj_attributes): Report error on alloc fails.
	(_bfd_elf_parse_attributes): Likewise.
	* elf-bfd.h (bfd_elf_add_obj_attr_int): Update prototype.
	(bfd_elf_add_obj_attr_string): Likewise.
	(bfd_elf_add_obj_attr_int_string): Likewise.
gas/
	* config/obj-elf.c (obj_elf_vendor_attribute): Report fatal
	error on out of memory from bfd attribute functions.
	* config/tc-arc.c (arc_set_attribute_int): Likewise.
	(arc_set_attribute_string, arc_set_public_attributes): Likewise.
	* config/tc-arm.c (aeabi_set_attribute_int): Likewise.
	(aeabi_set_attribute_string): Likewise.
	* config/tc-mips.c (mips_md_finish): Likewise.
	* config/tc-msp430.c (msp430_md_finish): Likewise.
	* config/tc-riscv.c (riscv_write_out_attrs): Likewise.
	* config/tc-sparc.c (sparc_md_finish): Likewise.
	* config/tc-tic6x.c (tic6x_set_attribute_int): Likewise.
	* config/tc-csky.c (md_begin): Likewise.
	(set_csky_attribute): Return ok status.
2023-09-20 08:23:47 +09:30
Jacob Navia
cf2ab5ef0b Fix: Use of uninitialized memory
* config/tc-riscv.c (riscv_ip_hardcode): Fully initialise the allocated riscv_opcode structure.
2023-09-18 12:03:58 +01:00
Jinyang He
7c93730fe5 LoongArch: Enable gas sort relocs
The md_pre_output_hook creating fixup is asynchronous, causing relocs
may be out of order in .eh_frame. Define GAS_SORT_RELOCS so that reorder
relocs when write_relocs.

Reported-by: Rui Ueyama <rui314@gmail.com>
2023-09-15 17:01:44 +08:00
Jan Beulich
da5f9eb43f x86: fold CpuLM and Cpu64
Now that CpuLM is used solely in cpu_arch_flags and cpu_arch[] while
Cpu64 is solely used in insn templates, they no longer need to be
treated different from other "ordinary" flags; the only "unusual" one
left if CpuNo64. Fold both, leaving just Cpu64.
2023-09-15 09:57:05 +02:00
Jan Beulich
c0260ac619 x86: don't play with cpu_arch_flags.cpu{,no}64
A total four places exists where we set the two bits from flag_code, but
these values are never used. The two bits are evaluated only when coming
from insn templates.

Drop these assignments. Also make obvious that cpu_flags_check_cpu64()
is only ever used against insn templates.
2023-09-15 09:56:33 +02:00
Jan Beulich
1d07cfb440 x86: make code size vs CPU arch checking consistent
While update_code_flag() checks for LM / i386, set_cpu_arch() so far
didn't, allowing e.g. 64-bit code to be emitted after ".arch generic32".

Oddly enough a few of our testcases actually exhibit bad behavior (and
hence need minor adjustments).
2023-09-15 09:56:02 +02:00
Jan Beulich
b44fef84a9 x86: re-order update_code_flag()
Do checks before updating state, and bail upon failure of either of the
checks. While moving the code, eliminate some redundancy.
2023-09-15 09:55:34 +02:00
Jan Beulich
4fc85f37dc x86: support AVX10.1 vector size restrictions
Recognize "/<number>" suffixes on both -march=+avx10.1 and the
corresponding .arch directive, setting an upper bound on the vector size
that insns may use. Such a restriction can be reset by setting a new base
architecture, by using a suffix-less form, by disabling AVX10, or by
enabling any other VEX/EVEX-based vector extension.

While for most insns we can suppress their use with too wide operands
via registers becoming unavailable (or in Intel syntax memory operand
size specifiers not being recognized), mask register insns have to have
their minimum required vector size specified in a new attribute. (Of
course this new attribute could also be used on other insns.)

Note that .insn continues to be permitted to emit EVEX{512,256} (and
VEX256 ones) encodings regardless of vector size restrictions in place.
Of course these can't be expressed using zmm (or ymm) operands then,
but need using the EVEX.512.* forms (broadcast forms may be usable right
now, but this may go away so shouldn't be relied upon). This is why no
assertions should be added to build_{e,}vex_prefix().
2023-09-14 08:43:45 +02:00
Jan Beulich
2548c26160 x86: support AVX10.1/512
Since this is merely a re-branding of certain AVX512* features, there's
little code to be added.

The main aspect here are new testcases. In order to be able to re-use
some of the existing testcases, several of them need their start symbols
adjusted. Note that 256- and 128-bit tests want adding here, as these
need to work right away. Subsequently they'll gain vector length
constraints.

Since it was missing and is wanted here, also add an AVX512VL+VPOPCNTDQ
test.
2023-09-14 08:42:43 +02:00