Commit Graph

4965 Commits

Author SHA1 Message Date
Haochen Jiang
704452b488 Support Intel SM4 AVX10.2 extension
In this patch, we will support SM4 AVX10.2 extension part. It is
a promotion from VEX encoding to EVEX encoding. The EVEX encoding
is based on AVX10.2, which is the same as the upcoming MOVRS ISA.
Thus, we decide to pull AVX10.2 out to CPU_COMMON_FLAGS.

While I have also tried to merge the table like AVX/AVX512, I
choose to just templatize the table. I am okay to go either way,
but slightly prefer the templatizing one since probably SM4 would
be the only ISA with AVX10.2 needs such VEX to EVEX extension (MOVRS
does not need that). Also, it is a tendancy that we will directly
provide EVEX encodings and no VEX encodings for vector instructions
since AVX10. This will make the adding in gas/config/tc-i386.c not
that worthy.

gas/ChangeLog:

	* NEWS: Support Intel SM4 EVEX instructions.
	* config/tc-i386.c (_is_cpu): Handle AVX10.2.
	* testsuite/gas/i386/i386.exp: Run SM4 tests.
	* testsuite/gas/i386/x86-64.exp: Ditto.
	* testsuite/gas/i386/avx10_2-256-sm4-intel.d: Add SM4 tests.
	* testsuite/gas/i386/avx10_2-256-sm4.d: Ditto.
	* testsuite/gas/i386/avx10_2-256-sm4.s: Ditto.
	* testsuite/gas/i386/avx10_2-512-sm4-intel.d: Ditto.
	* testsuite/gas/i386/avx10_2-512-sm4.d: Ditto.
	* testsuite/gas/i386/avx10_2-512-sm4.s: Ditto.
	* testsuite/gas/i386/avx10_2-sm4-inval.l: Ditto.
	* testsuite/gas/i386/avx10_2-sm4-inval.s: Ditto.
	* testsuite/gas/i386/x86-64-avx10_2-256-sm4-intel.d: Ditto.
	* testsuite/gas/i386/x86-64-avx10_2-256-sm4.d: Ditto.
	* testsuite/gas/i386/x86-64-avx10_2-256-sm4.s: Ditto.
	* testsuite/gas/i386/x86-64-avx10_2-512-sm4-intel.d: Ditto.
	* testsuite/gas/i386/x86-64-avx10_2-512-sm4.d: Ditto.
	* testsuite/gas/i386/x86-64-avx10_2-512-sm4.s: Ditto.
	* testsuite/gas/i386/x86-64-avx10_2-sm4-inval.l: Ditto.
	* testsuite/gas/i386/x86-64-avx10_2-sm4-inval.s: Ditto.

opcodes/ChangeLog:

	* i386-dis-evex.h: Add evex table entry for SM4.
	* i386-dis.h: Ditto.
	* i386-opc.h: (i386_cpu): Move AVX10.2 to CPU_FLAGS_COMMON.
	* i386-opc.tbl: Add SM4 EVEX instructions.
	* i386-init.h: Regenerated.
	* i386-tbl.h: Ditto.
2024-12-18 10:40:33 +08:00
Nick Clifton
ea17e06b50
Update translations for the opcodes directory for the French and Serbian languages. 2024-12-16 14:44:18 +00:00
Peter Bergner
7b6825bd0c PowerPC: Disallow r0 as a base register for the hashst and hashchk insns
Using r0 as a base address register in the ROP hashst and hashchk instructions
is invalid.  Modify the assembler to catch that illegal use and emit an error.

opcodes/
	* ppc-opc.c (insert_ras): Update error message and function comment.
	(powerpc_opcodes) <hashst, hashstp, hashchk, hashchkp>: Use RAS.
2024-12-09 17:39:51 -05:00
Lulu Cai
3d75969bd0 LoongArch: Assign DWARF register numbers to register aliases
.cfi directives only support the use of register numbers and not
register names or aliases.

This commit adds support for 4 formats, for example:
  .cfi_offset r1, 8
  .cfi_offset ra, 8
  .cfi_offset $r1,8
  .cfi_offset $ra,8

The above .cfi directives are equivalent and all represent dwarf
register number 1.

Display register aliases as specified in the psABI during disassembly.
2024-12-09 12:01:02 +08:00
Hu, Lin1
38b2f5b99b Support Intel AVX10.2 satcvt instructions
In this patch, we will support AVX10.2 satcvt instructions. All of them
are new instruction forms. In current documentation, it is still
VCVTTNEBF162I[,U]BS, but it will change to VCVTTBF162I[,U]BS eventually.

In table part, we used temporary <sign> iterator to reduce redundancy.
It definitely could be done for legacy cvt insns, but it is out of this
patch's scope.

gas/ChangeLog:

	* testsuite/gas/i386/i386.exp: Add AVX10.2 tests.
	* testsuite/gas/i386/x86-64.exp: Ditto.
	* testsuite/gas/i386/avx10_2-512-satcvt-intel.d: New test.
	* testsuite/gas/i386/avx10_2-512-satcvt.d: Ditto.
	* testsuite/gas/i386/avx10_2-512-satcvt.s: Ditto.
	* testsuite/gas/i386/avx10_2-256-satcvt-intel.d: Ditto.
	* testsuite/gas/i386/avx10_2-256-satcvt.d: Ditto.
	* testsuite/gas/i386/avx10_2-256-satcvt.s: Ditto.
	* testsuite/gas/i386/x86-64-avx10_2-512-satcvt-intel.d: Ditto.
	* testsuite/gas/i386/x86-64-avx10_2-512-satcvt.d: Ditto.
	* testsuite/gas/i386/x86-64-avx10_2-512-satcvt.s: Ditto.
	* testsuite/gas/i386/x86-64-avx10_2-256-satcvt-intel.d: Ditto.
	* testsuite/gas/i386/x86-64-avx10_2-256-satcvt.d: Ditto.
	* testsuite/gas/i386/x86-64-avx10_2-256-satcvt.s: Ditto.

