[binutils-gdb] s390: Add .insn pseudo-mnemonics rie_a/b/c/d/e/f/g

Jens Remus jremus@sourceware.org
Tue Nov 10 16:49:13 GMT 2026


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

commit 6d72dde111e8ba091f18af39a7032eaa2abe78c7
Author: Jens Remus <jremus@linux.ibm.com>
Date:   Tue Nov 10 17:46:02 2026 +0100

    s390: Add .insn pseudo-mnemonics rie_a/b/c/d/e/f/g
    
    History of instruction format RIE:
    - RIE-e got initially introduced as RIE with IBM z900. [1, 2]
    - RIE-a/b/c and RIE-f got introduced with IBM z10. [3]
    - RIE-d got introduced with IBM z196. [4]
    - RIE-g got introduced with IBM z13. [5]
    
    Note that the assembler does not evaluate or enforce the specified mode
    and minimum architecture/CPU level for .insn pseudo-mnemonics.
    
    [1]: IBM z/Architecture Principles of Operation, SA22-7832-00, IBM z900,
         https://publibfp.dhe.ibm.com/epubs/pdf/dz9zr000.pdf
    
    [2]: IBM z/Architecture Principles of Operation, SA22-7832-01,
         https://publibfp.dhe.ibm.com/epubs/pdf/dz9zr001.pdf
    
    [3]: IBM z/Architecture Principles of Operation, SA22-7832-06, IBM z10,
         https://publibfp.dhe.ibm.com/epubs/pdf/dz9zr006.pdf
    
    [4]: IBM z/Architecture Principles of Operation, SA22-7832-08, IBM z196,
         https://publibfp.dhe.ibm.com/epubs/pdf/dz9zr008.pdf
    
    [5]: IBM z/Architecture Principles of Operation, SA22-7832-10, IBM z13,
         https://publibfp.dhe.ibm.com/epubs/pdf/dz9zr010.pdf
    
    opcodes/
            * s390-opc.c (INSTR_RIE_RRP02, MASK_RIE_RRP02): Define
            instruction format for RIE-e with operands in ascending order.
            (INSTR_RIE_RRU0, MASK_RIE_RRU0): Define instruction format for
            RIE-d with operands in ascending order.
            (INSTR_RIE_RUU0, MASK_RIE_RUU0): Define instruction format for
            RIE-g with operands in ascending order.
            (s390_opformats): Add pseudo-mnemonics rie_a, rie_b, rie_c,
            rie_d, rie_e, rie_f, and rie_g.
    
    gas/
            * doc/c-s390.texi (s390 Formats): Document RIE operand order.
    
    gas/testsuite/
            * gas/s390/zarch-operands.d: Add tests for .insn rie, rie_a,
            rie_b, rie_c, rie_d, rie_e, rie_f, and rie_g.
            * gas/s390/zarch-operands.s: Likewise.
    
    Signed-off-by: Jens Remus <jremus@linux.ibm.com>

Diff:
---
 gas/doc/c-s390.texi                     |  7 +++++++
 gas/testsuite/gas/s390/zarch-operands.d | 15 +++++++++++++++
 gas/testsuite/gas/s390/zarch-operands.s |  9 ++++++++-
 opcodes/s390-opc.c                      | 13 +++++++++++++
 4 files changed, 43 insertions(+), 1 deletion(-)

diff --git a/gas/doc/c-s390.texi b/gas/doc/c-s390.texi
index 9b9c058577b..6a171808e2e 100644
--- a/gas/doc/c-s390.texi
+++ b/gas/doc/c-s390.texi
@@ -409,6 +409,13 @@ as follows:
 .insn ris,0xec00000000fe,R1,I2,M3,D4(B4)
 @end example
 
+The following instruction formats use an operand order that differs from
+the field index order:
+
+@itemize @bullet
+@item RIE (@code{rie}; not RIE-a/b/c/d/e/f/g): @code{R1,R3,RI2}
+@end itemize
+
 An instruction is two, four, or six bytes in length and must be aligned
 on a 2 byte boundary. The first two bits of the instruction specify the
 length of the instruction, 00 indicates a two byte instruction, 01 and 10
diff --git a/gas/testsuite/gas/s390/zarch-operands.d b/gas/testsuite/gas/s390/zarch-operands.d
index a87e852a56a..bca4a0bdb39 100644
--- a/gas/testsuite/gas/s390/zarch-operands.d
+++ b/gas/testsuite/gas/s390/zarch-operands.d
@@ -26,8 +26,23 @@ Disassembly of section .text:
 # RI-c
  *([\da-f]+):	a7 f4 00 00 [	 ]*j	\1 <foo\+0x\1>
 .*: R_390_PC16DBL	test_ri_c\+0x2
