aboutsummaryrefslogtreecommitdiff
path: root/opcodes
AgeCommit message (Collapse)AuthorFilesLines
5 daysUpdated Spanish translations for opcodes and gasNick Clifton1-911/+1600
7 daysaarch64: 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
11 daysor1k: 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>
11 daysaarch64: 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
12 daysaarch64: Support for FEAT_LSFEEzra Sitorus5-580/+1102
FEAT_LSFE - Large System Float Extension - implements A64 base atomic floating-point in-memory instructions.
12 daysaarch64: 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.
12 daysaarch64: 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
12 daysaarch64: 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.
13 daysaarch64: 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>
2025-06-13x86: don't constrain %axl/%cxlJan Beulich2-4/+4
They can be used like their %al/%cl counterparts everywhere else; there's no apparent reason why they shouldn't be usable as accumulator / shift count respectively. Enforcing such a restriction only makes writing heavily macro-ized code more cumbersome.
2025-06-13x86: swap operands in OUT-with-immediate templateJan Beulich2-3/+5
In a number of places we assume that immediates come first in the set of operands. It is mere luck that so far OUT, having operands the other way around, wasn't negatively impacted by this. Leverage this to have a few loops start from the first non-immediate operand (or in one case to stop there). Note, however, that process_immext() inserts an immediate last, so especially all output_*() functions cannot be changed in the same way.
2025-06-13x86: refine UD<n> kind-of-insnsJan Beulich2-279/+306
While documentation of these continues to be lacking sufficient detail, it is becoming increasingly clear that in 66f1eba0b7e8 ("x86: correct UDn") I went too far with requiring operands, to populate a ModR/M byte. AMD hardware appears to always behave as indicated as "may" in PM 3.36, which for all practical purposes means there's no ModR/M byte. The SDM (rev 087) indicates that such behavior can occur on older hardware for UD0. Re-add an operand-less UD1 form (as well as its UD2B alias), while newly adding such a form also for UD0. Because of the ambiguity, there's no good/easy way of handling both possibilities in the disassembler, which hence remains unaltered. Further, from all information I'm able to gather, the 0F opcode space was only introduced with the i286; bump the minimal hardware requirement for all UD<n> accordingly.
2025-06-12aarch64: Add support for FEAT_FPRCVTRichard Ball7-3412/+3599
FEAT_FPRCVT introduces new versions of previous instructions. The instructions are used to convert between floating points and Integers. These new versions take as operands SIMD&FP registers for both the source and destination register. FEAT_FPRCVT also enables the use of some existing AdvSIMD instructions in streaming mode. However, no changes are needed in gas to support this.
2025-06-11aarch64: Add system registers for 2024 MPAM extensionYury Khrustalev1-0/+8
This patch adds support for new system registers introduced in the 2024 MPAM extension (Memory Partitioning and Monitoring): Available in Armv9.3-A: MPAMBW0_EL1, MPAMBW1_EL1, MPAMBW1_EL12, MPAMBW2_EL2, MPAMBW3_EL3, MPAMBWCAP_EL2, MPAMBWIDR_EL1 Available in Armv9.3-A with SME: MPAMBWSM_EL1 The details can be found in [1]. [1]: https://developer.arm.com/documentation/ddi0601/latest
2025-06-09aarch64: Fix typos in opcode headersYury Khrustalev1-2/+2
2025-06-04aarch64: Support id_aa64fpfr0_el1, id_aa64pfr2_el1Dmitry Chestnykh1-0/+2
2025-05-16x86: improve matching diagnostics when %st is involvedJan Beulich5-7422/+7424
Diagnosing operand size vs operand type mismatches doesn't work very well when GPRs and FPRs are in the same register class, distinguished just by size. Introduce a separate RegFP class.
2025-05-16RISC-V: Add zilsd & zclsd supportdysun1-0/+53
Ref: https://github.com/riscv/riscv-zilsd/blob/main/zilsd.adoc Signed-off-by: dysun <sundongya@nucleisys.com> Co-developed-by: LIU Xu <liuxu@nucleisys.com> Co-developed-by: ZHAO Fujin <zhaofujin@nucleisys.com>
2025-05-13aarch64: Replace incorrect commentAlice Carlotti1-7/+7
The comment explaining the placement of the cfinv entry before the generic msr entry in the opcode table was incorrect. The issue is unrelated to the all ones bitmask for cfinv, and is actually due the large number of architectural aliases of the msr instruction.
2025-05-12aarch64: Support for FEAT_RME_GPC3Ezra Sitorus1-0/+1
FEAT_RME_GPC3 - RME Granule Protection Check 3 Extension - introduces a method for defining a set of windows in the memory map for which Granule Protection Checks are skipped, and instead applies a set of default settings associated with the window. This patch introduces the sysreg gpcbw_el3. Add -march=armv9.5-a to access this sysreg since this feature is optional from armv9.5-a.
2025-05-12aarch64: Support for FEAT_OCCMOEzra Sitorus1-0/+4
FEAT_OCCMO - Outer Cacheable Cache Maintenance Operation - introduces system instructions that provides software with a mechanism to publish writes to the Outer cache level.
2025-05-09aarch64: Mark predicate-as-counter pseudo instructionsAlice Carlotti3-17/+33
Using explicit pseudo aliases is clearer and more consistent with other instruction aliases. This does not change behaviour. For the non-alias instructions (everything except mov) we already picked the first matching entry for disassembly by default. For mov we picked the last matching aliased entry, which remained the original alias since do_misc_decoding doesn't recognise OP_MOV_PN_PN.
2025-05-09aarch64: Mark clearbhb as a pseudo instructionAlice Carlotti1-1/+1
This was an early name for the clrbhb hint instruction. Some software was written with the old name before it was renamed, so we support it for assembly but should never use it in disassembly. This patch has no functional change, because we already pick (by default) the last matching alias in the opcode table, and clrbhb is listed later than clearbhb.
2025-05-09aarch64: Fix dgh disassemblyAlice Carlotti3-4/+5
2025-05-09aarch64: Mark SME mova aliasesAlice Carlotti3-60/+100
This will only change behaviour during disassembly with -M no-aliases.
2025-05-09aarch64: Mark rev64 as a pseudo instructionAlice Carlotti3-5/+5
This is more natural than raising the priority of rev with F_P1, and is functionally equivalent.
2025-05-09aarch64: Eliminate AARCH64_OPND_SVE_ADDR_RAlice Carlotti5-2304/+2252
Adjust parsing for AARCH64_OPND_SVE_ADDR_RR{_LSL*} operands to accept implicit XZR offsets. Add new AARCH64_OPND_SVE_ADDR_RM{_LSL*} operands to support instructions where an XZR offset is allowed but must be specified explicitly. This allows the removal of the duplicate opcode table entries using AARCH64_OPND_SVE_ADDR_R.
2025-05-09RISC-V: Added vendor extensions, xmipscbop, xmipscmov, xmipsexectl and xmipslspChao-ying Fu2-0/+48
Spec: https://mips.com/wp-content/uploads/2025/03/P8700-F_Programmers_Reference_Manual_Rev1.82_3-19-2025.pdf Added MIPS vendor extensions, xmipscbop, xmipscmov, xmipsexectl and xmipslsp with verison 1.0. Passed binutils testsuites of targets elf32/elf64/linux32/linux64. Signed-off-by: Jovan Dmitrović <jovan.dmitrovic@htecgroup.com> Signed-off-by: Chao-ying Fu <cfu@wavecomp.com>
2025-05-07s390: Fix format specifier for VR in disassemblerJens Remus1-1/+1
Vector register (VR) numbers are unsigned. Use format specifier %u instead of %i. Reported-by: Florian Krohm <flo2030@eich-krohm.de> Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2025-04-30RISC-V: Mark fgt.*/fge.* as instruction aliasKito Cheng1-8/+8
They are instruction alias, but not mark correctly, and seems like we don't have a good way to verify that since the disassembler doesn't disassemble instruction into alias. [1] https://github.com/riscv-non-isa/riscv-asm-manual/pull/124
2025-04-28Regenerate more configury files for 64-bit BFD detection fixMaciej W. Rozycki1-3/+0
The fix for 64-bit BFD detection omitted the regeneration of a bunch of configury files; fix that.
2025-04-28Fix 64-bit BFD detection causing build failuresMaciej W. Rozycki2-255/+34
We have a discrepancy with 64-bit BFD handling across our component subdirectories leading to link failures such as: ld: ../opcodes/.libs/libopcodes.a(disassemble.o): in function `disassembler': disassemble.c:(.text+0x65): undefined reference to `print_insn_alpha' ld: disassemble.c:(.text+0x105): undefined reference to `print_insn_ia64' ld: disassemble.c:(.text+0x11d): undefined reference to `print_insn_loongarch' ld: disassemble.c:(.text+0x1a1): undefined reference to `print_insn_big_mips' [...] with some configurations having a 32-bit host and 64-bit BFD, such as: `--host=i386-linux-gnu --target=riscv64-linux-gnu --enable-targets=all'. This is ultimately due to how 64-bit BFD is enabled for bfd/ itself and other subdirectorses and has been a regression from commit 1d5269c994bf ("unify 64-bit bfd checks"). For bfd/ the BFD_64_BIT autoconf macro from config/bfd64.m4 is used combined with this logic in bfd/configure.ac: case ${host64}-${target64}-${want64} in *true*) wordsize=64 bfd64_libs='$(BFD64_LIBS)' all_backends='$(BFD64_BACKENDS) $(BFD32_BACKENDS)' [...] ;; false-false-false) wordsize=32 all_backends='$(BFD32_BACKENDS)' ;; esac where the value of ${wordsize} switches between 32-bit and 64-bit BFD via these pieces: #define BFD_ARCH_SIZE @wordsize@ and: #if BFD_ARCH_SIZE >= 64 #define BFD64 #endif in bfd/bfd-in.h, which ultimately becomes a part of "bfd.h". Then ${host64} is determined in bfd/configure.ac from the host's word size, via the host's pointer size: if test "x${ac_cv_sizeof_void_p}" = "x8"; then host64=true fi And ${target64} is determined in bfd/configure.ac from the target's word size: if test ${target_size} = 64; then target64=true fi Where multiple targets have been requested with `--enable-targets=all' the presence of any 64-bit target will set "true" here. Finally ${want64} is set according to `--enable-64-bit-bfd' user option with an arrangement involving BFD_64_BIT: BFD_64_BIT if test $enable_64_bit_bfd = yes ; then want64=true else want64=false fi which also, redundantly, checks and sets its result upon the host's word size. Lastly ${want64} is also selectively set by target fragments in bfd/config.bfd, which mostly if not completely overlaps with ${target64} setting as described above. Conversely other subdirectories only rely on BFD_64_BIT, so they fail to notice that BFD is 64-bit and do not enable their 64-bit handling where the host requested is 32-bit and 64-bit BFD has been enabled other than with `--enable-64-bit-bfd'. One consequence is opcodes/disassemble.c enables calls to its numerous own 64-bit backends by checking the BFD64 macro from "bfd.h", however does not actually enable said backends in its Makefile. Hence the link errors quoted above. Address the problem then by moving the `--enable-64-bit-bfd' option back to bfd/configure.ac and remove the call to BFD_64_BIT from there and then rewrite the macro in terms of checking for the presence of BFD64 macro in "bfd.h", which is the canonical way of determining whether BFD is 64-bit or not. Rather than running `grep' directly on ../bfd/bfd-in3.h as the opcodes/ fragment used to before the problematic commit: if grep '#define BFD_ARCH_SIZE 64' ../bfd/bfd-in3.h > /dev/null; then run the preprocessor on "bfd.h", which allows to invoke the macro from configure.ac files placed in subdirectories located at deeper levels, by relying on the preprocessor's search path. This requires however that the invokers rely on `all-bfd' rather than `configure-bfd' for their `configure' invocation stage, because "bfd.h" is made by `make all' rather than `configure' in bfd/. Do not cache the result of this check however, as reconfiguring a tree such as to flip `--enable-64-bit-bfd' on or to change a secondary target may affect BFD64 and we have no access to information about secondary targets in BFD_64_BIT. Also remove the ENABLE_BFD_64_BIT automake conditional, as it's not used anywhere. Last but not least remove the hack from gdb/configure.ac to fail builds for `mips*-*-*' hosts where `--enable-targets=all' has been requested, but `--enable-64-bit-bfd' has not as it's no longer needed. Such builds complete successfully now, having enabled 64-bit BFD implicitly. Tested-By: Guinevere Larsen <guinevere@redhat.com> Tested-By: Luis Machado <luis.machado@arm.com> Approved-By: Alan Modra <amodra@gmail.com> Approved-By: Luis Machado <luis.machado@arm.com>
2025-04-28PowerPC: Support for Prefixed Add Immediate Shifted Instruction (RFC02686)Surya Kumari Jangala1-1/+66
opcodes/ * ppc-opc.c (insert_si32, extract_si32, insert_nsi32, extract_nsi32): New functions. (SI32, NSI32, P_D_SI32_MASK, P_DRAPCREL_SI32_MASK): New macros. (IMM32): Update for new macros. (powerpc_opcodes): Add plis, paddis, psubis. gas/ * testsuite/gas/ppc/future.s: New test. * testsuite/gas/ppc/future.d: Likewise.
2025-04-15RISC-V: Add missing disassembler option `max`Marek Pikuła1-1/+5
The flag already exists but it's not been exposed to user. Signed-off-by: Marek Pikuła <m.pikula@partner.samsung.com>
2025-04-14x86: move PadLock enumeratorsJan Beulich4-31/+31
... to be all in one group. This helps code generation for code like || is_cpu (&i.tm, CpuPadLock) || is_cpu (&i.tm, CpuPadLockRNG2) || is_cpu (&i.tm, CpuPadLockPHE2) || is_cpu (&i.tm, CpuPadLockXMODX) that we have (effectively) twice.
2025-04-13LoongArch: Support LA32R aliases rdcnt{vl,vh,id}.wWANG Xuerui1-0/+6
These LA32R instructions are in fact special cases of the LA32S/LA64 rdtime{l,h}.w (with only one output operand instead of two, the other one being forced to $zero), but are named differently in the LA32R ISA manual nevertheless. As the LA32R names are more memorable to a degree (especially for those having difficulties remembering which operand corresponds to the node ID), support them by making them aliases of the corresponding LA32S/LA64 instruction respectively, and make them render as such in disassembly. Signed-off-by: WANG Xuerui <git@xen0n.name>
2025-04-09s390: Add support for z17 as CPU nameJens Remus1-1/+2
So far IBM z17 was identified as arch15. Add the real name, as it has been announced. [1] [1]: IBM z17 announcement letter, AD25-0015, https://www.ibm.com/docs/en/announcements/z17-makes-more-possible gas/ * config/tc-s390.c (s390_parse_cpu): Add z17 as alternate CPU name for arch15. * doc/c-s390.texi: Likewise. * doc/as.texi: Likewise. opcodes/ * s390-mkopc.c (main): Add z17 as alternate CPU name for arch15. Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2025-03-29x86: Add {noimm8s} pseudo prefixH.J. Lu4-173/+185
Instruction templates with only sign-extended 8-bit immediate operand also have a second template with full-operand-size immediate operand under a different opcode. Add {noimm8s} pseudo prefix to exclude templates with only sign-extended 8-bit immediate operand. gas/ PR gas/32811 * config/tc-i386.c (pseudo_prefixes): Add no_imm8s. (operand_size_match): Return false for templates with only sign- extended 8-bit immediate operand if {noimm8s} is used. (parse_insn): Handle Prefix_NoImm8s. * doc/c-i386.texi: Document {noimm8s}. * testsuite/gas/i386/pseudos.s: Add tests for {noimm8s}. * testsuite/gas/i386/x86-64-pseudos.s: Likewise. * testsuite/gas/i386/pseudos.d: Updated. * testsuite/gas/i386/x86-64-pseudos.d: Likewise. opcodes/ PR gas/32811 * opcodes/i386-opc.h (Prefix_NoImm8s): New. * i386-opc.tbl: Add {noimm8s} pseudo prefix. * i386-mnem.h: Regenerated. * i386-tbl.h: Likewise. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-03-28RISC-V: Don't show support for 1.9.1 priv specMarek Pikuła1-3/+6
The privileged spec 1.9.1 support was removed since binutils 2.43. The linker only recognizes it and then reports a warning that it may conflict with other spec versions. While the support is removed, binutils should still recognize it, but it shouldn't be exposed to the user in `disassember-options` help. Signed-off-by: Marek Pikuła <m.pikula@partner.samsung.com>
2025-03-27x86: Remove AVX10.2 256 bit rounding supportHaochen Jiang3-93/+82
Since we will support 512 bit on both P-core and E-core for AVX10, 256 bit rounding is not that useful because we currently have rounding feature directly on E-core now and no need to use 256-bit rounding as somehow a workaround. This patch will remove all the support and backport to Binutils 2.44. gas/ChangeLog: * NEWS: Mention support removal. * config/tc-i386.c (build_evex_prefix): Remove U bit encode. (check_VecOperands): Remove ymm check for rounding. (s_insn): Revise .insn comment. * testsuite/gas/i386/avx10_2-256-cvt-intel.d: Remove ymm rounding related test. * testsuite/gas/i386/avx10_2-256-cvt.d: Ditto. * testsuite/gas/i386/avx10_2-256-cvt.s: Ditto. * testsuite/gas/i386/avx10_2-256-miscs-intel.d: Ditto. * testsuite/gas/i386/avx10_2-256-miscs.d: Ditto. * testsuite/gas/i386/avx10_2-256-miscs.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/evex.d: Ditto. * testsuite/gas/i386/evex.s: Ditto. * testsuite/gas/i386/i386.exp: 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-256-miscs-intel.d: Ditto. * testsuite/gas/i386/x86-64-avx10_2-256-miscs.d: Ditto. * testsuite/gas/i386/x86-64-avx10_2-256-miscs.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. * testsuite/gas/i386/x86-64-evex.d: Ditto. * testsuite/gas/i386/x86-64.exp: Ditto. * testsuite/gas/i386/avx10_2-rounding-intel.d: Removed. * testsuite/gas/i386/avx10_2-rounding-inval.l: Removed. * testsuite/gas/i386/avx10_2-rounding-inval.s: Removed. * testsuite/gas/i386/avx10_2-rounding.d: Removed. * testsuite/gas/i386/avx10_2-rounding.s: Removed. * testsuite/gas/i386/x86-64-avx10_2-rounding-intel.d: Removed. * testsuite/gas/i386/x86-64-avx10_2-rounding.d: Removed. * testsuite/gas/i386/x86-64-avx10_2-rounding.s: Removed. opcodes/ChangeLog: * i386-dis.c (struct instr_info): Remove U bit. (get_valid_dis386): Roll back to APX condition. * i386-opc.tbl: Remove ymm rounding support. * i386-tbl.h: Regenerated.
2025-03-26LoongArch: Fix disassembly option parsing stopping at the first optionWANG Xuerui1-1/+6
Turns out the return value of parse_loongarch_dis_option acts as an error code, and previously the function always signified failure with a non-zero return value, making only the first disassembly option get to take effect. Fix by adding the missing `return 0`'s to the two success code paths. Signed-off-by: WANG Xuerui <git@xen0n.name>
2025-03-26RISC-V: add Smrnmi 1.0 instruction supportJerry Zhang Jian1-0/+3
Add instruction `mnret' support Ref: https://github.com/riscv/riscv-isa-manual/blob/bb8b9127f81965eeff2d150c211d1c89376591c4/src/rnmi.adoc https://github.com/riscv/riscv-opcodes/blob/946eb673874b3a0f2474d1424dc28bc7ee53c306/extensions/rv_smrnmi bfd/ChangeLog: * elfxx-riscv.c: Add new Smrnmi instruction class handling gas/ChangeLog: * testsuite/gas/riscv/smrnmi.s: New test for mnret * testsuite/gas/riscv/rmrnmi.d: Likewise include/ChangeLog: * opcode/ricsv-opc.h: Add MATCH_MNRET, MASK_MNRET * opcode/riscv.h: Add new instruction class opcodes/ChangeLog: * riscv-opc.c: Add `mnret' instruction Signed-off-by: Jerry Zhang Jian <jerry.zhangjian@sifive.com>
2025-03-24aarch64: Add missing FEAT_MEC dc encodings and gate sysregsEzra Sitorus2-8/+10
FEAT_MEC support was introduced in [1]. However, the dc instruction was missing these encodings: - DC CIPAE - DC CIGDPAE Furthermore, the Arm ARM states that FEAT_MEC is an optional extension, introduced for v9.2-a. Therefore, these sysregs: - MECIDR_EL2 - MECID_P0_EL2 - MECID_A0_EL2 - MECID_P1_EL2 - MECID_A1_EL2 - VMECID_P_EL2 - VMECID_A_EL2 - MECID_RL_A_EL3 which were introduced in that commit now require -march=armv9.2-a at the very least to be enabled, as well as the dc encodings. opcodes/ChangeLog: * aarch64-opc.c (aarch64_sys_regs_dc): Add "cipae" and "cigdpae". * aarch64-sys-regs.def: Add V8_7A as a requirement for the above system registers. gas/testsuite/gas/ChangeLog * aarch64/mec-invalid.s: Add .arch directive. * aarch64/mec.d: Add .arch directive and check for cipae, cigdpae. * aarch64/mec.s: Add MEC data cache operations test. * aarch64/mec-arch-bad.d: New test to check for bad arch version. * aarch64/mec-arch-bad.l: Above. [1]: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=31f2faf5cf112931cfb8c0564a2b78477c907fe3 Regression tested on aarch64-none-elf
2025-03-18RISC-V: Add extension XTheadVdot for T-Head VECTOR vendor extension [1]Jin Ma1-0/+9
T-Head has a range of vendor-specific instructions. Therefore it makes sense to group them into smaller chunks in form of vendor extensions. This patch adds the additional extension "XTheadVdot" based on the "V" extension, and it provides four 8-bit multiply and add with 32-bit instructions for the "v" extension. The 'th' prefix and the "XTheadVector" extension are documented in a PR for the RISC-V toolchain conventions ([2]). Co-Authored-By: Lifang Xia <lifang_xia@linux.alibaba.com> [1] https://github.com/XUANTIE-RV/thead-extension-spec/tree/master/xtheadvdot [2] https://github.com/riscv-non-isa/riscv-toolchain-conventions/pull/19 bfd/ChangeLog: * elfxx-riscv.c (riscv_multi_subset_supports): Add support for "XTheadVdot" extension. (riscv_multi_subset_supports_ext): Likewise. gas/ChangeLog: * doc/c-riscv.texi: Likewise. * testsuite/gas/riscv/march-help.l: Likewise. * testsuite/gas/riscv/x-thead-vdot.d: New test. * testsuite/gas/riscv/x-thead-vdot.s: New test. include/ChangeLog: * opcode/riscv-opc.h (MATCH_TH_VMAQA_VV): New. * opcode/riscv.h (enum riscv_insn_class): Add insn class for XTheadVdot. opcodes/ChangeLog: * riscv-opc.c: Likewise.
2025-03-18RISC-V: Avoid parsing arch string repeatedly for dis-assemblerNelson Chu1-7/+21
Since we now always generate $x+isa for now, these would increase the dis-assemble time by parsing the same architecture string repeatedly. We already have `arch_str' field into `subset_list' to record the current architecture stirng, but it's only useful for assembler, since dis-assembler and linker don't need it before. Now for dis-assembler, we just need to update the `arch_str' after parsing the architecture stirng, and then avoid parsing repeatedly if the strings are the same.
2025-03-03RISC-V: Re-define mapping symbol $x to the file elf architecture attributeAndrew Oates1-6/+13
The mapping symbol "$x" without an ISA string "means using ISA configuration from ELF attribute."[1]. Currently the code does not reset the subset_list. This means that a previous mapping symbol that overrides the ISA string will continue to be used, rather than the default string set in the ELF file's .riscv.attributes section. This can cause incorrect or failed instruction decodings. In practice, this causes problems when disassembling code generated by LLVM, which (unlike gas) does not emit explicit mapping symbols at the start of each section. This change stores the default architecture string seen at the beginning of disassembly in the global parse data struct, and restores that to subset_list whenever a bare "$x" symbol is seen. [1] https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-elf.adoc#mapping-symbol Before this patch, the mapping-x.s was dumped as, 00000000 <.text>: 0: 00000013 nop 4: 0001 .insn 2, 0x0001 6: 0001 .insn 2, 0x0001 Which is caused by the definiation of $x was conflict with the psABI.
2025-02-26RISC-V: Fix abort when displaying data and partial instructionsCharlie Jenkins1-9/+17
If data is encountered that is not a power of two, dump all of the data with a .<N>byte directive. The current largest support risc-v instruction length is 22, so the data over 22 bytes will be displayed by, .insn, 22, ... + .<N-22>byte. Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
2025-02-22MIPS objdump: Recognize o64 ABI namesMaximilian Ciric1-0/+9
Add gpr and fpr names for the o64 ABI to objdump. With the recent addition of both EABIs, this completes support for the standard ABI options (ABI-breaking options such as -modd-spreg or -mabi=32 -mfp64 notwithstanding). The names have been verified against GCC's usage of the registers. Notably, the only(?) documentation that defines the o64 ABI at https://gcc.gnu.org/projects/mipso64-abi.html appears to contain a mistake w.r.t. floating-point arguments. In particular: > If the first and second arguments floating-point arguments to a > function are 32-bit values, they are passed in $f12 and $f14. As from 4.0.0 this does not happen in GCC's implementation of the ABI; a pair of single-float arguments are still passed in $f12 and $f13, the same as when one or both of the arguments are double-precision floats. The registers $f12, $f13 and $f14 have been named $fa0, $fa1 and $ft10 to match the implementation. Signed-off-by: Maximilian Ciric <max.ciric@gmail.com>
2025-02-16riscv disassembler leakAlan Modra1-1/+4
Commit 3f61a38b5e81 moved the disassembler subset_list from a static variable to disassembler private_data. It is now malloc'd in riscv_init_disasm_info so should be freed when disassemble_free_target runs. * riscv-dis.c (disassemble_free_riscv): Free subset_list.