[PATCH v2 23/47] s390: Add .insn pseudo-mnemonics rrf_a/b/c/d/e
Jens Remus
jremus@linux.ibm.com
Fri Nov 6 15:57:13 GMT 2026
Note that pseudo-mnemonics rrf_a/b/c/d/e are special. This is
because instruction format RRF is the only format where the
specification explicitly defines an operand order as well as optional
operands in a programming note. Add a note to the documentation.
Instruction format RRF, including the variants RRF-a/b/c/d/e, predate
IBM z900. They later got extended with an optional M4 mask field.
Therefore do not specify a minimum architecture/CPU level.
Note that the assembler does not evaluate or enforce the specified mode
and minimum architecture/CPU level for .insn pseudo-mnemonics.
While at it fix the operands in the ESA/390 .insn rrf test and add a
z/Architecture test for .insn rrf.
opcodes/
* s390-opc.c (INSTR_RRF_0URR, MASK_RRF_0URR): Define
instruction format for RRF-d with operands in order according
to specification.
(INSTR_RRF_UURR, MASK_RRF_UURR): Define instruction format for
RRF-e with operands in order according to specification.
(s390_opformats): Add pseudo-mnemonics rrf_a, rrf_b, rrf_c,
rrf_d, and rrf_e with optional operands according to
specification.
gas/
* doc/c-s390.texi (s390 Formats): Document RRF-a/b/c/d/e
operand order.
gas/testsuite/
* gas/s390/esa-operands.d (rrf): Fix operands in test. Add
comment.
* gas/s390/esa-operands.s (rrf): Likewise.
* gas/s390/zarch-operands.d: Add tests for .insn rrf, rrf_a,
rrf_b, rrf_c, rrf_d, and rrf_e.
* gas/s390/zarch-operands.s: Likewise.
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
---
Notes (jremus):
Changes in v2:
- Correct RRF-d documentation to have no optional operand. (Andreas)
- Reword commit message.
gas/doc/c-s390.texi | 10 ++++++++++
gas/testsuite/gas/s390/esa-operands.d | 3 ++-
gas/testsuite/gas/s390/esa-operands.s | 2 +-
gas/testsuite/gas/s390/zarch-operands.d | 17 +++++++++++++++++
gas/testsuite/gas/s390/zarch-operands.s | 11 +++++++++++
opcodes/s390-opc.c | 9 +++++++++
6 files changed, 50 insertions(+), 2 deletions(-)
diff --git a/gas/doc/c-s390.texi b/gas/doc/c-s390.texi
index 1b5cc98fe3c2..0a918969d421 100644
--- a/gas/doc/c-s390.texi
+++ b/gas/doc/c-s390.texi
@@ -414,6 +414,16 @@ the field index order:
@itemize @bullet
@item RIE (@code{rie}; not RIE-a/b/c/d/e/f/g): @code{R1,R3,RI2}
+@item RRF-a/b/c/d/e (@code{rrf_a/b/c/d/e}):
+The operand order of instruction formats RRF-a/b/c/d/e is documented in
+a @emph{Programming Note} of the Principles of Operation manual:
+ @itemize @minus
+ @item RRF-a (@code{rrf_a}): @code{R1,R2[,R3[,M4]]}
+ @item RRF-b (@code{rrf_b}): @code{R1,R3,R2[,M4]}
+ @item RRF-c (@code{rrf_c}): @code{R1,R2[,M3]}
+ @item RRF-d (@code{rrf_d}): @code{R1,R2,M4}
+ @item RRF-e (@code{rrf_e}): @code{R1,M3,R2[,M4]}
+ @end itemize
@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 65bd9ed12ae8..b9752261ccd6 100644
--- a/gas/testsuite/gas/s390/esa-operands.d
+++ b/gas/testsuite/gas/s390/esa-operands.d
@@ -16,7 +16,8 @@ Disassembly of section .text:
.*: 18 12 [ ]*lr %r1,%r2
# RRE
.*: b2 5e 00 12 [ ]*srst %r1,%r2
-.*: b3 5b 93 12 [ ]*didbr %f1,%f9,%f2,3
+# RRF
+.*: b3 5b 34 12 [ ]*didbr %f1,%f3,%f2,4
.*: 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 3ff7fb7745fe..14307b98b584 100644
--- a/gas/testsuite/gas/s390/esa-operands.s
+++ b/gas/testsuite/gas/s390/esa-operands.s
@@ -5,7 +5,7 @@ foo:
.insn ri,0xa70a0000,%r1,-32767 # ahi %r1,-32767
.insn rr,0x1800,%r1,%r2 # lr %r1,%r2
.insn rre,0xb25e0000,%r1,%r2 # srst %r1,%r2
- .insn rrf,0xb35b0000,%f1,%f2,9,%f3
+ .insn rrf,0xb35b0000,%f1,%f2,%f3,4 # didbr %f1,%f3,%f2,4
.insn rs,0xba000000,%r1,%r2,3(%r4)
.insn rsi,0x84000000,%r1,%r2,test_rsi
.insn rx,0x58000000,%r1,2(%r3,%r4)
diff --git a/gas/testsuite/gas/s390/zarch-operands.d b/gas/testsuite/gas/s390/zarch-operands.d
index 89c50781c6d8..32614f4e631e 100644
--- a/gas/testsuite/gas/s390/zarch-operands.d
+++ b/gas/testsuite/gas/s390/zarch-operands.d
@@ -64,6 +64,23 @@ Disassembly of section .text:
.*: b9 08 00 12 [ ]*agr %r1,%r2
.*: b2 22 00 10 [ ]*ipm %r1
.*: b2 48 00 00 [ ]*palb
+# RRF
+.*: b3 5b 34 12 [ ]*didbr %f1,%f3,%f2,4
+# RRF-a
+.*: b2 21 00 12 [ ]*ipte %r1,%r2
+.*: b2 21 30 12 [ ]*ipte %r1,%r2,%r3
+.*: b2 21 34 12 [ ]*ipte %r1,%r2,%r3,4
+# RRF-b
+.*: b9 8e 30 12 [ ]*idte %r1,%r3,%r2
+.*: b9 8e 34 12 [ ]*idte %r1,%r3,%r2,4
+# RRF-c
+.*: b9 e1 00 12 [ ]*popcnt %r1,%r2
+.*: b9 e1 30 12 [ ]*popcnt %r1,%r2,3
+# RRF-d
+.*: b3 dc 04 12 [ ]*lxdtr %f1,%f2,4
+# RRF-e
+.*: b3 ca 30 12 [ ]*cgxr %r1,3,%f2
+.*: b3 a6 34 12 [ ]*cxgbra %f1,3,%r2,4
.*: 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 944422c9c1a8..761f03718151 100644
--- a/gas/testsuite/gas/s390/zarch-operands.s
+++ b/gas/testsuite/gas/s390/zarch-operands.s
@@ -28,5 +28,16 @@ foo:
.insn rre,0xb9080000,%r1,%r2 # agr %r1,%r2
.insn rre,0xb2220000,%r1 # ipm %r1
.insn rre,0xb2480000 # palb
+ .insn rrf,0xb35b0000,%f1,%f2,%f3,4 # didbr %f1,%f3,%f2,4
+ .insn rrf_a,0xb2210000,%r1,%r2 # ipte %r1,%r2
+ .insn rrf_a,0xb2210000,%r1,%r2,%r3 # ipte %r1,%r2,%r3
+ .insn rrf_a,0xb2210000,%r1,%r2,%r3,4 # ipte %r1,%r2,%r3,4
+ .insn rrf_b,0xb98e0000,%r1,%r3,%r2 # idte %r1,%r3,%r2
+ .insn rrf_b,0xb98e0000,%r1,%r3,%r2,4 # idte %r1,%r3,%r2,4
+ .insn rrf_c,0xb9e10000,%r1,%r2 # popcnt %r1,%r2
+ .insn rrf_c,0xb9e10000,%r1,%r2,3 # popcnt %r1,%r2,3
+ .insn rrf_d,0xb3dc0000,%f1,%f2,4 # lxdtr %f1,%f2,4
+ .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 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 e716c7398d79..dea544b3747b 100644
--- a/opcodes/s390-opc.c
+++ b/opcodes/s390-opc.c
@@ -399,11 +399,13 @@ unused_s390_operands_static_asserts (void)
#define INSTR_RRF_U0RERE 4, { RE_24,RE_28,U4_16,0,0,0 } /* e.g. cu24 */
#define INSTR_RRF_00RR 4, { R_24,R_28,0,0,0,0 } /* e.g. clrtne */
#define INSTR_RRF_0URF 4, { R_24,F_28,U4_20,0,0,0 } /* e.g. csdtr */
+#define INSTR_RRF_0URR 4, { R_24,R_28,U4_20,0,0,0 } /* e.g. .insn rrf_d */
#define INSTR_RRF_0UREFE 4, { RE_24,FE_28,U4_20,0,0,0 } /* e.g. csxtr */
#define INSTR_RRF_UUFR 4, { F_24,U4_16,R_28,U4_20,0,0 } /* e.g. cdgtra */
#define INSTR_RRF_UUFER 4, { FE_24,U4_16,R_28,U4_20,0,0 } /* e.g. cxfbra */
#define INSTR_RRF_UURF 4, { R_24,U4_16,F_28,U4_20,0,0 } /* e.g. cgdtra */
#define INSTR_RRF_UURFE 4, { R_24,U4_16,FE_28,U4_20,0,0 } /* e.g. cfxbra */
+#define INSTR_RRF_UURR 4, { R_24,U4_16,R_28,U4_20,0,0 } /* e.g. .insn rrf_e */
#define INSTR_RR_0R 2, { R_12, 0,0,0,0,0 } /* e.g. br */
#define INSTR_RR_FF 2, { F_8,F_12,0,0,0,0 } /* e.g. adr */
#define INSTR_RR_FEF 2, { FE_8,F_12,0,0,0,0 } /* e.g. mxdr */
@@ -638,11 +640,13 @@ unused_s390_operands_static_asserts (void)
#define MASK_RRF_U0RERE { 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00 }
#define MASK_RRF_00RR { 0xff, 0xff, 0xff, 0x00, 0x00, 0x00 }
#define MASK_RRF_0URF { 0xff, 0xff, 0xf0, 0x00, 0x00, 0x00 }
+#define MASK_RRF_0URR { 0xff, 0xff, 0xf0, 0x00, 0x00, 0x00 }
#define MASK_RRF_0UREFE { 0xff, 0xff, 0xf0, 0x00, 0x00, 0x00 }
#define MASK_RRF_UUFR { 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 }
#define MASK_RRF_UUFER { 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 }
#define MASK_RRF_UURF { 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 }
#define MASK_RRF_UURFE { 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 }
+#define MASK_RRF_UURR { 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 }
#define MASK_RR_0R { 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00 }
#define MASK_RR_FF { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 }
#define MASK_RR_FEF { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 }
@@ -815,6 +819,11 @@ const struct s390_opcode s390_opformats[] =
{ "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|2, NULL },
{ "rrf", OP8(0x00LL), MASK_RRF_RURR, INSTR_RRF_RURR, 3, 0, 256, NULL },
+ { "rrf_a",OP8(0x00LL), MASK_RRF_RURR, INSTR_RRF_RURR, 3, 0, 256|2, NULL },
+ { "rrf_b",OP8(0x00LL), MASK_RRF_RURR2, INSTR_RRF_RURR2, 3, 0, 256|1, NULL },
+ { "rrf_c",OP8(0x00LL), MASK_RRF_U0RR, INSTR_RRF_U0RR, 3, 0, 256|1, NULL },
+ { "rrf_d",OP8(0x00LL), MASK_RRF_0URR, INSTR_RRF_0URR, 3, 0, 256, NULL },
+ { "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 },
{ "rse", OP8(0x00LL), MASK_RSE_RRRD, INSTR_RSE_RRRD, 3, 0, 256, NULL },
--
2.53.0
More information about the Binutils
mailing list