[binutils-gdb] s390: Improve coding of .insn pseudo-mnemonics without operands
Jens Remus
jremus@sourceware.org
Tue Nov 10 16:48:42 GMT 2026
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=508ed25d310250e231ba6732f6eb5a89ba860cc7
commit 508ed25d310250e231ba6732f6eb5a89ba860cc7
Author: Jens Remus <jremus@linux.ibm.com>
Date: Tue Nov 10 17:46:02 2026 +0100
s390: Improve coding of .insn pseudo-mnemonics without operands
When all operands of an .insn pseudo-mnemonic are optional and none
are provided, allow omitting the otherwise trailing comma that
separates the opcode constant from the omitted operand list. For
example:
Previously omitting all optional operands required a trailing comma:
.insn INSN-FMT,OPCODE,
This can now be expressed more naturally:
.insn INSN-FMT,OPCODE
This is a prerequisite for making all operands optional in .insn
pseudo-mnemonics rre and s, so that they align to specification. [1]
While at it generalize the logic for .insn pseudo-mnemonics without any
operands, that was previously hardcoded to .insn e.
[1]: IBM z/Architecture Principles of Operation, SA22-7832-14, IBM z17,
https://www.ibm.com/docs/en/module_1678991624569/pdf/SA22-7832-14.pdf
gas/
* config/tc-s390.c (s390_insn): Allow omitting trailing comma
when all operands are optional or there are none.
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
Diff:
---
gas/config/tc-s390.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/gas/config/tc-s390.c b/gas/config/tc-s390.c
index 096ea259490..65457610049 100644
--- a/gas/config/tc-s390.c
+++ b/gas/config/tc-s390.c
@@ -2058,7 +2058,10 @@ s390_insn (int ignore ATTRIBUTE_UNUSED)
else
as_bad (_("second operand of .insn not a constant\n"));
- if (strcmp (opformat->name, "e") != 0 && *input_line_pointer++ != ',')
+ if (opformat->operands[0] != '\0'
+ && !(skip_optargs_p (opformat->flags, opformat->operands)
+ && is_end_of_stmt (*input_line_pointer))
+ && *input_line_pointer++ != ',')
as_bad (_("missing comma after insn constant\n"));
if ((s = strchr (input_line_pointer, '\n')) != NULL)
More information about the Binutils-cvs
mailing list