[PATCH v2 44/47] s390: Add .insn pseudo-mnemonics vrs_a/b/c/d

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


History of instruction format VRS:
- VRS-a/b/c got initially introduced with IBM z13. [1]
- VRS-d got introduced with IBM z14. [2]

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-10, IBM z13,
     https://publibfp.dhe.ibm.com/epubs/pdf/dz9zr010.pdf

[2]: IBM z/Architecture Principles of Operation, SA22-7832-11, IBM z14,
     https://publibfp.dhe.ibm.com/epubs/pdf/dz9zr011.pdf

opcodes/
	* s390-opc.c (INSTR_VRS_VVRDU2, MASK_VRS_VVRDU2): Define
	instruction format for VRS-a with operands in ascending order.
	(INSTR_VRS_VRRDU2, MASK_VRS_VRRDU2): Likewise for VRS-b.
	(INSTR_VRS_RVRDU2, MASK_VRS_RVRDU2): Likewise for VRS-c.
	(INSTR_VRS_RRDV2, MASK_VRS_RRDV2): Likewise for VRS-d.
	(s390_opformats): Add pseudo-mnemonics vrs_a, vrs_b, vrs_c, and
	vrs_d.

gas/
	* doc/c-s390.texi (s390 Formats): Document VRS operand order.

gas/testsuite/
	* gas/s390/zarch-operands.d: Add tests for .insn vrs_a, vrs_b,
	vrs_c, and vrs_d.
	* gas/s390/zarch-operands.s: Likewise.

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

Notes (jremus):
    Changes in v2:
    - Correct vrs_a/b/c/d mode to z/Architecture (2). (Andreas)
    - Reword commit message to no longer claim the minimum architecture/CPU
      level would be enforced. (Andreas)

 gas/doc/c-s390.texi                     |  1 +
 gas/testsuite/gas/s390/zarch-operands.d | 10 ++++++++++
 gas/testsuite/gas/s390/zarch-operands.s |  6 ++++++
 opcodes/s390-opc.c                      | 14 ++++++++++++--
 4 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/gas/doc/c-s390.texi b/gas/doc/c-s390.texi
index 70ba2bd49dac..5848be3fe0d0 100644
--- a/gas/doc/c-s390.texi
+++ b/gas/doc/c-s390.texi
@@ -429,6 +429,7 @@ a @emph{Programming Note} of the Principles of Operation manual:
 @item RSI (@code{rsi}): @code{R1,R3,RI2}
 @item RSY (@code{rsy}; not RSY-a/b): @code{R1,R3,D2(B2)}
 @item RXF (@code{rxf}): @code{R1,R3,D2(X2,B2)}
+@item VRS (@code{vrs}; not VRS-a/b/c/d): @code{R1,V3,D2(B2),M4}
 @end itemize
 
 An instruction is two, four, or six bytes in length and must be aligned
diff --git a/gas/testsuite/gas/s390/zarch-operands.d b/gas/testsuite/gas/s390/zarch-operands.d
index 556570205c71..411fd7ce0034 100644
--- a/gas/testsuite/gas/s390/zarch-operands.d
+++ b/gas/testsuite/gas/s390/zarch-operands.d
@@ -217,4 +217,14 @@ Disassembly of section .text:
 .*:	e6 12 30 40 00 7d [	 ]*vcsph	%v1,%v2,%v3,4
 # VRR-k
 .*:	e6 12 00 30 00 4e [	 ]*vcvbq	%v1,%v2,3
+# VRS-a
+.*:	e7 13 20 de 40 36 [	 ]*vlm	%v1,%v3,222\(%r2\),4
+.*:	e7 13 20 de 00 36 [	 ]*vlm	%v1,%v3,222\(%r2\)
+# VRS-b
+.*:	e7 13 20 de 40 22 [	 ]*vlvg	%v1,%r3,222\(%r2\),4
+.*:	e7 13 20 de 00 22 [	 ]*vlvgb	%v1,%r3,222\(%r2\)
+# VRS-c
+.*:	e7 13 20 de 40 21 [	 ]*vlgv	%r1,%v3,222\(%r2\),4
+# VRS-d
+.*:	e6 03 20 de 10 37 [	 ]*vlrlr	%v1,%r3,222\(%r2\)
 #?.*:	07 07 [	 ]*nopr	%r7
