[binutils-gdb] s390: Make D(B) operand optional in .insn pseudo-mnemonic s

Jens Remus jremus@sourceware.org
Tue Nov 10 16:50:40 GMT 2026


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=901cf7737c6bcc9170759230cd7cc080dd2fd0d6

commit 901cf7737c6bcc9170759230cd7cc080dd2fd0d6
Author: Jens Remus <jremus@linux.ibm.com>
Date:   Tue Nov 10 17:46:03 2026 +0100

    s390: Make D(B) operand optional in .insn pseudo-mnemonic s
    
    The S instruction format has optional B and D fields.  Make the
    resulting D(B) composite operand in the .insn pseudo-mnemonic s
    optional.
    
    While at it add comments to ESA/390 .insn pseudo-mnemonic test.
    
    opcodes/
            * s390-opc.c (s390_opformats): Make D(B) composite operand
            optional in pseudo-mnemonic s.
    
    gas/
            * doc/c-s390.texi (s390 Formats): Document S operand D2(B2) as
            optional.
    
    gas/testsuite/
            * gas/s390/esa-operands.d (s): Add comment.
            * gas/s390/esa-operands.s (s): Likewise.
            * gas/s390/zarch-operands.d: Add test for .insn s.
            * gas/s390/zarch-operands.s: Likewise.
    
    Signed-off-by: Jens Remus <jremus@linux.ibm.com>

Diff:
---
 gas/doc/c-s390.texi                     | 2 +-
 gas/testsuite/gas/s390/esa-operands.d   | 1 +
 gas/testsuite/gas/s390/esa-operands.s   | 2 +-
 gas/testsuite/gas/s390/zarch-operands.d | 3 +++
 gas/testsuite/gas/s390/zarch-operands.s | 2 ++
 opcodes/s390-opc.c                      | 2 +-
 6 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/gas/doc/c-s390.texi b/gas/doc/c-s390.texi
index 8ec063c2f53..32e54124c2f 100644
--- a/gas/doc/c-s390.texi
+++ b/gas/doc/c-s390.texi
@@ -636,7 +636,7 @@ with the @samp{.insn} pseudo directive:
 0         8    12   16   20             32        40       47
 @end verbatim
 
-@item S format: <insn> D2(B2)
+@item S format: <insn> [D2(B2)]
 @verbatim
 +-------------------+----+--------------+
 |      OpCode       | B2 |      D2      |
diff --git a/gas/testsuite/gas/s390/esa-operands.d b/gas/testsuite/gas/s390/esa-operands.d
index 93daa4bf293..18041c115d5 100644
--- a/gas/testsuite/gas/s390/esa-operands.d
+++ b/gas/testsuite/gas/s390/esa-operands.d
@@ -29,6 +29,7 @@ Disassembly of section .text:
 .*:	ed 10 30 02 00 1a [	 ]*adb	%f1,2\(%r3\)
 # RXF
 .*:	ed 24 50 03 10 1e [	 ]*madb	%f1,%f2,3\(%r4,%r5\)
+# S
 .*:	b2 33 20 01 [	 ]*ssch	1\(%r2\)
 .*:	92 03 20 01 [	 ]*mvi	1\(%r2\),3
 .*:	d2 26 30 01 50 04 [	 ]*mvc	1\(39,%r3\),4\(%r5\)
diff --git a/gas/testsuite/gas/s390/esa-operands.s b/gas/testsuite/gas/s390/esa-operands.s
index 2101b019bb1..6fec8f8801f 100644
--- a/gas/testsuite/gas/s390/esa-operands.s
+++ b/gas/testsuite/gas/s390/esa-operands.s
@@ -11,7 +11,7 @@ foo:
 	.insn rx,0x58000000,%r1,2(%r3,%r4)		# l %r1,2(%r3,%r4)
 	.insn rxe,0xed000000001a,%f1,2(%r3)		# adb %f1,2(%r3)
 	.insn rxf,0xed000000001e,%f1,%f2,3(%r4,%r5)	# madb %f1,%f2,3(%r4,%r5)