opcodes/ChangeLog:

	* i386-dis-evex-prefix.h: Add PREFIX_EVEX_MAP5_68, PREFIX_EVEX_MAP5_69,
	PREFIX_EVEX_MAP5_6A, PREFIX_EVEX_MAP5_6B, PREFIX_EVEX_MAP5_6C,
	PREFIX_EVEX_MAP5_6D.
	* i386-dis-evex-w.h: Add EVEX_W_MAP5_6C_P_0, EVEX_W_MAP5_6C_P_2,
	EVEX_W_MAP5_6D_P_0, EVEX_W_MAP5_6D_P_2.
	* i386-dis-evex.h (prefix_table): Add PREFIX_EVEX_MAP5_68,
	* PREFIX_EVEX_MAP5_69, PREFIX_EVEX_MAP5_6A, PREFIX_EVEX_MAP5_6B.
	* i386-dis.c: (PREFIX_EVEX_MAP5_68): New.
	(PREFIX_EVEX_MAP5_69): Ditto.
	(PREFIX_EVEX_MAP5_6A): Ditto.
	(PREFIX_EVEX_MAP5_6B): Ditto.
	(PREFIX_EVEX_MAP5_6C): Ditto.
	(PREFIX_EVEX_MAP5_6D): Ditto.
	(EVEX_MAP5_6C_P_0): Ditto.
	(EVEX_MAP5_6C_P_2): Ditto.
	(EVEX_MAP5_6D_P_0): Ditto.
	(EVEX_MAP5_6D_P_2): Ditto.
	* i386-opc.tbl: Add AVX10.2 instructions.
	* i386-mnem.h: Regenerated.
	* i386-tbl.h: Ditto.

Co-authored-by: Zewei Mo <zewei.mo@intel.com>
Co-authored-by: Haochen Jiang <haochen.jiang@intel.com>
Co-authored-by: Levy Hsu <admin@levyhsu.com>
2024-12-05 14:49:27 +08:00
H.J. Lu
4c0a6e6037 x86: Eliminate unnecessary {evex} prefixes
For several instructions including vps{l,r}l{d,q,w,dq} and vpsra{d,w},
their VEX part do not have the following version:

	vpsrlw $0x1f,(%r15,%rcx,4),%xmm0

Thus, {evex} prefix should not be inserted when their second operand is
memory, while we still need them for register as second operand. Add a
new macro %ME to solve this problem.

For vpsraq, there is no VEX version, so the {evex} prefix should always
be eliminated.

gas/ChangeLog:

	PR binutils/32403
	* testsuite/gas/i386/i386.exp: Run new test.
	* testsuite/gas/i386/x86-64.exp: Ditto.
	* testsuite/gas/i386/evex-only.d: New test.
	* testsuite/gas/i386/evex-only.s: Ditto.
	* testsuite/gas/i386/x86-64-evex-only.d: Ditto.
	* testsuite/gas/i386/x86-64-evex-only.s: Ditto.

opcodes/ChangeLog:

	PR binutils/32403
	* i386-dis-evex-reg.h: Use %ME instead of %XE for vps{l,r}l{w,dq}
	and vpsraw. Split table for vpsra{d,q}.
	* i386-dis-evex-w.h: Use %ME instead of %XE for vps{l,r}l{d,q}
	and vpsrad. Eliminate vpsraq {evex} prefix.
	* i386-dis-evex.h: Split table for vpsra{d,q}.
	* i386-dis.c: (EVEX_W_0F72_R_4): New.
	(EVEX_W_0FE2): Ditto.
	(struct dis386): Add comment for %ME.
	(putop): Handle %ME.

Co-authored-by: Haochen Jiang <haochen.jiang@intel.com>
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2024-12-05 09:57:59 +08:00
Surya Kumari Jangala
2b6770659e PowerPC: Add support for RFC02680 - PQC Acceleration Instructions
opcodes/
	* ppc-opc.c (powerpc_opcodes): Add xvadduwm, xvadduhm, xvsubuwm,
	xvsubuhm, xvmuluwm, xvmuluhm, xvmulhsw, xvmulhsh, xvmulhuw,
	xvmulhuh.
gas/
	* testsuite/gas/ppc/future.s: New test.
	* testsuite/gas/ppc/future.d: Likewise.
2024-12-03 08:17:44 -05:00
Kong Lingling
98439a80cc Support Intel AVX10.2 BF16 instructions
In this patch, we will support AVX10.2 BF16 instructions. All of them
are new instructions forms. In current documentation, it is still
VSCALEFPBF16, but it will change to VSCALEFNEPBF16 eventually.

In disassembler part, we added %XB to reduce W table pass since all
of them get evex.w=0.

