aboutsummaryrefslogtreecommitdiff
path: root/gas
AgeCommit message (Collapse)AuthorFilesLines
2023-04-25RISC-V: adjust logic to avoid register name symbolsJan Beulich2-27/+98
Special casing GPR names in my_getSmallExpression() leads to a number of inconsistencies. Generalize this by utilizing the md_parse_name() hook, limited to when instruction operands are being parsed (really: probed). Then both the GPR lookup there and the yet more ad hoc workaround for PR/gas 29940 can be removed (including its extension needed for making the compressed form JAL work again).
2023-04-25RISC-V: test for expected / no unexpected symbolsJan Beulich3-0/+22
Both the temporary workaround for PR/gas 29940 and the existing special casing of GPRs in my_getSmallExpression() aren't really tested anywhere (i.e. with the workarounds remove testing would still succeed). Nor is there any test for uses of symbols with names matching GPRs, where such is permitted. Before altering how this is to be dealt with, install two testcases covering the expected behavior. (For now this includes only known affected insns; re-ordering of entries in riscv_opcodes[] could, however, yield more of them.)
2023-04-25RISC-V: don't recognize bogus relocationsJan Beulich1-2/+1
With my_getSmallExpression() consistently and silently failing on relocation operators not fitting an insn, it is no longer necessary to hand it percent_op_itype[] "just in case" (i.e. to avoid errors when a subsequent parsing attempt for another operand combination might succeed). This also eliminates the latent problem of percent_op_itype[] and percent_op_stype[] growing a non-identical set of recognized relocation operators.
2023-04-25RISC-V: avoid redundant and misleading/wrong error messagesJan Beulich2-1/+9
The use of a wrong (for the insn) relocation operator (or a future one which simply isn't recognized by older gas yet) doesn't render the (rest of the) expression "bad". Furthermore alongside the error from expression() in most cases the parser would emit another error then anyway. Suppress the call to my_getExpression() in such a case, arranging for a guaranteed subsequent error message by marking the expression "illegal".
2023-04-25RISC-V: drop "percent_op" parameter from my_getOpcodeExpression()Jan Beulich1-4/+4
Both callers check for no relocations, so there's no point parsing for some. Have the function pass percent_op_null into my_getSmallExpression(). Note that there's no point passing percent_op_itype: Elsewhere, especially when processing compressed alias insns ahead of non-alias ones, this has the effect of avoiding "bad expression" errors when another parsing pass may follow (and succeed). Here, however, all alternative forms of an insn type will again start with the same O4 or O2, so avoiding errors earlier on doesn't really help. Plus constructs with a relocation specifier (as percent_op_itype would permit) can't be specified anyway, as the scrubber eats the whitespace between .insn's type and the O4 or O2 expression when that starts with % or ( - i.e. these will be seen as e.g. "i%lo(x)", and riscv_ip() looks only for whitespace when finding the end of a mnemonic.
2023-04-25RISC-V: minor effort reduction in relocation specifier parsingJan Beulich1-16/+16
The sole caller of parse_relocation() has already checked for the % prefix, so there's no need to check for it again in the strncasecmp() and there's also no reason to make the involved string literals longer than necessary.
2023-04-23MIPS: fix loongson3 llsc workaroundYunQiang Su1-7/+3
-mfix-looongson3-llsc may add sync instructions not needed on some asm code with lots of debug info. PR: 30153 * gas/config/tc-mips.c(fix_loongson3_llsc): clear logistic.
2023-04-23MIPS: default output r6 obj if the triple is r6YunQiang Su2-0/+18
If the triple is mipsisa32r6* or mipsisa64r6*, ld/as should output r6 objects by default. The triples with vendor `img` should do same. The examples include: as xx.s -o xx.o ld -r -b binary xx.dat -o xx.o
2023-04-23MIPS: support mips*64 as CPU and gnuabi64 as ABIYunQiang Su2-2/+8
For MIPS64r6 ports, Debian as an example, `mipsisa64r6el` is used as the cpu name in triple. Let's recognize them by `mips*64*(el)`. For 64bit Ports, like Debian's mips64el and mips64r6el ports, `gnuabi64` is used as the abi section. Let's use N64 abi by default for the triple with gnuabi64.
2023-04-23LoongArch: Fix loongarch32 test failsmengqinggang1-7/+7
Regenerated macro_op_32.d and add skip loongarch64-*-*. gas/ChangeLog: * testsuite/gas/loongarch/macro_op_32.d: Regenerated. ld/ChangeLog: * testsuite/ld-loongarch-elf/macro_op_32.d: Regenerated.
2023-04-20x86: adjust an ILP32 testcase using .insnJan Beulich1-1/+1
In commit 6967633c8b49 ("x86: convert testcases to use .insn") an ILP32 clone of a testcase was missed in the set of tests needing --divide added. Reported-by: Clément Chigot <chigot@adacore.com>
2023-04-19gas: sframe: fix commentIndu Bhagat1-1/+1
2023-04-19gas: sframe: use ATTRIBUTE_UNUSED consistentlyIndu Bhagat1-3/+3
gas/ * gen-sframe.c (sframe_set_version): Use ATTRIBUTE_UNUSED consistently. (output_sframe): Likewise. (sframe_set_fre_info): Remove the usage of ATTRIBUTE_UNUSED.
2023-04-19gas: document that get_symbol_name() can clobber the input bufferJan Beulich1-5/+10
Callers which want to make further parsing attempts at the buffer passed to the function need to be aware that due to the potential of string concatenation the input buffer may be altered in ways beyond what can be undone by putting back at *input_line_pointer the character that the function returns.
2023-04-19x86: parse_register() must not alter the parsed stringJan Beulich1-13/+9
This reverts the code change done by 100f993c53a5 ("x86: Check unbalanced braces in memory reference"), which wrongly identified e87fb6a6d0cd ("x86/gas: support quoted address scale factor in AT&T syntax") as the root cause of PR gas/30248. (The testcase is left in place, no matter that it's at best marginally useful in that shape.) The problem instead is that parse_register() alters the string handed to it, thus breaking valid assumptions in subsequent parsing code. Since the function's behavior is a result of get_symbol_name()'s, make a copy of the incoming string before invoking that function. Like for parse_real_register() follow the model of strtol() et al: input string is const-qualified to signal that the string isn't altered, but the returned "end" pointer is not const-qualified, requiring const to be cast away (which generally is a bad idea, but the alternative would again be more convoluted code).
2023-04-19x86: parse_real_register() does not alter the parsed stringJan Beulich1-4/+4
Follow the model of strtol() et al - input string is const-qualified to signal that the string isn't altered, but the returned "end" pointer is not const-qualified, requiring const to be cast away (which generally is a bad idea, but the alternative would be more convoluted code).
2023-04-18Symbols with GOT relocatios do not fix adjustbalemengqinggang4-69/+91
gas * config/tc-loongarch.c (loongarch_fix_adjustable): Symbols with GOT relocatios do not fix adjustbale. * testsuite/gas/loongarch/macro_op_large_abs.d: Regenerated. * testsuite/gas/loongarch/macro_op_large_pc.d: Regenerated. ld * testsuite/ld-loongarch-elf/macro_op.d: Regenerated. -
2023-04-18Assembler Internal Docs: Describe handling of opcodes for relaxation a bit ↵Thomas Koenig2-3/+10
better.
2023-04-13arc: Update ARC's CFI tests.Claudiu Zissulescu3-11/+16
The double store/loads instructions (e.g. STD/LDD) are not baseline ARC ISA. The same holds for some short instructions. Update the tests to use base ARC ISA. Signed-off-by: Claudiu Zissulescu <claziss@synopsys.com>
2023-04-13arc: Update GAS testClaudiu Zissulescu3-8/+5
Signed-off-by: Claudiu Zissulescu <claziss@gmail.com>
2023-04-12Fail of x86_64 AMX-COMPLEX insns (Intel disassembly)Alan Modra1-0/+1
x86_64-w64-mingw32 pads sections. * testsuite/gas/i386/x86-64-amx-complex-intel.d: Don't fail due to nop padding.
2023-04-12Comment typo fixAlan Modra1-1/+1
2023-04-10x86: Add inval tests for AMX instructionsHaochen Jiang7-8/+60
gas/ChangeLog: * testsuite/gas/i386/i386.exp: Run AMX-FP16 and AMX-COMPLEX inval testcases. * testsuite/gas/i386/x86-64-amx-inval.l: Add AMX-BF16 tests. * testsuite/gas/i386/x86-64-amx-inval.s: Ditto. * testsuite/gas/i386/x86-64-amx-complex-inval.l: New test. * testsuite/gas/i386/x86-64-amx-complex-inval.s: Ditto. * testsuite/gas/i386/x86-64-amx-fp16-inval.l: Ditto. * testsuite/gas/i386/x86-64-amx-fp16-inval.s: Ditto.
2023-04-07Support Intel AMX-COMPLEXHaochen Jiang11-1/+104
gas/ChangeLog: * NEWS: Support Intel AMX-COMPLEX. * config/tc-i386.c: Add amx_complex. * doc/c-i386.texi: Document .amx_complex. * testsuite/gas/i386/i386.exp: Run AMX-COMPLEX tests. * testsuite/gas/i386/amx-complex-inval.l: New test. * testsuite/gas/i386/amx-complex-inval.s: Ditto. * testsuite/gas/i386/x86-64-amx-complex-bad.d: Ditto. * testsuite/gas/i386/x86-64-amx-complex-bad.s: Ditto. * testsuite/gas/i386/x86-64-amx-complex-intel.d: Ditto. * testsuite/gas/i386/x86-64-amx-complex.d: Ditto. * testsuite/gas/i386/x86-64-amx-complex.s: Ditto. opcodes/ChangeLog: * i386-dis.c (MOD_VEX_0F386C_X86_64_W_0): New. (PREFIX_VEX_0F386C_X86_64_W_0_M_1_L_0): Ditto. (X86_64_VEX_0F386C): Ditto. (VEX_LEN_0F386C_X86_64_W_0_M_1): Ditto. (VEX_W_0F386C_X86_64): Ditto. (mod_table): Add MOD_VEX_0F386C_X86_64_W_0. (prefix_table): Add PREFIX_VEX_0F386C_X86_64_W_0_M_1_L_0. (x86_64_table): Add X86_64_VEX_0F386C. (vex_len_table): Add VEX_LEN_0F386C_X86_64_W_0_M_1. (vex_w_table): Add VEX_W_0F386C_X86_64. * i386-gen.c (cpu_flag_init): Add CPU_AMX_COMPLEX_FLAGS and CPU_ANY_AMX_COMPLEX_FLAGS. * i386-init.h: Regenerated. * i386-mnem.h: Ditto. * i386-opc.h (CpuAMX_COMPLEX): New. (i386_cpu_flags): Add cpuamx_complex. * i386-opc.tbl: Add AMX-COMPLEX instructions. * i386-tbl.h: Regenerated.
2023-04-06gas/write.c use better typesAlan Modra1-3/+3
A tiny tidy. * write.c (frags_chained): Make it a bool. (n_fixups): Make it unsigned.
2023-04-03opcodes/arm: adjust whitespace in cpsie instructionAndrew Burgess2-4/+4
While I was working on the disassembler styling for ARM I noticed that the whitespace in the cpsie instruction was inconsistent with most of the other ARM disassembly output, the disassembly for cpsie looks like this: cpsie if,#10 notice there's no space before the '#10' immediate, most other ARM instructions have a space before each operand. This commit updates the disassembler to add the missing space, and updates the tests I found that tested this instruction.
2023-04-03ubsan: aarch64 parse_vector_reg_listAlan Modra1-4/+4
tc-aarch64.c:1473:27: runtime error: left shift of 7 by 30 places cannot be represented in type 'int'. * config/tc-aarch64.c (parse_vector_reg_list): Avoid UB left shift.
2023-03-31RISC-V: Allocate "various" operand typeTsukasa OI1-17/+47
This commit intends to move operands that require very special handling or operand types that are so minor (e.g. only useful on a few instructions) under "W". I also intend this "W" to be "temporary" operand storage until we can find good two character (or less) operand type. In this commit, prefetch offset operand "f" for 'Zicbop' extension is moved to "Wif" because of its special handling (and allocating single character "f" for this operand type seemed too much). Current expected allocation guideline is as follows: 1. 'W' 2. The most closely related single-letter extension in lowercase (strongly recommended but not mandatory) 3. Identify operand type The author currently plans to allocate following three-character operand types (for operands including instructions from unratified extensions). 1. "Wif" ('Zicbop': fetch offset) 2. "Wfv" (unratified 'Zfa': value operand from FLI.[HSDQ] instructions) 3. "Wfm" / "WfM" 'Zfh', 'F', 'D', 'Q': rounding modes "m" with special handling solely for widening conversion instructions. gas/ChangeLog: * config/tc-riscv.c (validate_riscv_insn, riscv_ip): Move from "f" to "Wif". opcodes/ChangeLog: * riscv-dis.c (print_insn_args): Move from "f" to "Wif". * riscv-opc.c (riscv_opcodes): Reflect new operand type.
2023-03-31x86: convert testcases to use .insnJan Beulich39-523/+346
This can't be done for all insns currently encoded with .byte. For one outside of 64-bit mode unused (typically ignored) register encoding bits in VEX/XOP/EVEX prefixes can't be set to their non-default values, since the necessary registers cannot be specified (and some of these bits can't even be used outside of 64-bit mode). And then there are odd tests like the first one in bad-bcast.s: Its purpose is to illegaly set EVEX.b together with EVEX.W (which could be expressed; note though EVEX.W set is invalid on its own), but then it also clears EVEX.B and EVEX.R' plus it sets EVEX.vvvv to other than 0xf (rendering the test ambiguous, because that's another #UD reason). In {,x86-64-}disassem.s many bogus encodings exist - some with ModR/M byte but insufficient displacement bytes, some using SIB encoding with the SIB byte actually being the supposed immediate. Some of these could be expressed by .insn, but I don't want to introduce bogus examples. These will all need adjustment anyway once the disassembler is improved in the way it deals with unrecognized encodings. Generally generated code is meant to remain the same. {,x86-64-}nops.d are exceptions because insn prefixes are emitted in a different order. opcode{,-intel,-suffix}.d are also adjusted (along with an according correction to opcode.s) to cover an apparent typo in the original tests (xor when or was meant). Where necessary --divide is added as gas option, to allow for the use of the extension opcode functionality. Comments are being adjusted where obviously wrong/misleading.
2023-03-31x86: document .insnJan Beulich2-0/+133
... and mention its introduction in NEWS.
2023-03-31x86: handle immediate operands for .insnJan Beulich6-4/+182
Since we have no insn suffix and it's also not realistic to infer immediate size from the size of other (typically register) operands (like optimize_imm() does), and since we also don't have a template telling us permitted size(s), a new syntax construct is introduced to allow size (and signedness) specification. In the absence of such, the size is inferred from significant bits (which obviously may yield inconsistent results at least for effectively negative values, depending on whether BFD64 is enabled), and only if supplied expressions can be evaluated at parsing time. Being explicit is generally recommended to users. Size specification is permitted at bit granularity, but of course the eventually emitted immediate values will be padded up to 8-, 16-, 32-, or 64-bit fields.
2023-03-31x86: allow for multiple immediates in output_disp()Jan Beulich1-5/+5
.insn isn't going to have a constraint of only a single immediate when, in particular, RIP-relative addressing is used.
2023-03-31x86: handle EVEX Disp8 for .insnJan Beulich5-1/+149
In particular the scaling factor cannot always be determined from pre- existing operand attributes. Introduce a new {:d<N>} vector operand syntax extension, restricted to .insn only, to allow specifying this in (at least) otherwise ambiguous cases.
2023-03-31x86: process instruction operands for .insnJan Beulich6-21/+432
Deal with register and memory operands; immediate operands will follow later, as will the handling of EVEX embedded broadcast and EVEX Disp8 scaling. Note that because we can't really know how to encode their use, %cr8 and up cannot be used with .insn outside of 64-bit mode. Users would need to specify an explicit LOCK prefix in combination with %cr0 etc.
2023-03-31x86: parse special opcode modifiers for .insnJan Beulich1-1/+38
So called "short form" encoding is specified by a trailing "+r", whereas a possible extension opcode is specified by the usual "/<digit>". Take these off the expression before handing it to get_absolute_expression(). Note that on targets where / starts a comment, --divide needs passing to gas in order to make use of the extension opcode functionality.
2023-03-31x86: parse VEX and alike specifiers for .insnJan Beulich5-6/+250
All encoding spaces can be used this way; there's a certain risk that the bits presently reserved could be used for other purposes down the road, but people using .insn are expected to know what they're doing anyway. Plus this way there's at least _some_ way to have those bits set. For now this will only allow operand-less insns to be encoded this way.
2023-03-31x86: introduce .insn directiveJan Beulich6-10/+213
For starters this deals with only very basic constructs.
2023-03-30aarch64: Add the RPRFM instructionRichard Sandiford7-1/+186
This patch adds the RPRFM (range prefetch) instruction. It was introduced as part of SME2, but it belongs to the prefetch hint space and so doesn't require any specific ISA flags. The aarch64_rprfmop_array initialiser (deliberately) only fills in the leading non-null elements.
2023-03-30aarch64: Add the SVE FCLAMP instructionRichard Sandiford8-1/+102
2023-03-30aarch64: Add new SVE shift instructionsRichard Sandiford7-0/+97
This patch adds the new SVE SQRSHRN, SQRSHRUN and UQRSHRN instructions.
2023-03-30aarch64: Add new SVE saturating conversion instructionsRichard Sandiford7-0/+93
This patch adds the SVE SQCVTN, SQCVTUN and UQCVTN instructions, which are available when FEAT_SME2 is implemented.
2023-03-30aarch64: Add new SVE dot-product instructionsRichard Sandiford9-12/+186
This patch adds the SVE FDOT, SDOT and UDOT instructions, which are available when FEAT_SME2 is implemented. The patch also reorders the existing SVE_Zm3_22_INDEX to keep the operands numerically sorted.
2023-03-30aarch64: Add the SVE BFMLSL instructionsRichard Sandiford7-0/+143
This patch adds the SVE BFMLSLB and BFMLSLT instructions, which are available when FEAT_SME2 is implemented.
2023-03-30aarch64: Add the SME2 UZP and ZIP instructionsRichard Sandiford7-0/+352
This patch adds UZP and ZIP, which combine UZP{1,2} and ZIP{1,2} into single instructions.
2023-03-30aarch64: Add the SME2 UNPK instructionsRichard Sandiford7-0/+188
This patch adds SUNPK and UUNPK, which unpack one register's worth of elements to two registers' worth, or two registers' worth to four registers' worth.
2023-03-30aarch64: Add the SME2 shift instructionsRichard Sandiford15-3/+384
There are two instruction formats here: - SQRSHR, SQRSHRU and UQRSHR, which operate on lists of two or four registers. - SQRSHRN, SQRSHRUN and UQRSHRN, which operate on lists of four registers. These are the first SME2 instructions to have immediate operands. The patch makes sure that, when parsing SME2 instructions with immediate operands, the new predicate-as-counter registers are parsed as registers rather than as #-less immediates.
2023-03-30aarch64: Add the SME2 saturating conversion instructionsRichard Sandiford14-0/+328
There are two instruction formats here: - SQCVT, SQCVTU and UQCVT, which operate on lists of two or four registers. - SQCVTN, SQCVTUN and UQCVTN, which operate on lists of four registers.
2023-03-30aarch64: Add the SME2 FP<->FP conversion instructionsRichard Sandiford7-0/+102
This patch adds the BFCVT{,N} and FCVT{,N} instructions, which narrow a pair of .S registers to a single .H register.
2023-03-30aarch64: Add the SME2 FP<->int conversion instructionsRichard Sandiford7-0/+245
This patch adds the SME2 versions of the FP<->integer conversion instructions FCVT* and *CVTF. It also adds FP rounding instructions FRINT*, which share the same format.
2023-03-30aarch64: Add the SME2 CLAMP instructionsRichard Sandiford7-0/+407
FCLAMP, SCLAMP and UCLAMP share the same format, although FCLAMP doesn't have a .B form.