[PATCH v2 11/47] s390: Improve coding of .insn pseudo-mnemonics without operands

Jens Remus jremus@linux.ibm.com
Fri Nov 6 15:57:01 GMT 2026


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>
---
 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 096ea2594908..654576100492 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)
-- 
2.53.0



More information about the Binutils mailing list