gas/Changelog:

	* testsuite/gas/i386/i386.exp: Add AVX10.2 tests.
	* testsuite/gas/i386/x86-64.exp: Ditto.
	* testsuite/gas/i386/avx10_2-256-bf16-intel.d: New.
	* testsuite/gas/i386/avx10_2-256-bf16.d: Ditto.
	* testsuite/gas/i386/avx10_2-256-bf16.s: Ditto.
	* testsuite/gas/i386/avx10_2-512-bf16-intel.d: Ditto.
	* testsuite/gas/i386/avx10_2-512-bf16.d: Ditto.
	* testsuite/gas/i386/avx10_2-512-bf16.s: Ditto.
	* testsuite/gas/i386/x86-64-avx10_2-256-bf16-intel.d: Ditto.
	* testsuite/gas/i386/x86-64-avx10_2-256-bf16.d: Ditto.
	* testsuite/gas/i386/x86-64-avx10_2-256-bf16.s: Ditto.
	* testsuite/gas/i386/x86-64-avx10_2-512-bf16-intel.d: Ditto.
	* testsuite/gas/i386/x86-64-avx10_2-512-bf16.d: Ditto.
	* testsuite/gas/i386/x86-64-avx10_2-512-bf16.s: Ditto.

opcodes/

	* i386-dis-evex-prefix.h: Update PREFIX_EVEX_0F3A08, PREFIX_EVEX_0F3A26,
	PREFIX_EVEX_0F3A56, PREFIX_EVEX_0F3A66, PREFIX_EVEX_0F3AC2,
	PREFIX_EVEX_MAP5_2F, PREFIX_EVEX_MAP5_51, PREFIX_EVEX_MAP5_58,
	PREFIX_EVEX_MAP5_59, PREFIX_EVEX_MAP5_5C, PREFIX_EVEX_MAP5_5D,
	PREFIX_EVEX_MAP5_5E, PREFIX_EVEX_MAP5_5F.
	Add PREFIX_EVEX_MAP6_2C, PREFIX_EVEX_MAP6_4C, PREFIX_EVEX_MAP6_4E,
	PREFIX_EVEX_MAP6_98, PREFIX_EVEX_MAP6_9A, PREFIX_EVEX_MAP6_9C,
	PREFIX_EVEX_MAP6_9E, PREFIX_EVEX_MAP6_A8, PREFIX_EVEX_MAP6_AA,
	PREFIX_EVEX_MAP6_AC, PREFIX_EVEX_MAP6_AE, PREFIX_EVEX_MAP6_B8,
	PREFIX_EVEX_MAP6_BA, PREFIX_EVEX_MAP6_BC, PREFIX_EVEX_MAP6_BE.
	* i386-dis-evex.h (evex_table): Update PREFIX_EVEX_MAP6_2C,
	PREFIX_EVEX_MAP6_42, PREFIX_EVEX_MAP6_4C, PREFIX_EVEX_MAP6_4E,
	PREFIX_EVEX_MAP6_98, PREFIX_EVEX_MAP6_9A, PREFIX_EVEX_MAP6_9C,
	PREFIX_EVEX_MAP6_9E, PREFIX_EVEX_MAP6_A8, PREFIX_EVEX_MAP6_AA,
	PREFIX_EVEX_MAP6_AC, PREFIX_EVEX_MAP6_AE, PREFIX_EVEX_MAP6_B8,
	PREFIX_EVEX_MAP6_BA, PREFIX_EVEX_MAP6_BC, PREFIX_EVEX_MAP6_BE.
	* i386-dis.c (PREFIX_EVEX_MAP6_2C): New enum.
	(PREFIX_EVEX_MAP6_42): Ditto.
	(PREFIX_EVEX_MAP6_4C): Ditto.
	(PREFIX_EVEX_MAP6_4E): Ditto.
	(PREFIX_EVEX_MAP6_98): Ditto.
	(PREFIX_EVEX_MAP6_9A): Ditto.
	(PREFIX_EVEX_MAP6_9C): Ditto.
	(PREFIX_EVEX_MAP6_9E): Ditto.
	(PREFIX_EVEX_MAP6_A8): Ditto.
	(PREFIX_EVEX_MAP6_AA): Ditto.
	(PREFIX_EVEX_MAP6_AC): Ditto.
	(PREFIX_EVEX_MAP6_AE): Ditto.
	(PREFIX_EVEX_MAP6_B8): Ditto.
	(PREFIX_EVEX_MAP6_BA): Ditto.
	(PREFIX_EVEX_MAP6_BC): Ditto.
	(PREFIX_EVEX_MAP6_BE): Ditto.
	(putop): Handle %XB.
	* i386-opc.tbl: Add AVX10.2 instructions.
	* i386-mnem.h: Regenerated.
	* i386-tbl.h: Ditto.

Co-authored-by: Haochen Jiang <haochen.jiang@intel.com>
2024-12-03 15:34:05 +08:00
Jan Beulich
57c526470b x86: default to not accepting MPX insns
Gcc9 had MPX support removed. While we don't want to remove support,
require these deprecated insns (and registers) to be enabled explicitly.
2024-12-02 09:39:23 +01:00
Jens Remus
36bbf8646c s390: Treat addressing operand sequence as one in disassembler
Reuse logic introduced with the preceding commit in the assembler to
treat addressing operand sequences D(X,B), D(B), and D(L,B) as one
with regards to optional last operands (i.e. optparm and optparm2).

With this "nop" now disassembles into "nop" instead of "nop 0".

opcodes/
	* s390-dis.c (operand_count): New helper to count the remaining
	operands, treating D(X,B), D(B), and D(L,B) as one.
	(skip_optargs_p): New helper to test whether remaining operands
	 are optional.
	(skip_optargs_zero_p): New helper to test whether remaining
	operands are optional and their values are zero.
	(s390_print_insn_with_opcode): Use skip_optargs_zero_p to skip
	optional last operands with a value of zero.

