[PATCH v2 22/47] s390: Make R1 and R2 operands optional in .insn pseudo-mnemonic rre

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


The RRE instruction format has optional R1 and R2 fields.  Make the R1
and R2 operands in the .insn pseudo-mnemonic rre optional.

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

opcodes/
	* s390-opc.c (s390_opformats): Make R1 and R2 operands optional
	in pseudo-mnemonic rre.

gas/
	* doc/c-s390.texi (s390 Formats): Document RRE operands R1 and
	R2 as optional.

gas/testsuite/
	* gas/s390/esa-operands.d (rre): Add comment.
	* gas/s390/esa-operands.s (rre): Likewise.
	* gas/s390/zarch-operands.d: Add test for .insn rre.
	* 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 | 4 ++++
 gas/testsuite/gas/s390/zarch-operands.s | 3 +++
 opcodes/s390-opc.c                      | 2 +-
 6 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/gas/doc/c-s390.texi b/gas/doc/c-s390.texi
index 5505f005d673..1b5cc98fe3c2 100644
--- a/gas/doc/c-s390.texi
+++ b/gas/doc/c-s390.texi
@@ -533,7 +533,7 @@ with the @samp{.insn} pseudo directive:
 0                   16   20   24   28  31
 @end verbatim
 
-@item RRE format: <insn> R1,R2
+@item RRE 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 f62b05321fc0..65bd9ed12ae8 100644
--- a/gas/testsuite/gas/s390/esa-operands.d
+++ b/gas/testsuite/gas/s390/esa-operands.d
@@ -14,6 +14,7 @@ Disassembly of section .text:
 .*:	a7 1a 80 01 [	 ]*ahi	%r1,-32767
 # RR
 .*:	18 12 [	 ]*lr	%r1,%r2
+# RRE
 .*:	b2 5e 00 12 [	 ]*srst	%r1,%r2
 .*:	b3 5b 93 12 [	 ]*didbr	%f1,%f9,%f2,3
 .*:	ba 12 40 03 [	 ]*cs	%r1,%r2,3\(%r4\)
diff --git a/gas/testsuite/gas/s390/esa-operands.s b/gas/testsuite/gas/s390/esa-operands.s
index 077b2de02ad4..3ff7fb7745fe 100644
--- a/gas/testsuite/gas/s390/esa-operands.s
+++ b/gas/testsuite/gas/s390/esa-operands.s
@@ -4,7 +4,7 @@ foo:
 	.insn i,0x0a00,1				# svc 1
 	.insn ri,0xa70a0000,%r1,-32767			# ahi %r1,-32767
 	.insn rr,0x1800,%r1,%r2				# lr %r1,%r2
-	.insn rre,0xb25e0000,%r1,%r2
+	.insn rre,0xb25e0000,%r1,%r2			# srst %r1,%r2
 	.insn rrf,0xb35b0000,%f1,%f2,9,%f3
 	.insn rs,0xba000000,%r1,%r2,3(%r4)
 	.insn rsi,0x84000000,%r1,%r2,test_rsi
diff --git a/gas/testsuite/gas/s390/zarch-operands.d b/gas/testsuite/gas/s390/zarch-operands.d
index 72fa45ba0ba0..89c50781c6d8 100644
--- a/gas/testsuite/gas/s390/zarch-operands.d
+++ b/gas/testsuite/gas/s390/zarch-operands.d
@@ -60,6 +60,10 @@ Disassembly of section .text:
 .*:	04 10 [	 ]*spm	%r1
 # RRD
 .*:	b3 2e 10 32 [	 ]*maer	%f1,%f3,%f2
+# RRE
+.*:	b9 08 00 12 [	 ]*agr	%r1,%r2
+.*:	b2 22 00 10 [	 ]*ipm	%r1
+.*:	b2 48 00 00 [	 ]*palb
 .*:	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 767454428654..944422c9c1a8 100644
--- a/gas/testsuite/gas/s390/zarch-operands.s
+++ b/gas/testsuite/gas/s390/zarch-operands.s
@@ -25,5 +25,8 @@ foo:
 	.insn rr,0x1a00,%r1,%r2				# ar %r1,%r2
 	.insn rr,0x0400,%r1				# spm %r1
 	.insn rrd,0xb32e0000,%f1,%f2,%f3		# maer %f1,%f3,%f2
+	.insn rre,0xb9080000,%r1,%r2			# agr %r1,%r2
+	.insn rre,0xb2220000,%r1			# ipm %r1
+	.insn rre,0xb2480000				# palb
 	.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 eee7c6362763..e716c7398d79 100644
--- a/opcodes/s390-opc.c
+++ b/opcodes/s390-opc.c
@@ -813,7 +813,7 @@ const struct s390_opcode s390_opformats[] =
   { "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|1, NULL },
   { "rrd",  OP8(0x00LL), MASK_RRD_R0RR,	   INSTR_RRD_R0RR,    3,  0, 256, NULL },
-  { "rre",  OP8(0x00LL), MASK_RRE_RR,	   INSTR_RRE_RR,      3,  0, 256, NULL },
+  { "rre",  OP8(0x00LL), MASK_RRE_RR,	   INSTR_RRE_RR,      3,  0, 256|2, 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 },
   { "rs",   OP8(0x00LL), MASK_RS_RRRD,	   INSTR_RS_RRRD,     3,  0, 256, NULL },
-- 
2.53.0



More information about the Binutils mailing list