aboutsummaryrefslogtreecommitdiff
path: root/opcodes
AgeCommit message (Collapse)AuthorFilesLines
2024-08-06RISC-V: map zext.h to pack/packw if Zbkb is enabledHau Hsu1-2/+2
The `zext.h` is zero-extend halfword instruction that belongs to Zbb. Currently `zext.h` falls back to 2 shifts if Zbb is not enabled. However, the encoding and operation is a special case of `pack/packw rd, rs1, rs2`, which belongs to Zbkb. The instructions pack the low halves of rs1 and rs2 into rd. When rs2 is zero (x0), they behave like zero-extend instruction, and the encoding are exactly the same as zext.h. Thus we can map `zext.h` to `pack` or `packw` (rv64) if Zbkb is enabled, instead of 2 shifts. This reduces one instruction. This patch does this by making `zext.h` also available for Zbkb. opcodes/ * riscv-opc.c (riscv_opcodes): Update `zext.h` entries to use `ZBB_OR_ZBKB` instruction class. gas/ * testsuite/gas/riscv/zext-to-pack.s: Add test for mapping zext to pack/packw encoding. * testsuite/gas/riscv/zext-to-pack-encoding.d: Likewise. * testsuite/gas/riscv/zext-to-packw-encoding.d: Likewise.
2024-08-06RISC-V: Add support for XCvBitmanip extension in CV32E40PMary Bennett2-0/+27
Spec: https://docs.openhwgroup.org/projects/cv32e40p-user-manual/en/latest/instruction_set_extensions.html Contributors: Mary Bennett <mary.bennett682@gmail.com> Nandni Jamnadas <nandni.jamnadas@embecosm.com> Pietra Ferreira <pietra.ferreira@embecosm.com> Charlie Keaney Jessica Mills Craig Blackmore <craig.blackmore@embecosm.com> Simon Cook <simon.cook@embecosm.com> Jeremy Bennett <jeremy.bennett@embecosm.com> Helene Chelin <helene.chelin@embecosm.com> bfd/ChangeLog: * elfxx-riscv.c (riscv_multi_subset_supports): Add `xcvbitmanip` instruction class. (riscv_multi_subset_supports_ext): Likewise. gas/ChangeLog: * config/tc-riscv.c (validate_riscv_insn): Add custom operands `Xc6` and `Xc7`. (riscv_ip): Likewise. * doc/c-riscv.texi: Note XCVbitmanip as an additional ISA extension for CORE-V. * testsuite/gas/riscv/march-help.l: Add xcvbitmanip. * testsuite/gas/riscv/x-cv-bitmanip-fail.d: New Test. * testsuite/gas/riscv/x-cv-bitmanip-fail.l: New Test. * testsuite/gas/riscv/x-cv-bitmanip-fail.s: New Test. * testsuite/gas/riscv/x-cv-bitmanip.d: New Test. * testsuite/gas/riscv/x-cv-bitmanip.s: New Test. include/opcode/ChangeLog: * riscv-opc.h: Add corresponding MATCH and MASK macros for XCVbitmanip. * riscv.h: Add corresponding EXTRACT and ENCODE macros for XCVbitmanip. (enum riscv_insn_class): Add the XCVbitmanip instruction class. opcodes/ChangeLog: * riscv-dis.c (print_insn_args): Add custom operands `Xc6` and `Xc7`. * riscv-opc.c: Add XCvBitmanip instructions.
2024-08-06RISC-V: Add support for Zcmop extensionXiao Zeng1-0/+10
This implements the Zcmop (Compressed Zimop) extension, as of version 1.0. View detailed information in: <https://github.com/riscv/riscv-isa-manual/blob/main/src/zimop.adoc> The Zcmop extension requires the Zca extension. bfd/ChangeLog: * elfxx-riscv.c (riscv_multi_subset_supports): Handle Zcmop. (riscv_multi_subset_supports_ext): Ditto. gas/ChangeLog: * NEWS: Updated. * testsuite/gas/riscv/march-help.l: Ditto. * testsuite/gas/riscv/zcmop.d: New test. * testsuite/gas/riscv/zcmop.s: New test. include/ChangeLog: * opcode/riscv-opc.h (DECLARE_INSN): New declarations for Zcmop. (MATCH_C_MOP_1, MATCH_C_MOP_3, MATCH_C_MOP_5, MATCH_C_MOP_7, MATCH_C_MOP_9, MATCH_C_MOP_11, MATCH_C_MOP_13, MATCH_C_MOP_15): Define. (MASK_C_MOP_1, MASK_C_MOP_3, MASK_C_MOP_5, MASK_C_MOP_7, MASK_C_MOP_9, MASK_C_MOP_11, MASK_C_MOP_13, MASK_C_MOP_15): Ditto. * opcode/riscv.h (enum riscv_insn_class): Add INSN_CLASS_ZCMOP. opcodes/ChangeLog: * riscv-opc.c: Add Zcmop instructions.
2024-08-06RISC-V: Add support for Zimop extensionXiao Zeng1-0/+42
This implements the Zimop (May-Be-Operations) extension, as of version 1.0. View detailed information in: <https://github.com/riscv/riscv-isa-manual/blob/main/src/zimop.adoc> bfd/ChangeLog: * elfxx-riscv.c (riscv_multi_subset_supports): Handle Zimop (riscv_multi_subset_supports_ext): Ditto. gas/ChangeLog: * NEWS: Updated. * testsuite/gas/riscv/march-help.l: Ditto. * testsuite/gas/riscv/zimop.d: New test. * testsuite/gas/riscv/zimop.s: New test. include/ChangeLog: * opcode/riscv-opc.h (DECLARE_INSN): New declarations for Zimop. (MATCH_MOP_R_0, MATCH_MOP_R_1, MATCH_MOP_R_2, MATCH_MOP_R_3, MATCH_MOP_R_4, MATCH_MOP_R_5, MATCH_MOP_R_6, MATCH_MOP_R_7, MATCH_MOP_R_8, MATCH_MOP_R_9, MATCH_MOP_R_10, MATCH_MOP_R_11, MATCH_MOP_R_12, MATCH_MOP_R_13, MATCH_MOP_R_14, MATCH_MOP_R_15, MATCH_MOP_R_16, MATCH_MOP_R_17, MATCH_MOP_R_18, MATCH_MOP_R_19, MATCH_MOP_R_20, MATCH_MOP_R_21, MATCH_MOP_R_22, MATCH_MOP_R_23, MATCH_MOP_R_24, MATCH_MOP_R_25, MATCH_MOP_R_26, MATCH_MOP_R_27, MATCH_MOP_R_28, MATCH_MOP_R_29, MATCH_MOP_R_30, MATCH_MOP_R_31, MATCH_MOP_RR_0, MATCH_MOP_RR_1, MATCH_MOP_RR_2, MATCH_MOP_RR_3, MATCH_MOP_RR_4, MATCH_MOP_RR_5, MATCH_MOP_RR_6, MATCH_MOP_RR_7): Define. (MASK_MOP_R_0, MASK_MOP_R_1, MASK_MOP_R_2, MASK_MOP_R_3, MASK_MOP_R_4, MASK_MOP_R_5, MASK_MOP_R_6, MASK_MOP_R_7, MASK_MOP_R_8, MASK_MOP_R_9, MASK_MOP_R_10, MASK_MOP_R_11, MASK_MOP_R_12, MASK_MOP_R_13, MASK_MOP_R_14, MASK_MOP_R_15, MASK_MOP_R_16, MASK_MOP_R_17, MASK_MOP_R_18, MASK_MOP_R_19, MASK_MOP_R_20, MASK_MOP_R_21, MASK_MOP_R_22, MASK_MOP_R_23, MASK_MOP_R_24, MASK_MOP_R_25, MASK_MOP_R_26, MASK_MOP_R_27, MASK_MOP_R_28, MASK_MOP_R_29, MASK_MOP_R_30, MASK_MOP_R_31, MASK_MOP_RR_0, MASK_MOP_RR_1, MASK_MOP_RR_2, MASK_MOP_RR_3, MASK_MOP_RR_4, MASK_MOP_RR_5, MASK_MOP_RR_6, MASK_MOP_RR_7): Ditto. * opcode/riscv.h (enum riscv_insn_class): Add INSN_CLASS_ZIMOP. opcodes/ChangeLog: * riscv-opc.c: Add Zimop instructions.
2024-07-29Updated translations for the bfd, binutils, gas, ld and opcodes directoriesNick Clifton3-557/+573
2024-07-26microMIPS: Add MT ASE instruction set supportYunQiang Su2-1/+61
Add the MT ASE instruction operand types and encodings to the microMIPS opcode table and enable the assembly of these instructions in GAS from MIPSr2 onwards. Update the binutils and GAS testsuites accordingly. References: "MIPS Architecture for Programmers, Volume IV-f: The MIPS MT Module for the microMIPS32 Architecture", MIPS Technologies, Inc., Document Number: MD00768, Revision 1.12, July 16, 2013 Co-Authored-By: Maciej W. Rozycki <macro@redhat.com>
2024-07-26x86/APX: optimize certain {nf}-form insns to BMI2 onesJan Beulich2-27/+27
..., as those leave EFLAGS untouched anyway. That's a shorter encoding, available as long as no eGPR is in use anywhere.
2024-07-26ARM print_insn_mve assertionAlan Modra1-17/+2
This corrects objdump -d -m armv8.1-m.main output for a testcase found by oss-fuzz, .inst 0xee2fee79, which hits an assertion. Obviously the switch case constants should be binary, not hex. Correcting that is enough to cure this assertion, but I don't see any point in singling out the invalid case 0b10. In fact, it is just plain wrong to print "undefined instruction: size equals zero undefined instruction: size equals two". I also don't see the need for defensive programming here as is done elsewhere in checking that "value" is in range before indexing mve_vec_sizename. There is exactly one MVE_VSHLL_T2 entry in mve_opcodes. It is easy to verify that "value" is only two bits.
2024-07-24opcodes/x86: fix minor missed styling caseAndrew Burgess1-2/+2
I noticed that the x86 instruction: sar $1,%rsi would fail to style the '$0x1' as an immediate. This commit fixes that case.
2024-07-20Change version to 2.43.50Nick Clifton2-193/+195
2024-07-20Add markers for 2.43 branch/releaseNick Clifton1-0/+4
2024-07-19MIPS/opcodes: Replace "y" microMIPS operand code with "x"Maciej W. Rozycki1-2/+2
Replace the "y" microMIPS operand code, used with ALNV.PS only, with "x" so as to make "y" available for microMIPS MT use.
2024-07-19MIPS/opcodes: Mark MT thread context move assembly idioms as aliasesMaciej W. Rozycki1-38/+38
A number of instructions in the regular MIPS opcode table are assembly idioms for the MT thread context move MFTR and MTTR instructions, so mark them as aliases accordingly. Add suitable test cases, which also cover the PAUSE assembly idiom.
2024-07-19MIPS/opcodes: Mark PAUSE as an aliasMaciej W. Rozycki1-1/+1
PAUSE is an assembly idiom for 'sll $0,$0,5', so mark it as an alias in the regular MIPS opcode table, matching the microMIPS opcode table. A test case will be supplied separately.
2024-07-19MIPS/opcodes: Reorder coprocessor moves alphabeticallyMaciej W. Rozycki2-58/+62
A number of coprocessor move encodings have been randomly sprinkled over the regular MIPS and microMIPS opcode tables rather than where they'd be expected following the alphabetic order. Fix the ordering, taking into account precedence where it has to be observed for correct disassembly. No functional change.
2024-07-19MIPS/opcodes: Make AL a shorthand for INSN2_ALIASMaciej W. Rozycki2-56/+60
Make AL a shorthand for INSN2_ALIAS with the regular MIPS and microMIPS opcode tables, just as with the MIPS16 opcode table, and use it throughout. No functional change.
2024-07-19MIPS/opcodes: Rename the AL membership shorthand to ALXMaciej W. Rozycki1-88/+88
Make room for AL as a shorthand for INSN2_ALIAS with the regular MIPS opcode table, just as with the MIPS16 opcode table. No functional change.
2024-07-19MIPS/opcodes: Remove the regular MIPS "+t" operand codeYunQiang Su1-2/+1
The semantics of the regular MIPS "+t" operand code is exactly the same as that of the "E" operand code, so replace the former with the latter in the single MFTC0 instruction with implicit 'sel' == 0 encoding where it's used, matching the encoding with explicit 'sel' as well as other instructions.
2024-07-19MIPS/opcodes: Output thread context registers numerically with MFTR/MTTRMaciej W. Rozycki1-2/+2
We print MFTR and MTTR instructions' thread context register operand in disassembly using the ABI name the register number would correspond to should the targeted register be a general-purpose register. However in most cases it is wrong, because general-purpose registers are only referred when the 'u' and 'sel' operands are 1 and 0 respectively. And even in these cases the MFGPR and MTGPR aliases take precedence over the corresponding generic instruction encodings, so you won't see the valid case to normally trigger. Conversely decoding the thread context register operand numerically is always valid, so switch to using it. Adjust test coverage accordingly.
2024-07-19MIPS/opcodes: Exclude $0 from "-x" R6 operand typeMaciej W. Rozycki1-1/+1
The "-x" operand type is used for the reverse encoding of the BOVC and BNVC instructions, where 'rs' and 'rt' have been supplied as the second and the first operand respectively rather than the order the instruction expects. In this case we require the register associated with the "-x" operand to have a higher number than the register associated with the preceding "t" operand, which precludes the use of $0. The case where 'rs' and 'rt' both refer to the same register is handled by the straight encoding of the BOVC and BNVC instructions, which come in the opcode table ahead of the corresponding reverse encoding. Therefore clear the ZERO_OK flag for the "-x" operand. No need for an extra test case as the encodings involved are already covered by "r6" and its associated GAS tests.
2024-07-18opcodes: aarch64: enforce checks on subclass flags in aarch64-gen.cIndu Bhagat1-0/+19
Enforce some checks on the newly added subclass flags: - If a subclass is set of one insn of an iclass, every insn of that iclass must have non-zero subclass field. - For all other iclasses, the subclass bits are zero for all insns. include/ * opcode/aarch64.h (enum aarch64_insn_class): Identify the maximum iclass enum value. opcodes/ * aarch64-gen.c (iclass_has_subclasses_p): New array of bool. (read_table): Enforce checks on subclass flags.
2024-07-18opcodes: aarch64: denote subclasses for insns of iclass dp_2srcIndu Bhagat1-24/+24
For detecting irg, add a subclass to identify it in the set of instructions of iclass dp_2src. opcodes/ * aarch64-tbl.h: Add subclass flag F_DP_TAG_ONLY for irg insn.
2024-07-18opcodes: aarch64: add flags to denote subclasses of uncond branchesIndu Bhagat1-19/+19
Use the two new subclass flags: F_BRANCH_CALL, F_BRANCH_RET, to indicate call to and return from subroutine respectively. opcodes/ * aarch64-tbl.h: Use the new F_BRANCH_* flags.
2024-07-18opcodes: aarch64: add flags to denote subclasses of arithmetic insnsIndu Bhagat1-15/+15
Use the three new subclass flags: F_ARITH_ADD, F_ARITH_SUB, F_ARITH_MOV, to indicate add, sub and mov ops respectively. These flags for subclasses will later be used for SCFI purposes to create appropriate ginsns. At this time, only those iclasses relevant to SCFI have the new subclass flags specified. For addg and subg insns, F_SUBCLASS_OTHER is more suitable because these operations do more than just simple add or sub. opcodes/ * aarch64-tbl.h: Use the new F_ARITH_* flags.
2024-07-18opcodes: aarch64: add flags to denote subclasses of ldst insnsIndu Bhagat1-43/+43
The existing iclass information tells us the general shape and purpose of the instructions. In some cases, however, we need to further disect the iclass on the basis of other finer-grain information. E.g., for the purpose of SCFI, we need to know whether a given insn with iclass of ldst_* is a load or a store. At the moment, specify subclasses for only those iclasses relevant to SCFI: ldst_imm9, ldst_pos, ldstpair_indexed, ldstpair_off and ldstnapair_offs. Some insns are best tagged with F_SUBCLASS_OTHER rather than F_LDST_LOAD or F_LDST_STORE: - stg* ops (as they store tag only), - prfm, - ldpsw, ldrsw (32-bit loads with signed extended value. Not useful for restore operations in context of SCFI.) - Use F_SUBCLASS_OTHER for all QL_LDST_R8 and QL_LDST_R16 operands. Also use F_SUBLASS_OTHER for strb/ldrb, strh/ldrh opcodes. These are not full loads and stores and cannot be allowed for register save / restore for the purpose of SCFI. opcodes/ * aarch64-tbl.h: Use the new F_LDST_* flags.
2024-07-12aarch64: Add support for sme2.1 zero instructions.Srinath Parvathaneni3-208/+330
This patch adds support for following sme2.1 zero instructions and the spec is available here [1]. 1. ZERO (single-vector). 2. ZERO (double-vector). 3. ZERO (quad-vector). The VECTOR GROUP symbols VGx2 and VGx4 are optional for the assembler for most of the sme and sve instructions. But for few of the sme2.1 zero instruction variants VECTOR GROUP symbols VGx2 and VGx4 are mandatory. To address this a bit "F_VG_REQ" is introduced in this patch, on setting F_VG_REQ bit in flags of aarch64_opcode forces the assembler to accept instruction operand only having VECTOR GROUP symbols. [1]: https://developer.arm.com/documentation/ddi0602/2024-03/SME-Instructions?lang=en
2024-07-12aarch64: Add support for sme2.1 movaz instructions.Srinath Parvathaneni10-283/+493
This patch adds support for following sme2.1 movaz instructions and the spec is available here [1]. 1. MOVAZ (array to vector, two registers). 2. MOVAZ (array to vector, four registers). 3. MOVAZ (tile to vector, single). [1]: https://developer.arm.com/documentation/ddi0602/2024-03/SME-Instructions?lang=en
2024-07-12aarch64: Add support for sme2.1 luti2 and luti4 instructions.Srinath Parvathaneni4-210/+274
This patch adds support for following sme2.1 luti2 and luti4 instructions, spec is available here [1] 1. LUTI2 (two registers) strided. 2. LUTI2 (four registers) strided. 3. LUTI4 (two registers) strided. 4. LUTI4 (four registers) strided. [1]: https://developer.arm.com/documentation/ddi0602/2024-03/SME-Instructions?lang=en
2024-07-08aarch64: Add support for sve2p1 pmov instruction.srinath6-221/+409
This patch adds support for followign SVE2p1 instruction, spec is available here [1]. 1. PMOV (to vector) 2. PMOV (to predicate) Both pmov (to vector) and pmov (to predicate) have destination scalable vector register and source scalable vector register respectively as an operand with no suffix and optional index. To handle this case we have added 8 new operands in this patch. AARCH64_OPND_SVE_Zn0_INDEX, /* Zn[index], bits [9:5]. */ AARCH64_OPND_SVE_Zn1_17_INDEX, /* Zn[index], bits [9:5,17]. */ AARCH64_OPND_SVE_Zn2_18_INDEX, /* Zn[index], bits [9:5,18:17]. */ AARCH64_OPND_SVE_Zn3_22_INDEX, /* Zn[index], bits [9:5,18:17,22]. */ AARCH64_OPND_SVE_Zd0_INDEX, /* Zn[index], bits [4:0]. */ AARCH64_OPND_SVE_Zd1_17_INDEX, /* Zn[index], bits [4:0,17]. */ AARCH64_OPND_SVE_Zd2_18_INDEX, /* Zn[index], bits [4:0,18:17]. */ AARCH64_OPND_SVE_Zd3_22_INDEX, /* Zn[index], bits [4:0,18:17,22]. */ Since the index of the <Zd> operand is optional, the index part is dropped in disassembly in both the cases of "no index" or "zero index". As per spec: PMOV <Zd>{[<imm>]}, <Pn>.D PMOV <Pn>.D, <Zd>{[<imm>]} Example1: Assembly: pmov z5[0], p6.d Disassembly: pmov z5, p6.d Assembly: pmov z5, p6.d Disassembly: pmov z5, p6.d Example2: Assembly: pmov p4.b, z5[0] Disassembly: pmov p4.b, z5 Assembly: pmov p4.b, z5 Disassembly: pmov p4.b, z5 [1]: https://developer.arm.com/documentation/ddi0602/2024-03/SVE-Instructions?lang=en
2024-07-08aarch64: Add support for sve2p1 tbxq instruction.Srinath Parvathaneni2-158/+170
This patch adds support for SVE2p1 "tbxq" instruction, spec is available here [1]. [1]: https://developer.arm.com/documentation/ddi0602/2024-03/SVE-Instructions?lang=en
2024-07-08aarch64: Add support for sve2p1 zipq[1-2] instructions.Srinath Parvathaneni2-160/+184
This patch adds support for SVE2p1 "zipq1" and "zipq2" instructions, spec is available here [1]. [1]: https://developer.arm.com/documentation/ddi0602/2024-03/SVE-Instructions?lang=en
2024-07-08aarch64: Add support for sve2p1 uzpq[1-2] instructions.Srinath Parvathaneni2-151/+175
This patch adds support for SVE2p1 "uzpq1" and "uzpq2" instructions, spec is available here [1] [1]: https://developer.arm.com/documentation/ddi0602/2024-03/SVE-Instructions?lang=en
2024-07-08aarch64: Add support for sve2p1 tblq instruction.Srinath Parvathaneni2-175/+187
This patch adds support for SVE2p1 "tblq" instruction, spec is available here [1]. [1]: https://developer.arm.com/documentation/ddi0602/2024-03/SVE-Instructions?lang=en
2024-07-08aarch64: Add support for sve2p1 orqv instruction.Srinath Parvathaneni2-152/+164
This patch adds support for SVE2p1 "orqv" instruction, spec available here [1]. [1]: https://developer.arm.com/documentation/ddi0602/2024-03/SVE-Instructions?lang=en
2024-07-05aarch64: add Debug Feature Register 2 (ID_AA64DFR2_EL1)Matthieu Longo1-0/+1
This patch also adds relevant tests. Regression tested on aarch64-none-elf, and no regression found.
2024-07-05aarch64: add STEP2 feature and its associated registersMatthieu Longo1-0/+1
AArch64 defines new registers for the feature step2 (Enhanced Software Step Extension). step2 is an Armv9.5-A feature. This patch also adds relevant tests. Regression tested on aarch64-none-elf, and no regression found.
2024-07-05aarch64: add SPMU2 feature and its associated registersMatthieu Longo1-0/+1
AArch64 defines new registers for the feature spmu2 (System Performance Monitors Extension version 2). spmu2 is an Armv9.5-A feature. This patch also adds relevant tests. Regression tested on aarch64-none-elf, and no regression found.
2024-07-05aarch64: add E3DSE feature and its associated registersMatthieu Longo1-0/+2
AArch64 defines new registers for the feature e3dse (Delegated SError exceptions for EL3): vdisr_el3 and vdisr_el3. e3dse is an Armv9.5-A feature. This patch also adds relevant tests. Regression tested on aarch64-none-elf, and no regression found.
2024-07-05RISC-V: avoid use of match_opcode() in riscv_insn_types[]Jan Beulich1-102/+102
As of 27b33966b18e ("RISC-V: disallow x0 with certain macro-insns") the .match_func field may be NULL for entries used for assembly only, which is the case for the entire table. With .match and .mask both zero the function would only ever succeed anyway. Save almost a hundred base relocations in the final executable by using NULL instead.
2024-07-05x86: Correct position of ".s" for CCMPcc in disassemblerCui, Lili2-2/+12
Added new macro %SW to CCMPcc to print ".s" after the mnemonic. Before: ccmpbl {dfv=}.s %edx,%eax After: ccmpbl.s {dfv=} %edx,%eax gas/ChangeLog: * testsuite/gas/i386/x86-64-pseudos-apx.d: Add tests for CCMPcc. * testsuite/gas/i386/x86-64-pseudos-apx.s: Ditto. opcodes/ChangeLog: * i386-dis-evex.h: Added %SW for CCMPcc swap operands. * i386-dis.c (struct dis386): Added %SW. (putop): Handle %SW.
2024-07-04Support APX CFCMOVCui, Lili6-2237/+3269
The CMOVcc instruction proposed by EVEX has four different forms, corresponding to the four possible combinations of EVEX.ND and EVEX.NF values. In the encoder part, when the CFCMOV template supports EVEX_NF, it means that it requires EVEX.NF to be 1. In the decoder part, CFCMOV_Fixup is used to reverse source and destination operands in the 2-operand case. gas/ChangeLog: * config/tc-i386.c (build_apx_evex_prefix): Set NF bit for cfcmov when the insn template supports EVEX_NF. * testsuite/gas/i386/x86-64-apx-inval.l: Add invalid tests for cfcmov. * testsuite/gas/i386/x86-64-apx-inval.s: Ditto. * testsuite/gas/i386/x86-64.exp: Add tests for cfcmov and cmov. * testsuite/gas/i386/x86-64-apx-cfcmov-intel.d: Ditto. * testsuite/gas/i386/x86-64-apx-cfcmov.d: Ditto. * testsuite/gas/i386/x86-64-apx-cfcmov.s: Ditto. opcodes/ChangeLog: * i386-dis-evex-prefix.h: Add cfcmov instructions. * i386-dis.c (CFCMOV_Fixup): Special handling of cfcmov. (putop): Print 'cf' for cfcmov instructions. * i386-opc.h (EVEX_NF): New. * i386-opc.tbl: Add cfcmov instructions. * i386-mnem.h: Regerated. * i386-tbl.h: Regerated.
2024-06-28x86/APX: apply NDD-to-legacy transformation to further CMOVcc formsJan Beulich2-31/+34
With both sources being registers, these insns are almost commutative; the only extra adjustment needed is inversion of the encoded condition.
2024-06-28x86/APX: extend TEST-by-imm7 optimization to CTESTccJan Beulich2-31/+31
The same properties apply there.
2024-06-28x86/APX: optimize {nf}-form IMUL-by-power-of-2 to SHLJan Beulich2-12/+12
..., for differing only in the resulting EFLAGS, which are left untouched anyway. That's a shorter encoding, available as long as certain constraints on operands are met; see code comments. (SHL-by-1 forms may then be subject to further optimization that was introduced earlier.) Note that kind of as a side effect this also converts multiplication by 1 to shift by 0, which is a plain move or even no-op anyway. That could be further shrunk (as could be presence of shifts/rotates by 0 in the original code as well as a fair set of other {nf}-form insns), yet the expectation (for now) is that people won't write such code in the first place.
2024-06-28x86/APX: optimize certain {nf}-form insns to LEAJan Beulich2-7/+7
..., as that leaves EFLAGS untouched anyway. That's a shorter encoding, available as long as certain constraints on operand size and registers are met; see code comments. Note that this requires deferring to derive encoding_evex from {nf} presence, as in optimize_encoding() we want to avoid touching the insns when {evex} was also used. Note further that this requires want_disp32() to now also consider the opcode: We don't want to replace i.tm.mnem_off, for diagnostics to still report the original mnemonic (or else things can get confusing). While there, correct adjacent mis-indentation.
2024-06-28x86/APX: optimize {nf}-form rotate-by-width-less-1Jan Beulich2-15/+15
Unlike for the legacy forms, where there's a difference in the resulting EFLAGS.CF, for the NF variants the immediate can be got rid of in that case by switching to a 1-bit rotate in the opposite direction.
2024-06-28x86/APX: optimize {nf} forms of ADD/SUB with specific immediatesJan Beulich2-20/+20
Unlike for the legacy forms, where there's a difference in the resulting EFLAGS, for the NF variants we can safely replace ones using 0x80 by the respectively other insn while negating the immediate, saving 3 immediate bytes (just 1 though for 16-bit operand size). Similarly we can replace ones using 1 / -1 by INC/DEC (eliminating the immediate).
2024-06-28RISC-V: Add Zabha extension CAS instructions.Jiawei1-0/+8
This patch update the cas instruction in Zabha extension [1], when both Zabha and Zacas extension enabled. [1] https://github.com/riscv/riscv-zabha/tags bfd/ChangeLog: * elfxx-riscv.c (riscv_multi_subset_supports): New extension case. gas/ChangeLog: * testsuite/gas/riscv/zabha-32.d: New instructions. * testsuite/gas/riscv/zabha.d: Ditto. * testsuite/gas/riscv/zabha.s: Ditto. include/ChangeLog: * opcode/riscv-opc.h (MATCH_AMOCAS_B): New opcodes. (MASK_AMOCAS_B): Ditto. (MATCH_AMOCAS_H): Ditto. (MASK_AMOCAS_H): Ditto. (DECLARE_INSN): New instructions. * opcode/riscv.h (enum riscv_insn_class): New class case. opcodes/ChangeLog: * riscv-opc.c: New instructions.
2024-06-26aarch64: FP8 scale and convert - Implement minor improvementsVictor Do Nascimento1-12/+12
Following feedback received shortly after the initial commit of the aarch64 instructions for scaling and converting fp8 instructions, this patch addresses the issues raised in the relevant feedback. This includes the following changes: * Standardize all FP8 qualifier-set names. This has resulted in the renaming of QL_V2FP8B8H to QL_V2_HB_LOWER and, likewise, QL_V28H16B to QL_V2_HB_FULL. * Update `FP8_INSN' aarch64_opcode_table[] entries to reflect the new standardized qualifier-set names mentioned above and, in the case of the "fcvtn" entries, also add a leading 0 to their opcode values so they are given as 8 hexadecimal digits in length to ensure consistency in formatting relative to other entries in the table. * Revise the added test-cases so that when checking operand fields in the disassembled binaries, all bits for these fields get tested to ensure they can be toggled on/off by the relevant operand arguments.
2024-06-25aarch64: Treat operand Rt_IN_SYS_ALIASES as register number (PR 31919)Jens Remus1-1/+1
The AArch64 instruction table (aarch64-tbl.h) defines the operand Rt_IN_SYS_ALIASES as register number. During assembly it is correctly encoded as register number (reg.regno) in parse_operands. During disassembly it is first correctly decoded as register number (reg.regno) in aarch64_ext_regno called by aarch64_extract_operand, but then erroneously treated as immediate value (imm.value) in aarch64_print_operand. This resolves the assembler test case "gas/aarch64/brbe-brb-inst" to erroneously fail on s390. On AArch64 - being little-endian - the struct aarch64_opnd_info union fields reg.regno and imm.value share their least-significant bits. On s390 - being big-endian - they do not. opcodes/ PR binutils/31919 * aarch64-opc.c: Treat operand Rt_IN_SYS_ALIASES as register number. Bug: https://sourceware.org/PR31919 Fixes: 72476aca8f58 ("aarch64: add Branch Record Buffer extension instructions") Signed-off-by: Jens Remus <jremus@linux.ibm.com>