gas/testsuite/
	* gas/s390/zarch-optargs.d (nop): Adjust test case accordingly.

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2024-11-29 15:37:19 +01:00
Jens Remus
7507fe3798 s390: Fix disassembly of optional addressing operands
"nop D1(B1)" erroneously disassembled into "nop D1(B1" (missing
closing parenthesis).  "nop D1(X1,0)" and "nop D1(X1,)" erroneously
disassembled into "nop D1(X1)" (missing zero base register) instead
of "nop D1(X1,0)".

Do not skip disassembly of optional operands if they are index (X)
or base (B) registers or length (L) in an addressing operand sequence
"D(X,B)",  "D(B)", or "D(L,B).  Index and base register operand values
of zero are being handled separately, as they may not be omitted
unconditionally.  For instance a base register value of zero must be
printed in above mentioned case, to distinguish the index from the
base register.  This also ensures proper formatting of addressing
operand sequences.

While at it add further test cases for instructions with optional
operands.

opcodes/
	* s390-dis.c (s390_print_insn_with_opcode): Do not
	unconditionally skip disassembly of optional operands with a
	value of zero, if within an addressing operand sequence.

gas/testsuite/
	* gas/s390/zarch-optargs.d: Add further test cases for
	instructions with optional operands.
	* gas/s390/zarch-optargs.s: Likewise.

Reported-by: Florian Krohm <flo2030@eich-krohm.de>
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2024-11-29 15:37:19 +01:00
Jan Beulich
cebbeb5f9a x86: SETcc doesn't permit W suffix
Accidentally I had removed No_wSuf when cloning the extra template.
2024-11-29 09:35:25 +01:00
Alan Modra
7a55d8e4df Re: nios2: Remove binutils support for Nios II target
Remove a now unused config file, regenerate POTFILES to remove nios2
refs, and modify config.bfd to report the target is obsolete.
2024-11-27 10:34:08 +10:30
Sandra Loosemore
e7a16d9fd6 nios2: Remove binutils support for Nios II target.
The Nios II architecture has been EOL'ed by the vendor.  This patch
removes all binutils, bfd, gas, binutils, and opcodes support for this
target with the exception of the readelf utility.  (The ELF EM_*
number remains valid and the relocation definitions from the Nios II
ABI will never change in future, so retaining the readelf support
seems consistent with its purpose as a utility that tries to parse the
headers in any ELF file provided as an argument regardless of target.)
2024-11-26 19:13:07 +00:00
Tom de Vries
6206516653 opcodes: fix Werror=format build breaker in opcodes/riscv-dis.c
I build gdb on arm-linux and ran into:
...
  CC       riscv-dis.lo
opcodes/riscv-dis.c: In function ‘print_insn_args’:
opcodes/riscv-dis.c:743:29: error: format ‘%lu’ expects argument of type \
  ‘long unsigned int’, but argument 4 has type ‘insn_t’ \
  {aka ‘long long unsigned int’} [-Werror=format=]
  743 |                          "%lu", EXTRACT_ZCMT_INDEX (l));
      |                           ~~^
      |                             |
      |                             long unsigned int
      |                           %llu
...

Fix this by printing the insn_t value, which is a uint64_t, using PRIu64.

Tested by finishing the build.
2024-11-24 09:21:28 +01:00
Nelson Chu
595e49a4b7 RISC-V: Support SiFive extensions: xsfvqmaccdod, xsfvqmaccqoq and xsfvfnrclipxfqf
Those SiFive extensions have been published on the web for a while, and we plan
to implement intrinsics in GCC for those instructions soon.

NOTE: The original patch was written by Nelson when he was still working at
SiFive, and Kito rebased it to the trunk. Therefore, I kept the author as Nelson
with his SiFive email.

Document links:
xsfvqmaccdod: https://www.sifive.com/document-file/sifive-int8-matrix-multiplication-extensions-specification
xsfvqmaccqoq: https://www.sifive.com/document-file/sifive-int8-matrix-multiplication-extensions-specification
xsfvfnrclipxfqf: https://www.sifive.com/document-file/fp32-to-int8-ranged-clip-instructions

Co-authored-by: Kito Cheng <kito.cheng@sifive.com>
2024-11-22 09:56:54 +08:00
Peter Bergner
e7bc2c935c PowerPC: Add support for RFC02677 - VSX Vector Rotate Left Word
opcodes/
	* ppc-opc.c (powerpc_opcodes): Add xvrlw.

gas/
	* testsuite/gas/ppc/future.s: Add test for xvrlw.
	* testsuite/gas/ppc/future.d: Likewise.
2024-11-20 18:33:07 -05:00
Andre Vieira
1fb5ccd6bf arm: Support pac_key_* register operand for MRS/MSR in Armv8.1-M Mainline
Add support for pac_key_[pu]_[0-3](_ns)? register operands for the MRS and MSR
instructions when assembling for Armv8.1-M Mainline, as well as adding the
corresponding support for disassembling instructions that use it.
2024-11-20 17:15:28 +00:00
Jiawei
00ef37e860 RISC-V: Add Zcmt instructions and csr.
This patch supports Zcmt[1] instruction 'cm.jt' and 'cm.jalt'.
Add new CSR jvt for tablejump using. Since 'cm.jt' and 'cm.jalt'
have the same instructiong encoding, use 'match_cm_jt' and 'match_cm_jalt'
check the 'zcmt_index' field to distinguish them.

[1] https://github.com/riscvarchive/riscv-code-size-reduction/releases

