[binutils-gdb] s390: Add .insn pseudo-mnemonics rs_a/b
Jens Remus
jremus@sourceware.org
Tue Nov 10 16:49:54 GMT 2026
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ffbfadab211de057fea1925728b55f57f9135849
commit ffbfadab211de057fea1925728b55f57f9135849
Author: Jens Remus <jremus@linux.ibm.com>
Date: Tue Nov 10 17:46:03 2026 +0100
s390: Add .insn pseudo-mnemonics rs_a/b
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 the ESA/390 .insn pseudo-mnemonic test.
opcodes/
* s390-opc.c (INSTR_RS_RRRD2, MASK_RS_RRRD2): Define instruction
format for RS-a with operands in ascending order.
(INSTR_RS_RURD2, MASK_RS_RURD2): Define instruction format for
RS-b with operands in ascending order.
(s390_opformats): Add pseudo-mnemonics rs_a and rs_b.
gas/
* doc/c-s390.texi (s390 Formats): Document RS operand order.
gas/testsuite/
* gas/s390/esa-operands.d (rs): Add comment.
* gas/s390/esa-operands.s (rs): Likewise.
* gas/s390/zarch-operands.d: Add tests for .insn rs, rs_a, and
rs_b.
* gas/s390/zarch-operands.s: Likewise.
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
Diff:
---
gas/doc/c-s390.texi | 1 +
gas/testsuite/gas/s390/esa-operands.d | 1 +
gas/testsuite/gas/s390/esa-operands.s | 2 +-
gas/testsuite/gas/s390/zarch-operands.d | 7 +++++++
gas/testsuite/gas/s390/zarch-operands.s | 4 ++++
opcodes/s390-opc.c | 6 ++++++
6 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/gas/doc/c-s390.texi b/gas/doc/c-s390.texi
index 0a918969d42..f9ae74de644 100644
--- a/gas/doc/c-s390.texi
+++ b/gas/doc/c-s390.texi
@@ -424,6 +424,7 @@ a @emph{Programming Note} of the Principles of Operation manual:
@item RRF-d (@code{rrf_d}): @code{R1,R2,M4}
@item RRF-e (@code{rrf_e}): @code{R1,M3,R2[,M4]}
@end itemize
+@item RS (@code{rs}; not RS-a/b): @code{R1,R3,D2(B2)}
@end itemize
An instruction is two, four, or six bytes in length and must be aligned
diff --git a/gas/testsuite/gas/s390/esa-operands.d b/gas/testsuite/gas/s390/esa-operands.d
index b9752261ccd..e35a3f7b790 100644
--- a/gas/testsuite/gas/s390/esa-operands.d
+++ b/gas/testsuite/gas/s390/esa-operands.d
@@ -18,6 +18,7 @@ Disassembly of section .text:
.*: b2 5e 00 12 [ ]*srst %r1,%r2
# RRF
.*: b3 5b 34 12 [ ]*didbr %f1,%f3,%f2,4
+# RS
.*: ba 12 40 03 [ ]*cs %r1,%r2,3\(%r4\)
*([\da-f]+): 84 12 00 00 [ ]*brxh %r1,%r2,\1 <foo\+0x\1>
.*: R_390_PC16DBL test_rsi\+0x2
diff --git a/gas/testsuite/gas/s390/esa-operands.s b/gas/testsuite/gas/s390/esa-operands.s
index 14307b98b58..264f4ad14a5 100644
--- a/gas/testsuite/gas/s390/esa-operands.s
+++ b/gas/testsuite/gas/s390/esa-operands.s
@@ -6,7 +6,7 @@ foo:
.insn rr,0x1800,%r1,%r2 # lr %r1,%r2
.insn rre,0xb25e0000,%r1,%r2 # srst %r1,%r2
.insn rrf,0xb35b0000,%f1,%f2,%f3,4 # didbr %f1,%f3,%f2,4
- .insn rs,0xba000000,%r1,%r2,3(%r4)
+ .insn rs,0xba000000,%r1,%r2,3(%r4) # cs %r1,%r2,3(%r4)
.insn rsi,0x84000000,%r1,%r2,test_rsi
.insn rx,0x58000000,%r1,2(%r3,%r4)
.insn rxe,0xed000000001a,%f1,2(%r3)
diff --git a/gas/testsuite/gas/s390/zarch-operands.d b/gas/testsuite/gas/s390/zarch-operands.d
index f8bc693f9c5..9f2b90a4e43 100644
--- a/gas/testsuite/gas/s390/zarch-operands.d
+++ b/gas/testsuite/gas/s390/zarch-operands.d
@@ -83,6 +83,13 @@ Disassembly of section .text:
.*: b3 a6 34 12 [ ]*cxgbra %f1,3,%r2,4
# RRS
.*: ec 12 41 bc 30 f6 [ ]*crb %r1,%r2,3,444\(%r4\)
+# RS
+.*: ba 12 31 4d [ ]*cs %r1,%r2,333\(%r3\)
+# RS-a
+.*: 86 13 20 de [ ]*bxh %r1,%r3,222\(%r2\)
+.*: 8f 10 20 de [ ]*slda %r1,222\(%r2\)
+# RS-b
+.*: bd 13 20 de [ ]*clm %r1,3,222\(%r2\)
.*: 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 3fb8e21eb68..25970a5f65c 100644
--- a/gas/testsuite/gas/s390/zarch-operands.s
+++ b/gas/testsuite/gas/s390/zarch-operands.s
@@ -40,5 +40,9 @@ foo:
.insn rrf_e,0xb3ca0000,%r1,3,%f2 # cgxr %r1,3,%f2
.insn rrf_e,0xb3a60000,%f1,3,%r2,4 # cxgbra %f1,3,%r2,4
.insn rrs,0xec00000000f6,%r1,%r2,3,444(%r4) # crb %r1,%r2,3,444(%r4)
+ .insn rs,0xba000000,%r1,%r2,333(%r3) # cs %r1,%r2,333(%r3)
+ .insn rs_a,0x86000000,%r1,222(%r2),%r3 # bxh %r1,%r3,222(%r2)
+ .insn rs_a,0x8f000000,%r1,222(%r2) # slda %r1,222(%r2)
+ .insn rs_b,0xbd000000,%r1,222(%r2),3 # clm %r1,3,222(%r2)
.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 dea544b3747..586fef971ad 100644
--- a/opcodes/s390-opc.c
+++ b/opcodes/s390-opc.c
@@ -438,8 +438,10 @@ unused_s390_operands_static_asserts (void)
#define INSTR_RS_R0RD 4, { R_8,D_20,B_16,0,0,0 } /* e.g. sll */
#define INSTR_RS_RE0RD 4, { RE_8,D_20,B_16,0,0,0 } /* e.g. slda */
#define INSTR_RS_RRRD 4, { R_8,R_12,D_20,B_16,0,0 } /* e.g. cs */
+#define INSTR_RS_RRRD2 4, { R_8,D_20,B_16,R_12,0,0 } /* e.g. .insn rs_a */
#define INSTR_RS_RERERD 4, { RE_8,RE_12,D_20,B_16,0,0 } /* e.g. cds */
#define INSTR_RS_RURD 4, { R_8,U4_12,D_20,B_16,0,0 } /* e.g. icm */
+#define INSTR_RS_RURD2 4, { R_8,D_20,B_16,U4_12,0,0 } /* e.g. .insn rs_b */
#define INSTR_RXE_FRRD 6, { F_8,D_20,X_12,B_16,0,0 } /* e.g. adb */
#define INSTR_RXE_FERRD 6, { FE_8,D_20,X_12,B_16,0,0 } /* e.g. lxdb */
#define INSTR_RXE_RRRD 6, { R_8,D_20,X_12,B_16,0,0 } /* e.g. lg */
@@ -672,8 +674,10 @@ unused_s390_operands_static_asserts (void)
#define MASK_RS_R0RD { 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00 }
#define MASK_RS_RE0RD { 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00 }
#define MASK_RS_RRRD { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 }
+#define MASK_RS_RRRD2 { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 }
#define MASK_RS_RERERD { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 }
#define MASK_RS_RURD { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 }
+#define MASK_RS_RURD2 { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 }
#define MASK_RSY_RRRD { 0xff, 0x00, 0x00, 0x00, 0x00, 0xff }
#define MASK_RSY_RERERD { 0xff, 0x00, 0x00, 0x00, 0x00, 0xff }
#define MASK_RSY_RURD { 0xff, 0x00, 0x00, 0x00, 0x00, 0xff }
@@ -826,6 +830,8 @@ const struct s390_opcode s390_opformats[] =
{ "rrf_e",OP8(0x00LL), MASK_RRF_UURR, INSTR_RRF_UURR, 3, 0, 256|1, 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 },
+ { "rs_a", OP8(0x00LL), MASK_RS_RRRD2, INSTR_RS_RRRD2, 3, 0, 256|1, NULL },
+ { "rs_b", OP8(0x00LL), MASK_RS_RURD2, INSTR_RS_RURD2, 3, 0, 256, NULL },
{ "rse", OP8(0x00LL), MASK_RSE_RRRD, INSTR_RSE_RRRD, 3, 0, 256, NULL },
{ "rsi", OP8(0x00LL), MASK_RSI_RRP, INSTR_RSI_RRP, 3, 0, 256, NULL },
{ "rsy", OP8(0x00LL), MASK_RSY_RRRD, INSTR_RSY_RRRD, 3, 3, 256, NULL },
More information about the Binutils-cvs
mailing list