[PATCH v2 16/47] s390: Add .insn pseudo-mnemonics ri_a/b/c

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


Instruction format RI, including its variants RI-a/b/c, predate
IBM z900.  Therefore use the mode and minimum architecture/CPU level
of .insn ri for all variants.

Note that the assembler does not evaluate or enforce the specified mode
and minimum architecture/CPU level for .insn pseudo-mnemonics.

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

opcodes/
	* s390-opc.c (s390_opformats): Add pseudo-mnemonics ri_a, ri_b,
	and ri_c.

gas/testsuite/
	* gas/s390/esa-operands.d (ri): Add comment.
	* gas/s390/esa-operands.s (ri): Likewise.
	* gas/s390/zarch-operands.d: Add tests for .insn ri, ri_a, ri_b,
	and ri_c.
	* gas/s390/zarch-operands.s: Likewise.

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
---

Notes (jremus):
    Changes in v2:
    - Reword commit message.

 gas/testsuite/gas/s390/esa-operands.d   |  1 +
 gas/testsuite/gas/s390/esa-operands.s   |  2 +-
 gas/testsuite/gas/s390/zarch-operands.d | 10 ++++++++++
 gas/testsuite/gas/s390/zarch-operands.s |  4 ++++
 opcodes/s390-opc.c                      |  3 +++
 5 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/gas/testsuite/gas/s390/esa-operands.d b/gas/testsuite/gas/s390/esa-operands.d
index ba1f6e035905..40be3571502f 100644
--- a/gas/testsuite/gas/s390/esa-operands.d
+++ b/gas/testsuite/gas/s390/esa-operands.d
@@ -10,6 +10,7 @@ Disassembly of section .text:
 .*:	01 01 [	 ]*pr
 # I
 .*:	0a 01 [	 ]*svc	1
+# RI
 .*:	a7 1a 80 01 [	 ]*ahi	%r1,-32767
 .*:	18 12 [	 ]*lr	%r1,%r2
 .*:	b2 5e 00 12 [	 ]*srst	%r1,%r2
diff --git a/gas/testsuite/gas/s390/esa-operands.s b/gas/testsuite/gas/s390/esa-operands.s
index 8169852b3116..6bdd4b7a9e10 100644
--- a/gas/testsuite/gas/s390/esa-operands.s
+++ b/gas/testsuite/gas/s390/esa-operands.s
@@ -2,7 +2,7 @@
 foo:
 	.insn e,0x0101					# pr
 	.insn i,0x0a00,1				# svc 1
-	.insn ri,0xa70a0000,%r1,-32767
+	.insn ri,0xa70a0000,%r1,-32767			# ahi %r1,-32767
 	.insn rr,0x1800,%r1,%r2
 	.insn rre,0xb25e0000,%r1,%r2
 	.insn rrf,0xb35b0000,%f1,%f2,9,%f3
diff --git a/gas/testsuite/gas/s390/zarch-operands.d b/gas/testsuite/gas/s390/zarch-operands.d
index 60fe39e55b7c..a87e852a56a2 100644
--- a/gas/testsuite/gas/s390/zarch-operands.d
+++ b/gas/testsuite/gas/s390/zarch-operands.d
@@ -16,6 +16,16 @@ Disassembly of section .text:
  *([\da-f]+):	c5 10 00 00 00 00 [	 ]*bprp	1,\1 <foo\+0x\1>,\1 <foo\+0x\1>
 .*: R_390_PC12DBL	test_mii\+0x1
 .*: R_390_PC24DBL	test_mii\+0x3
+# RI
+.*:	a7 1a 00 01 [	 ]*ahi	%r1,1
+# RI-a
+.*:	a7 1a ff ff [	 ]*ahi	%r1,-1
+# RI-b
+ *([\da-f]+):	a7 16 00 00 [	 ]*brct	%r1,\1 <foo\+0x\1>
+.*: R_390_PC16DBL	test_ri_b\+0x2
+# RI-c
+ *([\da-f]+):	a7 f4 00 00 [	 ]*j	\1 <foo\+0x\1>
+.*: R_390_PC16DBL	test_ri_c\+0x2
  *([\da-f]+):	ec 12 00 00 00 45 [	 ]*brxlg	%r1,%r2,\1 <foo\+0x\1>
 .*: R_390_PC16DBL	test_rie\+0x2
  *([\da-f]+):	c0 e5 00 00 00 00 [	 ]*brasl	%r14,\1 <foo\+0x\1>
diff --git a/gas/testsuite/gas/s390/zarch-operands.s b/gas/testsuite/gas/s390/zarch-operands.s
index e2439f5a8a6f..989d5b37b60e 100644
--- a/gas/testsuite/gas/s390/zarch-operands.s
+++ b/gas/testsuite/gas/s390/zarch-operands.s
@@ -4,6 +4,10 @@ foo:
 	.insn i,0x0a00,1				# svc 1
 	.insn ie,0xb2fa0000,1,2				# niai 1,2
 	.insn mii,0xc50000000000,1,test_mii,test_mii	# bprp 1,test_mii,test_mii
+	.insn ri,0xa70a0000,%r1,1			# ahi %r1,1
+	.insn ri_a,0xa70a0000,%r1,-1			# ahi %r1,-1
+	.insn ri_b,0xa7060000,%r1,test_ri_b		# brct %r1,test_ri_b
+	.insn ri_c,0xa7040000,15,test_ri_c		# brc 15,test_ri_c
 	.insn rie,0xec0000000045,%r1,%r2,test_rie
 	.insn ril,0xc00500000000,%r14,test_ril
 	.insn rse,0xeb000000000d,%r1,%r2,3(%r4)
diff --git a/opcodes/s390-opc.c b/opcodes/s390-opc.c
index 839f43de69d2..19e81bf2ec84 100644
--- a/opcodes/s390-opc.c
+++ b/opcodes/s390-opc.c
@@ -786,6 +786,9 @@ const struct s390_opcode s390_opformats[] =
   { "ie",   OP8(0x00LL), MASK_IE_UU,	   INSTR_IE_UU,	      2,  8, 256, NULL },
   { "mii",  OP8(0x00LL), MASK_MII_UPP,	   INSTR_MII_UPP,     2,  8, 256, NULL },
   { "ri",   OP8(0x00LL), MASK_RI_RI,	   INSTR_RI_RI,	      3,  0, 256, NULL },
+  { "ri_a", OP8(0x00LL), MASK_RI_RU,	   INSTR_RI_RU,	      3,  0, 256, NULL },
+  { "ri_b", OP8(0x00LL), MASK_RI_RP,	   INSTR_RI_RP,	      3,  0, 256, NULL },
+  { "ri_c", OP8(0x00LL), MASK_RI_UP,	   INSTR_RI_UP,	      3,  0, 256, NULL },
   { "rie",  OP8(0x00LL), MASK_RIE_RRP,	   INSTR_RIE_RRP,     2,  2, 256, NULL },
   { "ril",  OP8(0x00LL), MASK_RIL_RP,	   INSTR_RIL_RP,      3,  2, 256, NULL },
   { "rilu", OP8(0x00LL), MASK_RIL_RU,	   INSTR_RIL_RU,      2,  4, 256, NULL },
-- 
2.53.0



More information about the Binutils mailing list