+# RIE
  *([\da-f]+):	ec 12 00 00 00 45 [	 ]*brxlg	%r1,%r2,\1 <foo\+0x\1>
 .*: R_390_PC16DBL	test_rie\+0x2
+# RIE-a
+.*:	ec 10 ff ff 70 72 [	 ]*cit	%r1,-1,7
+# RIE-b
+ *([\da-f]+):	ec 12 00 00 70 76 [	 ]*crj	%r1,%r2,7,\1 <foo\+0x\1>
+# RIE-c
+ *([\da-f]+):	ec 17 00 00 ff 7e [	 ]*cij	%r1,-1,7,\1 <foo\+0x\1>
+# RIE-d
+.*:	ec 13 ff ff 00 d8 [	 ]*ahik	%r1,%r3,-1
+# RIE-e
+ *([\da-f]+):	ec 13 00 00 00 44 [	 ]*brxhg	%r1,%r3,\1 <foo\+0x\1>
+# RIE-f
+.*:	ec 12 03 04 05 54 [	 ]*rnsbg	%r1,%r2,3,4,5
+# RIE-g
+.*:	ec 1f ff ff 00 42 [	 ]*lochi	%r1,-1,15
  *([\da-f]+):	c0 e5 00 00 00 00 [	 ]*brasl	%r14,\1 <foo\+0x\1>
 .*: R_390_PC32DBL	test_ril\+0x2
 .*:	eb 12 40 03 00 0d [	 ]*sllg	%r1,%r2,3\(%r4\)
diff --git a/gas/testsuite/gas/s390/zarch-operands.s b/gas/testsuite/gas/s390/zarch-operands.s
index 989d5b37b60..57ec87e610c 100644
--- a/gas/testsuite/gas/s390/zarch-operands.s
+++ b/gas/testsuite/gas/s390/zarch-operands.s
@@ -8,7 +8,14 @@ foo:
 	.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 rie,0xec0000000045,%r1,%r2,test_rie	# brxlg %r1,%r2,test_rie
+	.insn rie_a,0xec0000000072,%r1,-1,7		# cit %r1,-1,7
+	.insn rie_b,0xec0000000076,%r1,%r2,7,.		# crj %r1,%r2,7,.
+	.insn rie_c,0xec000000007e,%r1,-1,7,.		# cij %r1,-1,7,.
+	.insn rie_d,0xec00000000d8,%r1,-1,%r3		# ahik %r1,%r3,-1
+	.insn rie_e,0xec0000000044,%r1,.,%r3		# brxhg %r1,%r3,.
+	.insn rie_f,0xec0000000054,%r1,%r2,3,4,5	# rnsbg %r1,%r2,3,4,5
+	.insn rie_g,0xec0000000042,%r1,-1,15		# lochi %r1,-1,15
 	.insn ril,0xc00500000000,%r14,test_ril
 	.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 19e81bf2ec8..2c6405d2a51 100644
--- a/opcodes/s390-opc.c
+++ b/opcodes/s390-opc.c
@@ -312,7 +312,9 @@ unused_s390_operands_static_asserts (void)
 #define INSTR_RIE_RRP      6, { R_8,R_12,J16_16,0,0,0 }          /* e.g. brxhg */
 #define INSTR_RIE_RRPU     6, { R_8,R_12,U4_32,J16_16,0,0 }      /* e.g. crj   */
 #define INSTR_RIE_RRP0     6, { R_8,R_12,J16_16,0,0,0 }          /* e.g. cgrjne */
+#define INSTR_RIE_RRP02    6, { R_8,J16_16,R_12,0,0,0 }          /* e.g. .insn rie_e */
 #define INSTR_RIE_RRI0     6, { R_8,R_12,I16_16,0,0,0 }          /* e.g. ahik  */
+#define INSTR_RIE_RRU0     6, { R_8,U16_16,R_12,0,0,0 }          /* e.g. .insn rie_d */
 #define INSTR_RIE_RUPI     6, { R_8,I8_32,U4_12,J16_16,0,0 }     /* e.g. cij   */
 #define INSTR_RIE_R0PI     6, { R_8,I8_32,J16_16,0,0,0 }         /* e.g. cijne */
 #define INSTR_RIE_RUPU     6, { R_8,U8_32,U4_12,J16_16,0,0 }     /* e.g. clij  */
