aboutsummaryrefslogtreecommitdiff
path: root/opcodes
AgeCommit message (Collapse)AuthorFilesLines
2025-09-03csky disassembler leakAlan Modra1-0/+1
* csky-dis.c (parse_csky_dis_options): Free copy of options.
2025-09-02PowerPC: Vector Instructions for Deeply Compressed Weight for AI (RFC02691)Abhay Kandpal1-0/+22
opcodes/ * ppc-opc.c: (VXSEL5, VXSEL4, VXSEL3, VXSEL2, UIMM1): New defines. (powerpc_opcodes): <vucmprhn, vucmprln, vucmprhb, vucmprlb, vucmprhh, vucmprlh, vupkhsntob, vupklsntob, vupkint4tobf16, vupkint8tobf16, vupkint4tofp32, vupkint8tofp32>: New instructions. gas/ * gas/testsuite/gas/ppc/future.s: Add new testcases. * gas/testsuite/gas/ppc/future.d: Likewise.
2025-09-01aarch64: Fix -i option for aarch64-genacazuc1-1/+1
Only the long option --gen-idx was recognized to generate aarch64-tbl-2.h
2025-08-29x86: add "udb" opcode (permanent official #UD in 64-bit mode)H. Peter Anvin (Intel)4-2190/+2209
The opcode D6 has been officially reserved as a single-byte permanent undefined (#UD) opcode in 64-bit mode with the mnemonic UDB. This is already the behavior of all known 64-bit implementations; this is thus merely an official statement of forward compatibility and the assignment of a mnemonic. This will be documented in the next version of the Intel Software Developer's Manual; in the meantime I DO speak officially for Intel on this issue. The x86 Advisory Council has ratified this decision, and so it is expected to be honored across vendors, but I obviously cannot make any official statement on any other vendor's behalf. I am covered by the Intel-FSF copyright assignment for binutils. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-08-20RISC-V: PR33216, Fixed gcc testcases failed for commit 28520d7Nelson Chu1-9/+26
I made a stupid mistake in the commit 28520d7, allow to assemble slli/srli/srai with 0 immediate to hint c.slli/c.srli/c.srai. These hints will be regared as illegal instruction for gdb and qemu, so at least I got following gcc testcases failed, === g++: Unexpected fails for rv64gc lp64d medlow === FAIL: c-c++-common/torture/builtin-arith-overflow-17.c -O0 execution test FAIL: c-c++-common/torture/builtin-arith-overflow-6.c -O0 execution test FAIL: c-c++-common/torture/builtin-arith-overflow-p-17.c -O0 execution test FAIL: c-c++-common/torture/builtin-arith-overflow-p-6.c -O0 execution test === gfortran: Unexpected fails for rv64gc lp64d medlow === FAIL: gfortran.dg/leadz_trailz_2.f90 -O0 execution test === gcc: Unexpected fails for rv64gc lp64d medlow === FAIL: c-c++-common/torture/builtin-arith-overflow-17.c -O0 execution test FAIL: c-c++-common/torture/builtin-arith-overflow-6.c -O0 execution test FAIL: c-c++-common/torture/builtin-arith-overflow-p-17.c -O0 execution test FAIL: c-c++-common/torture/builtin-arith-overflow-p-6.c -O0 execution test So we should just allow c.slli/c.srli/c.srai with zero immediate as hints, but don't allow slli/srli/srai with zero immediate. gas/ PR 33216 * testsuite/gas/riscv/c-zero-imm.d: Only allow c.slli/c.srli/c.srai with zero immediate as hints, but don't allow slli/srli/srai with zero immediate. * testsuite/gas/riscv/c-zero-imm.s: Likewise. opcodes/ PR 33216 * riscv-opc.c (match_slli_as_c_slli): Added back. (match_srxi_as_c_srxi): Likewise. (riscv_opcodes): Only allow c.slli/c.srli/c.srai with zero immediate as hints, but don't allow slli/srli/srai with zero immediate.
2025-08-15x86/APX: drop AMX-TRANSPOSE promoted insnsJan Beulich4-34/+20
They were dropped from spec version 007.
2025-08-14RISC-V: PR33216, Allow c.slli, c.srai, c.srli with 0 immediate as a hintNelson Chu1-37/+12
The original patch, e6f372ba661bb0d8eec1e22a6dc1ad9937336e4d Since recently c.slli64, c.srai64, and c.srli64 have been removed from the riscv-isa-manual, c.slli, c.srli, and c.srai with 0 immediate are now listed as hints, https://github.com/riscv/riscv-isa-manual/pull/1942 and https://github.com/riscv/riscv-isa-manual/pull/2093 So allow c.slli, c.srli, and c.srai with 0 immediate as a hint. Also allow to assemble slli, srli and srai with 0 immediate to hint c.slli, c.srli and c.srai when rvc is enabled. The c.slli64, c.srai64, and c.srli64 should be kept as aliases, so dis-assembler should disassemble to c.slli, c.srli, and c.srai with 0 immediate. Passed rv32/64-elf/linux binutils testcases. gas/ PR 33216 * testsuite/gas/riscv/c-zero-imm.d: Updated since allow c.slli64, c.srai64, and c.srli64 with 0 immediate as a hint. * testsuite/gas/riscv/c-zero-imm.s: Likewise. * testsuite/gas/riscv/zca.d: Likewise. opcodes/ PR 33216 * riscv-opc.c (riscv_opcodes): Updated since allow c.slli64, c.srai64, and c.srli64 with 0 immediate as a hint.
2025-08-08opcodes/aarch64: shrink aarch64_ext_ldst_reglist()'s data[]Jan Beulich1-14/+14
The values are all pretty small; one is even a boolean. No point in wasting 32 bits for every one of the fields.
2025-08-08opcodes/aarch64: rename fields[]Jan Beulich4-16/+13
To be a fair global name space citizen, give it an aarch64_ prefix. In two cases, drop a variable that's used only once.
2025-08-07Update obsolete autoconf macrosPietro Monteiro1-3/+3
bfd/ * bfd.m4: Replace AC_TRY_COMPILE with AC_COMPILE_IFELSE. binutils/ * configure.ac: Replace AC_TRY_COMPILE with AC_COMPILE_IFELSE. gas/ * acinclude.m4: Replace AC_TRY_LINK with AC_LINK_IFELSE. Replace AC_TRY_COMPILE with AC_COMPILE_IFELSE. gprof/ * configure.ac: Replace AC_OUTPUT(file list) with AC_CONFIG_FILES([file list])\nAC_OUTPUT. libctf/ * configure.ac: Replace AC_TRY_LINK with AC_LINK_IFELSE. opcodes/ * configure.ac: Replace AC_TRY_COMPILE with AC_COMPILE_IFELSE.
2025-08-01opcodes/x86: make i386_mnem[] staticJan Beulich3-4/+4
With the tables no longer being part of libopcodes (but rather being compiled directly into gas), this table doesn't need exposing anymore. The declaration cannot be avoided, though, as the first use of the array sits ahead of its definition (in i386-tbl.h).
2025-08-01opcodes/riscv: make riscv_options[] constJan Beulich1-1/+1
There's no reason to allow the array to be modifiable. In fact the compiler is able to infer this, placing the array in .data.rel.ro, but let's make it explicit.
2025-08-01opcodes/ppc: make ppc_opts[] static constJan Beulich1-1/+1
There's no reason to allow the array to be modifiable, nor for it to be globally visible.
2025-08-01opcodes/aarch64: convert print_sme_za_list()'s zan[] / zan_v[]Jan Beulich1-17/+30
Merge them into a single array of struct type. There's further no reason to have the compiler materialize such objects on the stack. And there's also no reason to allow the array(s) to be modifiable. Finally, given how short the strings are, there's little point using more space to store pointers to them (on 64-bit hosts; the situation is a little better on 32-bit ones). While there also correct indentation in adjacent code, and avoid open- coding ARRAY_SIZE().
2025-08-01opcodes/aarch64: make aarch64_opnd_qualifiers[] static constJan Beulich1-1/+1
There's no reason to allow the array to be modifiable, nor for it to be globally visible.
2025-08-01opcodes/aarch64: make aarch64_ext_ldst_reglist()'s data[] static constJan Beulich1-1/+1
There's no reason to have the compiler materialize such an object onto the stack. And there's also no reason to allow the array to be modifiable.
2025-07-26PR 33214 sparc LDM/STM/LDMA/STMA etc. FAIL on Solaris/SPARCAlan Modra1-34/+6
Delete code in compare_opcodes preferencing 1+i over i+1 and 1,i over i,1. Instead simply make the sort stable, by keeping the original table order.
2025-07-21aarch64: Use an enum to refer to indices in the opcode tableRichard Earnshaw7-11646/+13651
The indices into the auto-generated tables for opcodes are relatively unstable. Adding a new opcode can permute the code significantly. But most of this churn is down to changes in the index values. To minimize this use enumerated constants. While the index values change, the enumeration names will need to do so far less often, so most of the changes in the generated code become localized to the addition (occasionally removal) of opcodes. This change also makes the state-change comments unnecessary. The enumeration names contain the same information (and more), so these are simply deleted. The enumeration values are placed in a new header file, aarch64-tbl-2.h, so aarch64-gen gains a new option to build this header and the Makefile rules are adjusted accordingly.
2025-07-21aarch64: use an enumeration for operand indices.Richard Earnshaw3-675/+675
The generated aarch64 operand tables use index values into an array. But if the table of operands is modified by inserting a new operand into the middle of the table, *all* the index values can change, leading to a lot of churn in the generated output. include/opcode/aarch64.h already provides an enumeration for the operands, so make use of that instead of printing out the raw index values.
2025-07-21aarch64: Fix operand name MOPS_WB_Rd -> MOPS_WB_RnRichard Earnshaw2-2/+2
This field was misnamed in aarch64_opcode_table. It previously didn't matter too much as the name field only appeared in dumps. But it doesn't match the enum in include/opcode/aarch64.h and we will shortly start to rely on that.
2025-07-21aarch64: minor code cleanups to aarch64-gen.cRichard Earnshaw4-36/+42
Fix some overly-long lines.
2025-07-16x86: Decouple AMX-AVX512 from AVX10.2 and imply AVX512FHaochen Jiang2-18/+18
In ISE058, the AVX10.2 imply is removed from AMX-AVX512. This leads to re-consideration on the imply for AMX-AVX512. Since it is using zmm register and using zmm register only, we need to at least imply AVX512F. AVX512VL is not needed since it is not using xmm/ymms. On the other hand, if we imply AVX10.1 for AMX-AVX512, disabling avx10.1 will lead to disabling AMX-AVX512. This would be a surprise for users. Based on the two reasons above, the patch is decoupling AMX-AVX512 from AVX10.2 and imply AVX512F. opcodes/ChangeLog: * i386-gen.c: Imply AVX512F instead of AVX10.2. * i386-init.h: Regenerated.
2025-07-15Updated translations for various sub-directoriesNick Clifton2-337/+354
2025-07-14Updated Ukranian translation for the opcodes sub-directoryNick Clifton1-169/+177
2025-07-14Delete AM_PO_SUBDIRS invocationAlan Modra1-1/+0
These aren't needed since commit 862776f26a59.
2025-07-13Update version number on mainlineNick Clifton2-176/+184
2025-07-13Add markers for 2.45 branchNick Clifton1-0/+4
2025-07-12aarch64: Add missing F_STRICT flagsAlice Carlotti1-15/+13
By default, NIL qualifiers are treated as matching any qualifier when checking operand constraints. For many SVE instructions, this would allow operands with missing type suffixes to be assembled as if they had any explicit type specified. To prevent this, the F_STRICT flag is used to specify that NIL qualifiers should match only NIL qualifiers. Unfortunately, several SVE instructions incorrectly omitted this F_STRICT flag. The bug has existed in the *MATMUL_SVE* macros since they were added in 2019. The macro LUT_SVE2_INSN was added last year, and the other incorrect macros are new in this release. LUTv2_SME2_INSN and LUTv2_SME2p1_INSN were not actually broken, because we reject untyped vector lists already during parsing. However, I have added the F_STRICT flag here anyway, since this is more consistent and would be more robust if those operands start accepting untyped vector lists in the future. The new luti4 tests are the only ones that were already rejected before this change. BFLOAT16_SVE_INSN has been unused since it was originally added, so I just deleted the macro. The SVE LUT instructions were using the lut instruction class, which has special handling only for SIMD operands, and isn't recognised by aarch64_decode_variant_using_iclass (which sets the qualifiers during decode for most SVE instructions). To prevent these instructions failing to disassemble, I changed their instruction class to sve_misc.
2025-07-12aarch64: Remove redundant feature requirementsAlice Carlotti1-24/+24
Many instructions explicitly specified SVE/SVE2/SME/SME2 as a required feature when it was already implied by another required feature (at least while the SME->SVE2 implication is retained internally). These redundant features were used to determine both the valid symbol names for immediate operands, and the choice of error message for invalid movprfx sequences. Those two scenarios no longer use architecture features, so the redundant features are now truly redundant.
2025-07-12aarch64: Use operand class to select movprfx errorAlice Carlotti2-10/+16
Previously the choice of error message for an invalid movprfx sequence used the architecture requirements to determine whether an instruction was an SVE instruction or not. This meant specifying SVE or SVE2 as an explicit architecture requirement for all SVE instructions, even when this was already implied by another feature. As more architecture features are added and with the partial removal of the SME->SVE2 dependency, these extra feature requirements were getting messier and easier to forget. Instead, we now look at the operand types. If there is an SVE_REG, SVE_REGLIST or PRED_REG operand, then we treat the instruction as an SVE instruction. This does change behaviour slightly, but it only affects the choice of error message and the new choice should be a bit more consistent. There is one testsuite update required, because Ezra's SVE_AES2 patch temporarily broke classification of FEAT_SVE_AES instructions. This patch restores the original behaviour.
2025-07-12aarch64: Refactor exclusion of reg names in immediatesAlice Carlotti1-22/+22
When parsing immediate values, register names should not be misinterpreted as symbols. However, for backwards compatibility we need to permit some newer register names within older instructions. The current mechanism for doing so depends on the list of explicit architecture requirements for the instructions, which is fragile and easy to forget, and grows increasingly messy as more architecture features are added. This patch add explicit flags to each opcode to indicate which set of register names is disallowed in each instance. These flags are mandatory for all opcodes with immediate operands, which ensures that the choice of disallowed names will always be deliberate and explicit. This patch should have no functional change.
2025-07-12aarch64: Remove redundant ORs with 0Alice Carlotti1-2/+2
2025-07-11aarch64: Support for FEAT_SVE_AES2Ezra Sitorus5-1495/+1633
FEAT_SVE_AES2 implements the SVE multi-vector Advanced Encryption Standard and 128-bit destination element polynomial multiply long instructions, when the PE is not in Streaming SVE mode.
2025-07-11aarch64: Support for FEAT_LSUIEzra Sitorus4-3077/+3570
FEAT_LSUI introduces unprivileged variants of load and store instructions so that clearing PSTATE.PAN is never required in privileged software.
2025-07-11aarch64: Support for FEAT_PCDPHINTEzra Sitorus5-2872/+2887
FEAT_PCDPHINT - Producer-consumer data placement hints - is an optional ISA extension that provides hint instructions to indicate: - a store in the current execution thread is generating data at a specific location, which a thread of execution on one or more other observers is waiting on. - the thread of execution on the current PE will read a location that may not yet have been written with the value to be consumed. This extension introduces: - STSHH, a hint instruction, with operands (policies) keep and strm - PRFM *IR*, a new prefetch memory operand.
2025-07-11AM_PO_SUBDIRSAlan Modra2-391/+1
Swap AM_PO_SUBDIRS and ZW_GNU_GETTEXT_SISTER_DIR lines in */configure.ac. ZW_GNU_GETTEXT_SISTER_DIR indirectly invokes AC_REQUIRE(AM_PO_SUBDIRS) so results in AM_PO_SUBDIRS being emitted before ZW_GNU_GETTEXT_SISTER_DIR if it hasn't already been invoked.
2025-07-10RISC-V: Clarify the imply rule of cNelson Chu1-147/+147
This also fix the imply result for .option rvc. Imply zcf when c and f and rv32 Imply zcd when c and d Imply zca when c Changed INSN_CLASS_C to INSN_CLASS_ZCA Changed INSN_CLASS_F_AND_C to INSN_CLASS_ZCF Changed INSN_CLASS_D_AND_C to INSN_CLASS_ZCD Changed INSN_CLASS_ZIHINTNTL_AND_C to INSN_CLASS_ZIHINTNTL_AND_ZCA
2025-07-09z8k opcode_entry_typeAlan Modra2-2/+2
z8k opcode_entry_type.func is never used as a function pointer, only as a pointer to a pseudo_typeS. Change it to a void*.
2025-07-08aarch64: Add support for FEAT_SVE2p2 and FEAT_SME2p2Alice Carlotti6-581/+1747
2025-07-08RISC-V: Fixed dis-assembler to set correct xlen from mapping symbolNelson Chu1-3/+5
2025-06-26Updated Spanish translations for opcodes and gasNick Clifton1-911/+1600
2025-06-25aarch64: Add supports for FEAT_PoPS feature and DC instructions.Srinath Parvathaneni1-0/+2
This patch add support for FEAT_PoPS feature which can be enabled through +pops command line flag. This patch also adds support for following DC instructions and the spec can be found here [1]. 1. "dc cigdvaps" enabled on passing +memtag+pops command line flags. 2. "dc civaps" enabled on passing +pops command line flag. [1]: https://developer.arm.com/documentation/ddi0601/2025-03/AArch64-Instructions?lang=en
2025-06-21or1k: Fix disassembly for little-endian binariesStafford Horne1-1/+1
There are some OpenRISC CPUs that have their binaries stored in little-endian format. Using objdump to disassemble these is problematic, as some instructions fail to disassemble, for example: objdump -D -b binary -EB -m or1k test_be.bin 0: 18 60 07 27 l.movhi r3,0x727 4: a8 63 0e 00 l.ori r3,r3,0xe00 8: 9c 63 ff ff l.addi r3,r3,-1 c: bc 43 00 00 l.sfgtui r3,0 10: 13 ff ff fe l.bf 0x8 14: 44 00 48 00 l.jr r9 objdump -D -b binary -EL -m or1k test_le.bin 0: 27 07 60 18 *unknown* 4: 00 0e 63 a8 l.ori r3,r3,0xe00 8: ff ff 63 9c *unknown* c: 00 00 43 bc l.sfgtui r3,0 10: fe ff ff 13 *unknown* 14: 00 48 00 44 l.jr r9 It was found that the hash function was using the still little-endian buffer to extract the opcode used for the hash lookup. This didn't work as it was pulling the wrong hashcode causing instruction lookup to fail. Fix the hash function by using the normalized/byte-swapped value instead of the buffer. Signed-off-by: Stafford Horne <shorne@gmail.com>
2025-06-20aarch64: Support 2024 Debug Architecture system registers.Srinath Parvathaneni1-0/+8
This patch adds support for following system registers and the spec can be found here[1]. 1. PMBSR_EL12, PMBSR_EL2, PMBSR_EL3, PMBMAR_EL1 depends on FEAT_SPE and Armv9.5-A architecture and these are enabled by passing -march=armv9.5-a+profile. 2. TRBSR_EL12, TRBSR_EL2, and TRBSR_EL3 depends Armv9.5-A architecture and these are enabled by passing -march=armv9.5-a. 3. HFGITR2_EL2 depends on Armv8.8-A architecture and enabled by passing -march=armv8.8-a. [1]: https://developer.arm.com/documentation/ddi0601/2025-03/AArch64-Registers?lang=en
2025-06-19aarch64: Support for FEAT_LSFEEzra Sitorus5-580/+1102
FEAT_LSFE - Large System Float Extension - implements A64 base atomic floating-point in-memory instructions.
2025-06-19aarch64: Support for FEAT_SVE_F16F32MM, FEAT_F8F16M, FEAT_F8F32MMEzra Sitorus3-537/+626
FEAT_SVE_F16F32MM introduces the SVE half-precision floating-point matrix multiply-accumulate to single-precision instruction. FEAT_F8F32MM introduces the Advanced SIMD 8-bit floating-point matrix multiply-accumulate to single-precision instruction. FEAT_F8F16MM introduces the Advanced SIMD 8-bit floating-point matrix multiply-accumulate to half-precision instruction.
2025-06-19aarch64: Support for FEAT_CMPBREzra Sitorus6-3929/+4368
FEAT_CMPBR - Compare and branch instructions. This patch adds these instructions: - CB<CC> (register) - CB<CC> (immediate) - CBH<CC> - CBB<CC> where CC is one of the following: - EQ - NE - GT - GE - LT - LE - HI - HS - LO - LS
2025-06-19aarch64: Add occmo flag for FEAT_OCCMOEzra Sitorus1-4/+4
FEAT_OCCMO support was introduced, but the feature flags were missing. This patch adds these flags, as well as splitting up the tests to test occmo vs occmo+memtag operands.
2025-06-19aarch64: Support for FEAT_SVE_BFSCALEEzra Sitorus5-725/+807
FEAT_SVE_BFSCALE introduces the SVE BFSCALE instruction, when the PE is not in Streaming SVE mode. If FEAT_SME2 is implemented, FEAT_SVE_BFSCALE also introduces SME multi-vector Z-targeting BFloat16 scaling instructions, BFSCALE and BFMUL.
2025-06-14or1k: Add support for numcores and coreid sprsStafford Horne2-273/+276
These are needed when running GCC tests for newlib toolchains built with multicore support. Without these SPRs we get the following warnings when running tests. spawn or1k-elf-run ./20000112-1.exe^M WARNING: l.mfspr with invalid SPR address 0x80^M WARNING: l.mfspr with invalid SPR address 0x81^M WARNING: l.mfspr with invalid SPR address 0x81^M WARNING: l.mfspr with invalid SPR address 0x81^M Support is added by defining the SPRs in the cgen machine definition and regenerating the machine code. In or1k/or1k.c we initialize NUMCORES to 1 and COREID to 0 as the sim has only one CPU. In or1k/traps.c we allow returning the NUMCORES and COREID spr values in the mfspr function. Signed-off-by: Stafford Horne <shorne@gmail.com>