Co-Authored by: Charlie Keaney <charlie.keaney@embecosm.com>
Co-Authored by: Mary Bennett <mary.bennett@embecosm.com>
Co-Authored by: Nandni Jamnadas <nandni.jamnadas@embecosm.com>
Co-Authored by: Sinan Lin <sinan.lin@linux.alibaba.com>
Co-Authored by: Simon Cook <simon.cook@embecosm.com>
Co-Authored by: Shihua Liao <shihua@iscas.ac.cn>
Co-Authored by: Yulong Shi <yulong@iscas.ac.cn>

bfd/ChangeLog:

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

gas/ChangeLog:

	* config/tc-riscv.c (enum riscv_csr_class): New CSR.
	(riscv_csr_address): Ditto.
	(validate_riscv_insn): New operand.
	(riscv_ip): Ditto.
	* testsuite/gas/riscv/csr-version-1p10.d: New CSR.
	* testsuite/gas/riscv/csr-version-1p10.l: Ditto.
	* testsuite/gas/riscv/csr-version-1p11.d: Ditto.
	* testsuite/gas/riscv/csr-version-1p11.l: Ditto.
	* testsuite/gas/riscv/csr-version-1p12.d: Ditto.
	* testsuite/gas/riscv/csr-version-1p12.l: Ditto.
	* testsuite/gas/riscv/csr.s: Ditto.
	* testsuite/gas/riscv/march-help.l: New extension.
	* testsuite/gas/riscv/zcmt-fail.d: New test.
	* testsuite/gas/riscv/zcmt-fail.l: New test.
	* testsuite/gas/riscv/zcmt-fail.s: New test.
	* testsuite/gas/riscv/zcmt.d: New test.
	* testsuite/gas/riscv/zcmt.s: New test.

include/ChangeLog:

	* opcode/riscv-opc.h (MATCH_CM_JT): New opcode.
	(MASK_CM_JT): New mask.
	(MATCH_CM_JALT): New opcode.
	(MASK_CM_JALT): New mask.
	(CSR_JVT): New CSR.
	(DECLARE_INSN): New declaration.
	(DECLARE_CSR): Ditto.
	* opcode/riscv.h (EXTRACT_ZCMT_INDEX): New marco.
	(ENCODE_ZCMT_INDEX): Ditto.
	(enum riscv_insn_class): New class.

opcodes/ChangeLog:

	* riscv-dis.c (print_insn_args): New operand.
	* riscv-opc.c (match_cm_jt): New function.
	(match_cm_jalt): Ditto.
2024-11-20 08:26:39 +08:00
Hu, Lin1
d7d71afa6a Support x86 Intel MSR_IMM
gas/ChangeLog:

	* NEWS: Support x86 Intel MSR_IMM.
	* config/tc-i386.c (cpu_arch): Add MSR_IMM.
	(cpu_flags_match): Add MSR_IMM to APX_F related processing.
	(i386_assemble): WRMSRNS's first operand is imm32, so add
	MN_wrmsrns like MN_uwrmsr.
	* doc/c-i386.texi: Document .msr_imm.
	* testsuite/gas/i386/i386.exp: Run MSR_IMM tests.
	* testsuite/gas/i386/x86-64.exp: Ditto.
	* testsuite/gas/i386/msr_imm-inval.l: New test.
	* testsuite/gas/i386/msr_imm-inval.s: Ditto.
	* testsuite/gas/i386/x86-64-msr_imm-intel.d: Ditto.
	* testsuite/gas/i386/x86-64-msr_imm.d: Ditto.
	* testsuite/gas/i386/x86-64-msr_imm.s: Ditto.

opcodes/ChangeLog:

	* i386-dis.c: Add REG_VEX_MAP7_F6_L_0_W_0,
	PREFIX_VEX_MAP7_F6_L_0_W_0_R_0_X86_64,
	X86_64_VEX_MAP7_F6_L_0_W_0_R_0,
	VEX_LEN_MAP7_F6,
	VEX_W_MAP7_F6_L_0.
	(reg_table): New entry for MSR_IMM.
	(prefix_table): Ditto.
	(x86_64_table): Ditto.
	(vex_len_table): Ditto.
	(vex_w_table): Ditto.
	(map7_f6_opcode): New variable for MAP7.
	(get_valid_dis386): Support MAP7.
	* i386-gen.c (cpu_flags): Add MSR_IMM.
	* i386-init.h: Regenerated.
	* i386-mnem.h: Ditto.
	* i386-opc.h (i386_cpu_flags): Add cpumsr_imm.
	* i386-opc.tbl: Add MSR_IMM instructions.
	* i386-tbl.h: Regenerated.
2024-11-19 10:45:56 +08:00
Jan Beulich
335cb88259 x86: rename SPACE_{,E}VEX_MAP<N>
Map7 already has dual purpose for USER-MSR (and is to gain more for
MSR-IMM), while Map5 is about to gain VEX uses for AMX extensions. Drop
the not really meaningful infixes and (in the opcode table) prefixes,
retaining merely EVexMap4 for encoding EVex128 at the same time.
2024-11-18 11:46:28 +01:00
Jan Beulich
497ee27a74 x86: VP2INTERSECT{D,Q} have mask register destination group
Much like AVX512-{4FMAPS,4VNNIW} have a constraint on their register
source, there's a constraint (need to be even) on the destination
register here.

Adjust "good" test cases accordingly, and add a new test case to check
the warning.
2024-11-18 11:45:50 +01:00
Jan Beulich
3c17b69fa1 x86: generalize "implicit quad group" handling
We'll want to re-use it for VP2INTERSECT{D,Q}.