diff --git a/gas/testsuite/gas/s390/zarch-operands.s b/gas/testsuite/gas/s390/zarch-operands.s
index 18867896e7d7..37bb12d1a34e 100644
--- a/gas/testsuite/gas/s390/zarch-operands.s
+++ b/gas/testsuite/gas/s390/zarch-operands.s
@@ -118,3 +118,9 @@ foo:
 	.insn vrr_i,0xe60000000050,%r1,%v2,3		# vcvb %r1,%v2,3
 	.insn vrr_j,0xe6000000007d,%v1,%v2,%v3,4	# vcsph %v1,%v2,%v3,4
 	.insn vrr_k,0xe6000000004e,%v1,%v2,3		# vcvbq %v1,%v2,3
+	.insn vrs_a,0xe70000000036,%v1,222(%r2),%v3,4	# vlm %v1,%v3,222(%r2),4
+	.insn vrs_a,0xe70000000036,%v1,222(%r2),%v3	# vlm %v1,%v3,222(%r2)
+	.insn vrs_b,0xe70000000022,%v1,222(%r2),%r3,4	# vlvg %v1,%r3,222(%r2),4
+	.insn vrs_b,0xe70000000022,%v1,222(%r2),%r3	# vlvg %v1,%r3,222(%r2)
+	.insn vrs_c,0xe70000000021,%r1,222(%r2),%v3,4	# vlgv %r1,%v3,222(%r2),4
+	.insn vrs_d,0xe60000000037,%v1,222(%r2),%r3	# vlrlr %v1,%r3,222(%r2)
diff --git a/opcodes/s390-opc.c b/opcodes/s390-opc.c
index d455d28348b8..e66731b25bea 100644
--- a/opcodes/s390-opc.c
+++ b/opcodes/s390-opc.c
@@ -509,12 +509,16 @@ unused_s390_operands_static_asserts (void)
 #define INSTR_VRX_VRRD     6, { V_8,D_20,X_12,B_16,0,0 }         /* e.g. vl    */
 #define INSTR_VRX_VRRDU    6, { V_8,D_20,X_12,B_16,U4_32,0 }     /* e.g. vlrep */
 #define INSTR_VRS_RVRDU    6, { R_8,V_12,D_20,B_16,U4_32,0 }     /* e.g. vlgv  */
+#define INSTR_VRS_RVRDU2   6, { R_8,D_20,B_16,V_12,U4_32,0 }     /* e.g. .insn vrs_c */
 #define INSTR_VRS_RVRD     6, { R_8,V_12,D_20,B_16,0,0 }         /* e.g. vlgvb */
 #define INSTR_VRS_VVRDU    6, { V_8,V_12,D_20,B_16,U4_32,0 }     /* e.g. verll */
+#define INSTR_VRS_VVRDU2   6, { V_8,D_20,B_16,V_12,U4_32,0 }     /* e.g. .insn vrs_a */
 #define INSTR_VRS_VVRD     6, { V_8,V_12,D_20,B_16,0,0 }         /* e.g. vlm   */
 #define INSTR_VRS_VRRDU    6, { V_8,R_12,D_20,B_16,U4_32,0 }     /* e.g. vlvg  */
+#define INSTR_VRS_VRRDU2   6, { V_8,D_20,B_16,R_12,U4_32,0 }     /* e.g. .insn vrs_b */
 #define INSTR_VRS_VRRD     6, { V_8,R_12,D_20,B_16,0,0 }         /* e.g. vlvgb */
 #define INSTR_VRS_RRDV     6, { V_32,R_12,D_20,B_16,0,0 }        /* e.g. vlrlr */
+#define INSTR_VRS_RRDV2    6, { V_32,D_20,B_16,R_12,0,0 }        /* e.g. .insn vrs_d */
 #define INSTR_VRR_VRR      6, { V_8,R_12,R_16,0,0,0 }            /* e.g. vlvgp */
 #define INSTR_VRR_VVV0U    6, { V_8,V_12,V_16,U4_32,0,0 }        /* e.g. vmrh  */
 #define INSTR_VRR_VVV0U0   6, { V_8,V_12,V_16,U4_24,0,0 }        /* e.g. vfaeb */