@@ -322,6 +324,7 @@ unused_s390_operands_static_asserts (void)
 #define INSTR_RIE_R0UU     6, { R_8,U16_16,U4_32,0,0,0 }         /* e.g. clfit */
 #define INSTR_RIE_R0U0     6, { R_8,U16_16,0,0,0,0 }             /* e.g. clfitne */
 #define INSTR_RIE_RUI0     6, { R_8,I16_16,U4_12,0,0,0 }         /* e.g. lochi */
+#define INSTR_RIE_RUU0     6, { R_8,U16_16,U4_12,0,0,0 }         /* e.g. .insn rie_g */
 #define INSTR_RIE_RRUUU    6, { R_8,R_12,U8_16,U8_24,U8_32,0 }   /* e.g. rnsbg */
 #define INSTR_RIE_RRUUU2   INSTR_RIE_RRUUU                       /* e.g. risbgz */
 #define INSTR_RIE_RRUUU3   INSTR_RIE_RRUUU                       /* e.g. risbhg */
@@ -547,7 +550,9 @@ unused_s390_operands_static_asserts (void)
 #define MASK_RIE_RRP      { 0xff, 0x00, 0x00, 0x00, 0x00, 0xff }
 #define MASK_RIE_RRPU     { 0xff, 0x00, 0x00, 0x00, 0x00, 0xff }
 #define MASK_RIE_RRP0     { 0xff, 0x00, 0x00, 0x00, 0xf0, 0xff }
+#define MASK_RIE_RRP02    { 0xff, 0x00, 0x00, 0x00, 0xf0, 0xff }
 #define MASK_RIE_RRI0     { 0xff, 0x00, 0x00, 0x00, 0xf0, 0xff }
+#define MASK_RIE_RRU0     { 0xff, 0x00, 0x00, 0x00, 0xf0, 0xff }
 #define MASK_RIE_RUPI     { 0xff, 0x00, 0x00, 0x00, 0x00, 0xff }
 #define MASK_RIE_R0PI     { 0xff, 0x0f, 0x00, 0x00, 0x00, 0xff }
 #define MASK_RIE_RUPU     { 0xff, 0x00, 0x00, 0x00, 0x00, 0xff }
@@ -557,6 +562,7 @@ unused_s390_operands_static_asserts (void)
 #define MASK_RIE_R0UU     { 0xff, 0x0f, 0x00, 0x00, 0x0f, 0xff }
 #define MASK_RIE_R0U0     { 0xff, 0x0f, 0x00, 0x00, 0xff, 0xff }
 #define MASK_RIE_RUI0     { 0xff, 0x00, 0x00, 0x00, 0xff, 0xff }
+#define MASK_RIE_RUU0     { 0xff, 0x00, 0x00, 0x00, 0xff, 0xff }
 #define MASK_RIE_RRUUU    { 0xff, 0x00, 0x00, 0x00, 0x00, 0xff }
 #define MASK_RIE_RRUUU2   { 0xff, 0x00, 0x00, 0x80, 0x00, 0xff }
 #define MASK_RIE_RRUUU3   { 0xff, 0x00, 0x00, 0x80, 0x00, 0xff }
@@ -790,6 +796,13 @@ const struct s390_opcode s390_opformats[] =
   { "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 },
+  { "rie_a",OP8(0x00LL), MASK_RIE_R0UU,	   INSTR_RIE_R0UU,    2,  6, 256, NULL },
+  { "rie_b",OP8(0x00LL), MASK_RIE_RRPU,	   INSTR_RIE_RRPU,    2,  6, 256, NULL },
+  { "rie_c",OP8(0x00LL), MASK_RIE_RUPU,	   INSTR_RIE_RUPU,    2,  6, 256, NULL },
+  { "rie_d",OP8(0x00LL), MASK_RIE_RRU0,	   INSTR_RIE_RRU0,    2,  7, 256, NULL },
+  { "rie_e",OP8(0x00LL), MASK_RIE_RRP02,   INSTR_RIE_RRP02,   2,  2, 256, NULL },
+  { "rie_f",OP8(0x00LL), MASK_RIE_RRUUU,   INSTR_RIE_RRUUU,   2,  6, 256, NULL },
+  { "rie_g",OP8(0x00LL), MASK_RIE_RUU0,	   INSTR_RIE_RUU0,    2,  9, 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 },
   { "ris",  OP8(0x00LL), MASK_RIS_RURDI,   INSTR_RIS_RURDI,   2,  6, 256, NULL },


More information about the Binutils-cvs mailing list