[PATCH v2 00/47] s390: Complete .insn pseudo-mnemonics

Jens Remus jremus@linux.ibm.com
Fri Nov 6 15:56:50 GMT 2026


Changes in v2 (see individual patch notes):
- Integrate review feedback from Andreas.
- New patch 2.

This series adds all instruction formats including any variants (e.g.
a/b/c/...) to the .insn pseudo-mnemonics and documents their operand
order.  Additionally the documentation of the .insn directive is
improved.

With very few exceptions the operand order for all newly added .insn
pseudo-mnemonics is in ascending instruction field index order as
specified in the z/Architecture Principles of Operations manual,
chapter "Program Execution", section "Instruction Formats".
Exceptions are for backward compatibility and are documented.

Register (R#) operands may be a general register (GR), floating-point
register (FPR), access register (AR), or control register (CR) number
(0-15) or register name (%r#, %f#, %a#, %c#).

Vector register (V#) operands may be a vector register (VR) number
(0-31) or register name (%v#).

Immediate (I#) and mask (M#) operands may be signed or unsigned.  That
is their value must be in range SIGNED_MIN to UNSIGNED_MAX inclusive
for their respective bit field width.  This enables coding these
operand values naturally, depending on whether individual instructions
define their operand values as signed or unsigned.

Relative immediate (RI#) operands are treated as signed.

Composite operands are grouped by field index and need to be coded in
their natural form: D#(B#), D#(X#,B#), D#(L#,B#), D#(VX#,B#).

Example for instruction format RSL-b:

  +---------+---------+----+--------------+----+----+---------+
  | OpCode  |    L2   | B2 |      D2      | R1 | M3 | OpCode  |
  +---------+---------+----+--------------+----+----+---------+
  0         8         16   20             32   36   40       47

Operand order for RSL-b deduced from the instruction field index:

  1. R1 - register operand (may be GR, FPR, AR, or CR)
  2. D2(L2,B2) - composite operand (displacement, length, base register)
  3. M3 - mask operand (un-/signed)

RSL-b therefore needs to be coded as follows:

  .insn rsl_b,INSN,R1,D2(L2,B2),M3

Notable patches:
- s390: Treat signed/unsigned immediate operands in .insn pseudo-
  mnemonics as either
- s390: Add support for three optional operands in dis-/assembly
- s390: Improve coding of .insn pseudo-mnemonics without operands

Each instruction format is handled by a separate patch to ease review.
I am open to squash the patches "s390: Add test for .insn pseudo-
mnemonic e" to "s390: Add test for .insn pseudo-mnemonic vsi" into a
single patch if preferred.

Related LLVM PR #222031 "[SystemZ] Expand and automate .insn directive
coverage":
https://github.com/llvm/llvm-project/pull/222031

Regards,
Jens

Jens Remus (47):
  s390: Sort .insn pseudo-mnemonics table alphabetically
  s390: Correct mode and minimum CPU level of .insn pseudo-mnemonics
  s390: Enhance documentation of instruction operands
  s390: Correct documentation of instruction formats
  s390: Enhance formatting of instruction formats in documentation
  s390: Document PC-relative immediate operands in instruction formats
  s390: Document operand ordering rules for .insn directive
  s390: Position independent .insn test verification patterns
  s390: Treat signed/unsigned immediate operands in .insn
    pseudo-mnemonics as either
  s390: Add support for three optional operands in dis-/assembly
  s390: Improve coding of .insn pseudo-mnemonics without operands
  s390: Add test for .insn pseudo-mnemonic e
  s390: Add .insn pseudo-mnemonic i
  s390: Add .insn pseudo-mnemonic ie
  s390: Add .insn pseudo-mnemonic mii
  s390: Add .insn pseudo-mnemonics ri_a/b/c
  s390: Add .insn pseudo-mnemonics rie_a/b/c/d/e/f/g
  s390: Add .insn pseudo-mnemonics ril_a/b/c
  s390: Add test for .insn pseudo-mnemonic ris
  s390: Make R2 operand optional in .insn pseudo-mnemonic rr
  s390: Add .insn pseudo-mnemonic rrd
  s390: Make R1 and R2 operands optional in .insn pseudo-mnemonic rre
  s390: Add .insn pseudo-mnemonics rrf_a/b/c/d/e
  s390: Add test for .insn pseudo-mnemonic rrs
  s390: Add .insn pseudo-mnemonics rs_a/b
  s390: Enhance test for .insn pseudo-mnemonic rse
  s390: Add test for .insn pseudo-mnemonic rsi
  s390: Add .insn pseudo-mnemonics rsl_a/b
  s390: Add .insn pseudo-mnemonics rsy_a/b
  s390: Add .insn pseudo-mnemonics rx_a/b
  s390: Add optional operand M3 to .insn pseudo-mnemonic rxe
  s390: Add test for .insn pseudo-mnemonic rxf
  s390: Add .insn pseudo-mnemonics rxy_a/b/c
  s390: Make D(B) operand optional in .insn pseudo-mnemonic s
  s390: Make I2 operand optional in .insn pseudo-mnemonic si
  s390: Add test for .insn pseudo-mnemonic sil
  s390: Make I2 operand optional in .insn pseudo-mnemonic siy
  s390: Add .insn pseudo-mnemonic smi
  s390: Add .insn pseudo-mnemonics ss_a/b/c/d/e/f
  s390: Add test for .insn pseudo-mnemonic sse
  s390: Improve test for .insn pseudo-mnemonic ssf
  s390: Add .insn pseudo-mnemonics vri_a/b/c/d/e/f/g/h/i/j/k/l
  s390: Add .insn pseudo-mnemonics vrr_a/b/c/d/e/f/g/h/i/j/k
  s390: Add .insn pseudo-mnemonics vrs_a/b/c/d
  s390: Make M3 operand optional in .insn pseudo-mnemonic vrv
  s390: Make M3 operand optional in .insn pseudo-mnemonic vrx
  s390: Add test for .insn pseudo-mnemonic vsi

 gas/config/tc-s390.c                    |  93 +++--
 gas/config/tc-s390.h                    |  12 +
 gas/doc/c-s390.texi                     | 456 ++++++++++++++++--------
 gas/testsuite/gas/s390/esa-operands.d   |  47 ++-
 gas/testsuite/gas/s390/esa-operands.s   |  29 +-
 gas/testsuite/gas/s390/zarch-operands.d | 236 +++++++++++-
 gas/testsuite/gas/s390/zarch-operands.s | 133 ++++++-
 include/opcode/s390.h                   |   2 +
 opcodes/s390-dis.c                      |  76 ++--
 opcodes/s390-mkopc.c                    |   4 +
 opcodes/s390-opc.c                      | 140 ++++++--
 opcodes/s390-opc.txt                    |   2 +-
 12 files changed, 952 insertions(+), 278 deletions(-)

-- 
2.53.0



More information about the Binutils mailing list