@@ -755,12 +759,16 @@ unused_s390_operands_static_asserts (void)
 #define MASK_VRX_VRRD     { 0xff, 0x00, 0x00, 0x00, 0xf0, 0xff }
 #define MASK_VRX_VRRDU    { 0xff, 0x00, 0x00, 0x00, 0x00, 0xff }
 #define MASK_VRS_RVRDU    { 0xff, 0x00, 0x00, 0x00, 0x00, 0xff }
+#define MASK_VRS_RVRDU2   { 0xff, 0x00, 0x00, 0x00, 0x00, 0xff }
 #define MASK_VRS_RVRD     { 0xff, 0x00, 0x00, 0x00, 0xf0, 0xff }
 #define MASK_VRS_VVRDU    { 0xff, 0x00, 0x00, 0x00, 0x00, 0xff }
+#define MASK_VRS_VVRDU2   { 0xff, 0x00, 0x00, 0x00, 0x00, 0xff }
 #define MASK_VRS_VVRD     { 0xff, 0x00, 0x00, 0x00, 0xf0, 0xff }
 #define MASK_VRS_VRRDU    { 0xff, 0x00, 0x00, 0x00, 0x00, 0xff }
+#define MASK_VRS_VRRDU2   { 0xff, 0x00, 0x00, 0x00, 0x00, 0xff }
 #define MASK_VRS_VRRD     { 0xff, 0x00, 0x00, 0x00, 0xf0, 0xff }
 #define MASK_VRS_RRDV     { 0xff, 0xf0, 0x00, 0x00, 0x00, 0xff }
+#define MASK_VRS_RRDV2    { 0xff, 0xf0, 0x00, 0x00, 0x00, 0xff }
 #define MASK_VRR_VRR      { 0xff, 0x00, 0x0f, 0xff, 0xf0, 0xff }
 #define MASK_VRR_VVV0U    { 0xff, 0x00, 0x0f, 0xff, 0x00, 0xff }
 #define MASK_VRR_VVV0U0   { 0xff, 0x00, 0x0f, 0x0f, 0xf0, 0xff }
@@ -894,8 +902,10 @@ const struct s390_opcode s390_opformats[] =
   { "vrr_j",OP8(0x00LL), MASK_VRR_VVV0U0,  INSTR_VRR_VVV0U0,  2, 12, 256, NULL },
   { "vrr_k",OP8(0x00LL), MASK_VRR_VV0U2,   INSTR_VRR_VV0U2,   2, 12, 256, NULL },
   { "vrs",  OP8(0x00LL), MASK_VRS_RVRDU,   INSTR_VRS_RVRDU,   2,  9, 256, NULL },
-  { "vrv",  OP8(0x00LL), MASK_VRV_VVXRDU,  INSTR_VRV_VVXRDU,  2,  9, 256, NULL },
-  { "vrx",  OP8(0x00LL), MASK_VRX_VRRDU,   INSTR_VRX_VRRDU,   2,  9, 256, NULL },
+  { "vrs_a",OP8(0x00LL), MASK_VRS_VVRDU2,  INSTR_VRS_VVRDU2,  2,  9, 256|1, NULL },
+  { "vrs_b",OP8(0x00LL), MASK_VRS_VRRDU2,  INSTR_VRS_VRRDU2,  2,  9, 256|1, NULL },
+  { "vrs_c",OP8(0x00LL), MASK_VRS_RVRDU2,  INSTR_VRS_RVRDU2,  2,  9, 256, NULL },
+  { "vrs_d",OP8(0x00LL), MASK_VRS_RRDV2,   INSTR_VRS_RRDV2,   2, 10, 256, NULL },
   { "vsi",  OP8(0x00LL), MASK_VSI_URDV,	   INSTR_VSI_URDV,    2, 10, 256, NULL },
 };
 
-- 
2.53.0



More information about the Binutils mailing list