While there add a testcase for the similarly affected AVX512-4VNNIW
insns.
2024-11-18 11:45:34 +01:00
Jens Remus
76445f36a2 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>
2024-11-18 10:42:21 +01:00
Jens Remus
b0588b2173 s390: Add arch15 instruction names
opcodes/
	* s390-opc.txt: Add arch15 instruction names.

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2024-11-18 10:42:21 +01:00
Sam James
8ebe62f3f0
opcodes: fix -std=gnu23 compatibility wrt static_assert
static_assert is declared in C23 so we can't reuse that identifier:
* Define our own static_assert conditionally;

* Rename "static assert" hacks to _N as we do already in some places
  to avoid a conflict.

ChangeLog:
	PR ld/32372

        * i386-gen.c (static_assert): Define conditionally.
        * mips-formats.h (MAPPED_INT): Rename identifier.
        (MAPPED_REG): Rename identifier.
        (OPTIONAL_MAPPED_REG): Rename identifier.
        * s390-opc.c (static_assert): Define conditionally.
2024-11-18 03:09:15 +00:00
Matthieu Longo
3a4653efc3 aarch64: add flag OPD_F_UNSIGNED to distinguish signedness of immediate operands
This patch introduces a new operand flag OPD_F_UNSIGNED to signal that
the immediate value should be treated as an unsigned value. The default
signedness of immediate operands is signed.
2024-11-08 11:35:46 +00:00
Matthieu Longo
46dace1933 aarch64: improve debuggability on array of enum
The current space optmization on enum aarch64_opn_qualifier forced its
encoding using an unsigned char. This "hard-coded" optimization has the
bad consequence of making the array of such enums being completely
unreadable when debugging with GDB because the enum type is lost along
the way.
Keeping this space optimization, and the enum type as well, is possible
when the declaration of the enum is tagged with attribute((packed)).
attribute((packed)) is a GNU extension, and is wrapped in the macro
ATTRIBUTE_PACKED (defined in ansidecl.h), and should be used instead.
2024-11-08 11:35:46 +00:00
Matthieu Longo
c703d0aff5 aarch64: change returned type to bool to match semantic of functions 2024-11-08 11:35:46 +00:00
Andre Vieira
cfbbd40333 arm, objdump: print obsolote warning when 26-bit set in instructions
Arm has obsoleted the 26-bit addressing mode. Diagnose this when disasembling
these instructions by printing OBSOLETE.
2024-11-08 10:06:57 +00:00
Andre Vieira
2c9d089c90 arm, objdump: Make objdump use bfd's machine detection to drive disassembly
For any arm elf target, disable an old piece of code that forced disassembly to
disassemble for 'unknown architecture' which once upon a time meant it would
disassemble ANY arm instruction.  This is no longer true with the addition of
Armv8.1-M Mainline, as there are conflicting encodings for different thumb
instructions.

BFD however can detect what architecture the object file was assembled for
using information in the notes section.  So if available, we use that,
otherwise we default to the old 'unknown' behaviour.

With the changes above code, a mode changing 'bx lr' assembled for armv4 with
the option --fix-v4bx will result in an object file that is recognized by bfd
as one for the armv4 architecture.  The disassembler now disassembles this
encoding as a BX even for Armv4 architectures, but warns the user when
disassembling for Armv4 that this instruction is only valid from Armv4T
onwards.

Remove the unused and wrongfully defined ARM_ARCH_V8A_CRC, and
define and use a ARM_ARCH_V8R_CRC to make sure instructions enabled by
-march=armv8-r+crc are disassembled correctly.

Patch up some of the tests cases, see a brief explanation for each below.

inst.d:
This test checks the assembly & disassembly of basic instructions in armv3m. I
changed the expected behaviour for teqp, cmnp cmpp and testp instructions to
properly print p when disassembling, whereas before, in the 'unknown' case it
would disassemble these as UNPREDICTABLE as they were changed in later
architectures.

nops.d:
Was missing an -march, added one to make sure we were testing the right
behavior of NOP<c> instructions.

unpredictable.d:
Was missing an -march, added armv6 as that reproduced the behaviour being
tested.
2024-11-08 10:06:38 +00:00
Nelson Chu
004a5bfc72 RISC-V: Dump instruction without checking architecture support as usual.
Since QEMU have supported -Max option to to enable all normal extensions,
the dis-assembler should also add an option, -M,max to do the same thing.
For the instruction, which have overlapped encodings like zfinx, will not
be considered by the -M,max option.

opcodes/
	* riscv-dis.c (all_ext): New static boolean.  If set, disassemble
	without checking architectire string.
	(riscv_disassemble_insn): Likewise.
	(parse_riscv_dis_option_without_args): Recognized -M,max option.
binutils/
	* NEWS: Updated.
2024-10-31 11:28:45 +08:00
Jan Beulich
a3db0f57df x86/APX: support JMPABS also in assembler
Without this APX support isn't really complete.

For Intel syntax displacement form is needed, such that symbolic
operands won't need prefixing by "offset". (The other form is actually
not used at all in Intel syntax.)

For the record: To restrict displacement form to Intel syntax is not
something I actually agree with.
2024-10-30 12:12:54 +01:00
Jan Beulich
5168ed9912 x86: use <xyz> for VFPCLASSP{S,D}
Just like VFPCLASSPH does. While the order of generated table entries
changes this way, the individual entries don't change.
2024-10-29 08:08:50 +01:00
MayShao-oc
b2841da4f2 x86: Regenerate missing table files
As soon as I committed Zhaoxin's patch, I realized that I did not
include the regen file. Regenerate them and commit as obvious.

