[PATCH v2 20/47] s390: Make R2 operand optional in .insn pseudo-mnemonic rr

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


The RR instruction format has an optional R2 field.  Make the R2
operand in the .insn pseudo-mnemonic rr optional.

While at it add comments to the ESA/390 .insn pseudo-mnemonic test.

opcodes/
	* s390-opc.c (s390_opformats): Make R2 operand optional in
	pseudo-mnemonic rr.

gas/
	* doc/c-s390.texi (s390 Formats): Document RR operand R2 as
	optional.

gas/testsuite/
	* gas/s390/esa-operands.d (rr): Add comment.
	* gas/s390/esa-operands.s (rr): Likewise.
	* gas/s390/zarch-operands.d: Add test for .insn rr.
	* gas/s390/zarch-operands.s: Likewise.

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
---
 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 6a171808e2e0..855e600dc1af 100644
--- a/gas/doc/c-s390.texi
+++ b/gas/doc/c-s390.texi
@@ -517,7 +517,7 @@ with the @samp{.insn} pseudo directive:
 0         8    12   16   20             32        40       47
 @end verbatim
 
-@item RR format: <insn> R1,R2
+@item RR format: <insn> R1[,R2]
 @verbatim
 +---------+----+----+
 | OpCode  | R1 | R2 |
diff --git a/gas/testsuite/gas/s390/esa-operands.d b/gas/testsuite/gas/s390/esa-operands.d
index 40be3571502f..f62b05321fc0 100644
--- a/gas/testsuite/gas/s390/esa-operands.d
+++ b/gas/testsuite/gas/s390/esa-operands.d
@@ -12,6 +12,7 @@ Disassembly of section .text:
 .*:	0a 01 [	 ]*svc	1
 # RI
 .*:	a7 1a 80 01 [	 ]*ahi	%r1,-32767
+# RR
 .*:	18 12 [	 ]*lr	%r1,%r2
 .*:	b2 5e 00 12 [	 ]*srst	%r1,%r2
 .*:	b3 5b 93 12 [	 ]*didbr	%f1,%f9,%f2,3
diff --git a/gas/testsuite/gas/s390/esa-operands.s b/gas/testsuite/gas/s390/esa-operands.s
index 6bdd4b7a9e10..077b2de02ad4 100644
--- a/gas/testsuite/gas/s390/esa-operands.s
+++ b/gas/testsuite/gas/s390/esa-operands.s
@@ -3,7 +3,7 @@ foo:
 	.insn e,0x0101					# pr
 	.insn i,0x0a00,1				# svc 1
 	.insn ri,0xa70a0000,%r1,-32767			# ahi %r1,-32767
-	.insn rr,0x1800,%r1,%r2
+	.insn rr,0x1800,%r1,%r2				# lr %r1,%r2
 	.insn rre,0xb25e0000,%r1,%r2
 	.insn rrf,0xb35b0000,%f1,%f2,9,%f3
 	.insn rs,0xba000000,%r1,%r2,3(%r4)
diff --git a/gas/testsuite/gas/s390/zarch-operands.d b/gas/testsuite/gas/s390/zarch-operands.d
index 998c8f65e566..3284d66468a7 100644
--- a/gas/testsuite/gas/s390/zarch-operands.d
+++ b/gas/testsuite/gas/s390/zarch-operands.d
@@ -55,6 +55,9 @@ Disassembly of section .text:
  *([\da-f]+):	c0 f4 00 00 00 00 [	 ]*jg	\1 <foo\+0x\1>
 # RIS
 .*:	ec 13 41 bc fe fe [	 ]*cib	%r1,-2,3,444\(%r4\)
+# RR
+.*:	1a 12 [	 ]*ar	%r1,%r2
+.*:	04 10 [	 ]*spm	%r1
 .*:	eb 12 40 03 00 0d [	 ]*sllg	%r1,%r2,3\(%r4\)
 .*:	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 1e66e38949b8..d385e72507b8 100644
--- a/gas/testsuite/gas/s390/zarch-operands.s
+++ b/gas/testsuite/gas/s390/zarch-operands.s
@@ -22,5 +22,7 @@ foo:
 	.insn ril_b,0xc00500000000,%r14,.		# brasl %r14,.
 	.insn ril_c,0xc00400000000,0b1111,.		# brcl 0b1111,.
 	.insn ris,0xec00000000fe,%r1,-2,3,444(%r4)	# cib %r1,-2,3,444(%r4)
+	.insn rr,0x1a00,%r1,%r2				# ar %r1,%r2
+	.insn rr,0x0400,%r1				# spm %r1
 	.insn rse,0xeb000000000d,%r1,%r2,3(%r4)
 	.insn ssf,0xc80000000000,1(%r2),3(%r4),%r5
diff --git a/opcodes/s390-opc.c b/opcodes/s390-opc.c
index 840f95358921..9b0b5dd3e0b0 100644
--- a/opcodes/s390-opc.c
+++ b/opcodes/s390-opc.c
@@ -809,7 +809,7 @@ const struct s390_opcode s390_opformats[] =
   { "ril_b",OP8(0x00LL), MASK_RIL_RP,	   INSTR_RIL_RP,      3,  2, 256, NULL },
   { "ril_c",OP8(0x00LL), MASK_RIL_UP,	   INSTR_RIL_UP,      3,  2, 256, NULL },
   { "ris",  OP8(0x00LL), MASK_RIS_RURDI,   INSTR_RIS_RURDI,   2,  6, 256, NULL },
-  { "rr",   OP8(0x00LL), MASK_RR_RR,	   INSTR_RR_RR,       3,  0, 256, NULL },
+  { "rr",   OP8(0x00LL), MASK_RR_RR,	   INSTR_RR_RR,       3,  0, 256|1, NULL },
   { "rre",  OP8(0x00LL), MASK_RRE_RR,	   INSTR_RRE_RR,      3,  0, 256, NULL },
   { "rrf",  OP8(0x00LL), MASK_RRF_RURR,	   INSTR_RRF_RURR,    3,  0, 256, NULL },
   { "rrs",  OP8(0x00LL), MASK_RRS_RRRDU,   INSTR_RRS_RRRDU,   2,  6, 256, NULL },
-- 
2.53.0



More information about the Binutils mailing list