-	.insn s,0xb2330000,1(%r2)
+	.insn s,0xb2330000,1(%r2)			# ssch 1(%r2)
 	.insn si,0x92000000,1(%r2),3
 	.insn ss,0xd20000000000,1(2,%r3),4(%r5),6
 	.insn sse,0xe50100000000,1(%r2),3(%r4)
diff --git a/gas/testsuite/gas/s390/zarch-operands.d b/gas/testsuite/gas/s390/zarch-operands.d
index 7f2976f380d..8be8c692202 100644
--- a/gas/testsuite/gas/s390/zarch-operands.d
+++ b/gas/testsuite/gas/s390/zarch-operands.d
@@ -123,5 +123,8 @@ Disassembly of section .text:
 .*:	e3 12 36 ce 05 36 [	 ]*pfd	1,22222\(%r2,%r3\)
 # RXY-c
 .*:	e3 12 36 ce 05 60 [	 ]*lxab	%r1,22222\(%r2,%r3\)
+# S
+.*:	b2 33 10 6f [	 ]*ssch	111\(%r1\)
+.*:	b2 31 00 00 [	 ]*hsch
 .*:	c8 50 20 01 40 03 [	 ]*mvcos	1\(%r2\),3\(%r4\),%r5
 #?.*:	07 07 [	 ]*nopr	%r7
diff --git a/gas/testsuite/gas/s390/zarch-operands.s b/gas/testsuite/gas/s390/zarch-operands.s
index 504ddff43cf..2b37cd39bf7 100644
--- a/gas/testsuite/gas/s390/zarch-operands.s
+++ b/gas/testsuite/gas/s390/zarch-operands.s
@@ -61,4 +61,6 @@ foo:
 	.insn rxy_a,0xe30000000008,%r1,22222(%r2,%r3)	# ag %r1,22222(%r2,%r3)
 	.insn rxy_b,0xe30000000036,1,22222(%r2,%r3)	# pfd 1,22222(%r2,%r3)
 	.insn rxy_c,0xe30000000060,%r1,22222(%r2,%r3)	# lxab %r1,22222(%r2,%r3)
+	.insn s,0xb2330000,111(%r1)			# ssch 111(%r1)
+	.insn s,0xb2310000				# hsch
 	.insn ssf,0xc80000000000,1(%r2),3(%r4),%r5
diff --git a/opcodes/s390-opc.c b/opcodes/s390-opc.c
index 72ffc967c73..bbc9188c2b2 100644
--- a/opcodes/s390-opc.c
+++ b/opcodes/s390-opc.c
@@ -852,7 +852,7 @@ const struct s390_opcode s390_opformats[] =
   { "rxy_a",OP8(0x00LL), MASK_RXY_RRRD,	   INSTR_RXY_RRRD,    3,  3, 256, NULL },
   { "rxy_b",OP8(0x00LL), MASK_RXY_URRD,	   INSTR_RXY_URRD,    2,  6, 256, NULL },
   { "rxy_c",OP8(0x00LL), MASK_RXY_RRRD,	   INSTR_RXY_RRRD,    2, 13, 256, NULL },
-  { "s",    OP8(0x00LL), MASK_S_RD,	   INSTR_S_RD,	      3,  0, 256, NULL },
+  { "s",    OP8(0x00LL), MASK_S_RD,	   INSTR_S_RD,	      3,  0, 256|1, NULL },
   { "si",   OP8(0x00LL), MASK_SI_URD,	   INSTR_SI_URD,      3,  0, 256, NULL },
   { "sil",  OP8(0x00LL), MASK_SIL_RDI,     INSTR_SIL_RDI,     2,  6, 256, NULL },
   { "siy",  OP8(0x00LL), MASK_SIY_URD,	   INSTR_SIY_URD,     2,  3, 256, NULL },


More information about the Binutils-cvs mailing list