opcodes/ChangeLog:

	* i386-tbl.h: Regenerated.
	* i386-mnem.h: Ditto.
	* i386-init.h: Ditto.
2024-10-18 15:57:22 +08:00
MayShao-oc
8f0d880434 x86: Support x86 ZHAOXIN GMI instructions
gas/ChangeLog:

	* NEWS: Support ZHAOXIN GMI instructions.
	* config/tc-i386.c: Add gmi.
	* doc/c-i386.texi: Document gmi.
	* testsuite/gas/i386/i386.exp: Add gmi test.
	* testsuite/gas/i386/gmi.d: Ditto.
	* testsuite/gas/i386/gmi.s: Ditto.

opcodes/ChangeLog:

	* i386-dis.c: New comment.
	* i386-gen.c: Add gmi.
	* i386-opc.h (CpuGMI): New.
	* i386-opc.tbl: Add Zhaoxin GMI instructions.
	* i386-tbl.h: Regenerated.
	* i386-mnem.h: Ditto.
	* i386-init.h: Ditto.
2024-10-18 15:45:11 +08:00
Liwei Xu
3bac89e65f Support Intel AVX10.2 convert instructions
In this patch, we will support AVX10.2 convert instructions. All
of them are new instruction forms.

Among all the instructions, vcvtbiasph2[b,h]f8[,s] needs extra care.
Since Operand 2 could indicate memory size, we do not need suffix
under ATTmode. However, we could not fold all three templates but only
XMM/YMM since the dst operand size are the same for them. Also, a new
iterator <cvt8> is added to reduce redundancy.

gas/
	* testsuite/gas/i386/i386.exp: Add AVX10.2 tests.
	* testsuite/gas/i386/x86-64.exp: Ditto.
	* testsuite/gas/i386/avx10_2-256-cvt-intel.d: New.
	* testsuite/gas/i386/avx10_2-256-cvt.d: Ditto.
	* testsuite/gas/i386/avx10_2-256-cvt.s: Ditto.
	* testsuite/gas/i386/avx10_2-512-cvt-intel.d: Ditto.
	* testsuite/gas/i386/avx10_2-512-cvt.d: Ditto.
	* testsuite/gas/i386/avx10_2-512-cvt.s: Ditto.
	* testsuite/gas/i386/x86-64-avx10_2-256-cvt-intel.d: Ditto.
	* testsuite/gas/i386/x86-64-avx10_2-256-cvt.d: Ditto.
	* testsuite/gas/i386/x86-64-avx10_2-256-cvt.s: Ditto.
	* testsuite/gas/i386/x86-64-avx10_2-512-cvt-intel.d: Ditto.
	* testsuite/gas/i386/x86-64-avx10_2-512-cvt.d: Ditto.
	* testsuite/gas/i386/x86-64-avx10_2-512-cvt.s: Ditto.

opcodes/
	* i386-dis-evex-prefix.h: Add PREFIX_EVEX_0F3874,
	PREFIX_EVEX_MAP5_18, PREFIX_EVEX_MAP5_1B,
	PREFIX_EVEX_MAP5_1E and PREFIX_EVEX_MAP5_74.
	* i386-dis-evex.h: Add table pass for AVX10.2
	instructions.
	* i386-dis.c (MOD_EVEX_0F38B1): New.
	(PREFIX_EVEX_0F3874): Ditto.
	(PREFIX_EVEX_MAP5_18): Ditto.
	(PREFIX_EVEX_MAP5_1B): Ditto.
	(PREFIX_EVEX_MAP5_1E): Ditto.
	(PREFIX_EVEX_MAP5_74): Ditto.
	* i386-opc.tbl: Add AVX10.2 instructions.
	* i386-mnem.h: Regenerated.
	* i386-tbl.h: Ditto.

Co-authored-by: Kong Lingling <lingling.kong@intel.com>
Co-authored-by: Haochen Jiang <haochen.jiang@intel.com>
2024-10-16 10:25:35 +08:00
Jan Beulich
f5bb7f3324 x86: also template-expand trailing mnemonic part
So far template expansion was limited to fields other than the insn
mnemonic. In order to be able to use <fop> also for AVX10.2 we want the
trailing mnemonic part to also be expanded. Split out the respective
piece of code into a helper function, which is then invoked twice.
2024-10-14 14:38:02 +02:00
Lulu Cai
22c6209285 LoongArch: Fixed R_LARCH_[32/64]_PCREL generation bug
The enum BFD_RELOC_[32/64] was mistakenly used in the macro instead
of the relocation in fixp. This can cause the second relocation
of a pair to be deleted when -mthin-add-sub is enabled. Apply the
correct macro to fix this.

Also sets the initial value of -mthin-add-sub.
2024-10-14 09:15:16 +08:00
Haochen Jiang
873e7b6cf6 Support Intel AVX10.2 media instructions
In disassembler part, for vnni instructions, we extended previous
VEX part using %XE in disassembler to promote them to EVEX by reusing
the original VEX table. For vmpsadbw, we will also use %XE. However,
it is hard to reuse the VEX table, so we are using new ones.

In assmbler part, we put the vnni table entries with previous vnni
instructions since they are just promotion from AVX-VNNI-INT{8,16}.
Since we will prefer VEX encoding, we need to use the different table
order in template <vnni>, which prefers EVEX due to earlier introduction
for AVX512_VNNI than AVX_VNNI. This means a new <vnni>. For vdpphps
and vmpsadbw, we put them at the end of the table, with future AVX10.2
instructions.

Nit: I will remove the arch requirement for avx_vnni_int{8,16} in
evex-promote testcases after AVX10.2 implies AVX-VNNI-INT{8,16}.

gas/Changelog:

	* testsuite/gas/i386/i386.exp: Add AVX10.2 tests.
	* testsuite/gas/i386/x86-64.exp: Ditto.
	* testsuite/gas/i386/avx10_2-256-1-intel.d: New.
	* testsuite/gas/i386/avx10_2-256-1.d: Ditto.
	* testsuite/gas/i386/avx10_2-256-1.s: Ditto.
	* testsuite/gas/i386/avx10_2-512-1-intel.d: Ditto.
	* testsuite/gas/i386/avx10_2-512-1.d: Ditto.
	* testsuite/gas/i386/avx10_2-512-1.s: Ditto.
	* testsuite/gas/i386/avx10_2-promote.d: Ditto.
	* testsuite/gas/i386/avx10_2-promote.s: Ditto.
	* testsuite/gas/i386/x86-64-avx10_2-256-1-intel.d: Ditto.
	* testsuite/gas/i386/x86-64-avx10_2-256-1.d: Ditto.
	* testsuite/gas/i386/x86-64-avx10_2-256-1.s: Ditto.
	* testsuite/gas/i386/x86-64-avx10_2-512-1-intel.d: Ditto.
	* testsuite/gas/i386/x86-64-avx10_2-512-1.d: Ditto.
	* testsuite/gas/i386/x86-64-avx10_2-512-1.s: Ditto.
	* testsuite/gas/i386/x86-64-avx10_2-promote.d: Ditto.
	* testsuite/gas/i386/x86-64-avx10_2-promote.s: Ditto.

opcodes/Changelog:

	* i386-dis-evex-prefix.h: Adjust PREFIX_EVEX_0F3852.
	Add PREFIX_EVEX_0F3A42_W_0.
	* i386-dis-evex-w.h: Adjust EVEX_W_0F3A42.
	* i386-dis-evex.h: Add table pass for AVX10.2
	instructions.
	* i386-dis.c: Adjust PREFIX_VEX_0F3850_W_0, PREFIX_VEX_0F3851_W_0,
	PREFIX_VEX_0F38D2_W_0 and PREFIX_VEX_0F38D3_W_0.
	* i386-opc.tbl: Add AVX10.2 instructions.
	* i386-mnem.h: Regenerated.
	* i386-tbl.h: Ditto.

Co-authored-by: Lili Cui <lili.cui@intel.com>
2024-10-11 10:38:27 +08:00
Andreas Krebbel
a98a6fa2d8 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>
2024-10-10 12:09:40 +02:00
Andreas Schwab
3f30f11f6d m68k: Support for jump visualization in disassembly
opcodes/
	* m68k-dis.c (m68k_opcode_to_insn_type): Define.
	(match_insn_m68k): Call it to set insn_type.
	(print_insn_arg) [case 'B']: Set branch target address.
	(print_insn_m68k): Set insn_info_valid.
2024-10-07 21:26:04 +02:00
Jan Beulich
784e2ef54b RISC-V: correct alignment directive handling for text sections
.insn or data emitted inside text sections can lead to positions not
being at insn granularity. In such situations using alignment
directives should reliably enforce the requested alignment.
Specifically requests to align back to insn granularity may not be
ignored (where, as a subcase thereof, the ordering of ".option norvc"
and e.g. ".p2align 2" should not matter; so far the alignment directive
needs to come first to have any effect). Similarly ahead of emitting
NOPs alignment first needs to be forced back to insn granularity.

The new testcases actually point out a corner case issue in the
disassembler as well, which is being corrected at the same time: We
don't want to print "0x" without any subsequent digits.
2024-09-27 11:40:22 +02:00
Jan Beulich
ca6b6f9d6e x86: optimize {,V}INSERTPS with certain immediates
They are equivalent to simple moves or xors, which are up to 3 bytes
shorter to encode (and maybe/likely also cheaper to execute).
2024-09-27 11:23:12 +02:00
Jan Beulich
f079b0c4b2 x86: optimize {,V}EXTRACT{F,I}{128,32x{4,8},64x{2,4}} with immediate 0
They, too, are equivalent to simple moves, which are up to 3 bytes
shorter to encode (and maybe also cheaper to execute).
2024-09-27 11:22:34 +02:00
Jan Beulich
afd5b33bc7 x86: optimize {,V}EXTRACTPS with immediate 0
They are equivalent to simple moves, which are up to 2 bytes shorter to
encode (and maybe also cheaper to execute).
2024-09-27 11:21:51 +02:00
Jan Beulich
174e5e38b9 x86: templatize SIMD narrowing-move templates
Once again to reduce redundancy.
2024-09-26 12:27:14 +02:00
Jan Beulich
2bb43416f9 x86: templatize SIMD sign-/zero-extension templates
Yet again to reduce redundancy.
2024-09-26 12:27:01 +02:00
Jan Beulich
0c27c22320 x86: templatize SIMD FP binary-logic templates
Once more to reduce redundancy.
2024-09-26 12:26:34 +02:00
Jan Beulich
5d285de425 x86: further templatize FMA templates
Further reduce redundancy, in preparation of the addition of
counterparts for AVX10.2.
2024-09-26 12:26:15 +02:00