[00/14] s390: Enhancements to working with addressing operands

Message ID 20240215155821.4065623-1-jremus@linux.ibm.com
Headers
Series s390: Enhancements to working with addressing operands |

Message

Jens Remus Feb. 15, 2024, 3:58 p.m. UTC
  This patch series provides enhancements to the s390 assembler and
disassembler when working with instructions with addressing operands
with index and base register. Additionally it includes a few more or
less related cleanups.

Patch 1 and 2 enhance the reporting of s390 assembler syntax errors.

Patch 3 corrects the parsing of length operands in the s390 assembler.

Patch 4 corrects the setting of the ELF highgprs flag, regardless of the
order of specification of the -m31 and -mzarch s390 assembler options.

Patch 5 assembles the processor specific test cases on s390 for their
intended processor. Previously they were assembled for the latest
supported processor.

Patch 6 adds comments to the s390 assembler operand parsing logic, to
make it easier to follow.

Patch 7 and 8 add test cases related to base and index register as
preparation for the actual enhancements from this series.

Patch 9 revises the s390-specific assembler option descriptions as
preparation for the actual enhancements from this series.

Patch 10 adds register name type checks to the s390 assembler, which
can be configured with the new s390-specific assembler option
"warn-regtype-mismatch=strict|relaxed|no". When enabled a warning message
is printed if a register name type does not match the operand type.
The default is "relaxed", which allows floating-point and vector
register names to be used interchangeably, becazse the floating-point
registers are embedded into the vector registers and GCC generates
assembler code making use of this knowledge. This should minimize mostly
hand-written assembler coding errors, especially when omitting either
index (X) or base (B) register in D(X,B).

Patch 11 changes the s390 disassembler to print base register 0 as "0"
instead of "%r0". This is to enhance readability of the disassembly. It
makes it easier to spot the use of base register 0.

Patch 12 allows to explicitly omit base register 0 in the s390
assembler. The base register B in D(X,B) can be explicitly omitted by
coding D(X,) instead of D(X,0). This is very similar to explicitly
omitting the index register X in D(X,B) by coding D(,B). This enhances
the readability. Additionally it can also be explicitly omitted in
D(L,B) by coding D(L,) instead of D(L,0) or D(L).

Patch 13 adds printing of the operand number in all operand parsing
related warning/error messages, given that the information is now
available (see patch 10).

Patch 14 adds printing of the expected operand type of a missing
operand.

Thanks and regards,
Jens

Jens Remus (14):
  s390: Lower severity of assembler syntax errors from fatal to error
  s390: Enhance handling of syntax errors in assembler
  s390: Do not erroneously use base operand value for length operand
  s390: Correct setting of highgprs flag in ELF output
  s390: Assemble processor specific test cases for their processor
  s390: Add comments to assembler operand parsing logic
  s390: Add test cases for base/index register 0
  s390: Add test case for disassembler option warn-areg-zero
  s390: Revise s390-specific assembler option descriptions
  s390: Warn when register name type does not match operand
  s390: Print base register 0 as "0" in disassembly
  s390: Allow to explicitly omit base register operand in assembly
  s390: Provide operand number in assembler warning and error messages
  s390: Be more verbose about missing operand type

 binutils/NEWS                                 |   2 +
 gas/NEWS                                      |  10 +
 gas/config/tc-s390.c                          | 373 ++++++++++++++----
 gas/doc/as.texi                               |  20 +
 gas/testsuite/gas/s390/blank.s                |   0
 gas/testsuite/gas/s390/esa-g5.s               |   8 +-
 gas/testsuite/gas/s390/esa-highgprs-0.d       |  24 ++
 .../gas/s390/esa-highgprs-machinemode-0.d     |  23 ++
 .../gas/s390/esa-highgprs-machinemode-0.s     |   2 +
 .../gas/s390/esa-highgprs-machinemode-1.d     |  23 ++
 .../gas/s390/esa-highgprs-machinemode-1.s     |   3 +
 gas/testsuite/gas/s390/s390.exp               |  23 +-
 .../gas/s390/zarch-base-index-0-err.l         |  74 ++++
 .../gas/s390/zarch-base-index-0-err.s         |  47 +++
 gas/testsuite/gas/s390/zarch-base-index-0.d   | 103 +++++
 gas/testsuite/gas/s390/zarch-base-index-0.s   | 116 ++++++
 gas/testsuite/gas/s390/zarch-highgprs-0.d     |  24 ++
 gas/testsuite/gas/s390/zarch-highgprs-1.d     |  24 ++
 .../gas/s390/zarch-omitted-base-index-err.l   |  21 +
 .../gas/s390/zarch-omitted-base-index-err.s   |  19 +
 .../gas/s390/zarch-omitted-base-index.d       |  25 ++
 .../gas/s390/zarch-omitted-base-index.s       |  26 ++
 gas/testsuite/gas/s390/zarch-warn-areg-zero.l |  65 +++
 gas/testsuite/gas/s390/zarch-warn-areg-zero.s | 116 ++++++
 .../zarch-warn-regtype-mismatch-relaxed.l     |  15 +
 .../zarch-warn-regtype-mismatch-relaxed.s     |   7 +
 .../s390/zarch-warn-regtype-mismatch-strict.l |  15 +
 .../s390/zarch-warn-regtype-mismatch-strict.s |   7 +
 gas/testsuite/gas/s390/zarch-z13.s            |   8 +-
 gas/testsuite/gas/s390/zarch-z9-109-err.l     |   2 +-
 gas/testsuite/gas/s390/zarch-z900-err.l       |   4 +-
 include/opcode/s390.h                         |   3 +
 opcodes/s390-dis.c                            |  22 +-
 opcodes/s390-opc.c                            |  62 +--
 34 files changed, 1190 insertions(+), 126 deletions(-)
 create mode 100644 gas/testsuite/gas/s390/blank.s
 create mode 100644 gas/testsuite/gas/s390/esa-highgprs-0.d
 create mode 100644 gas/testsuite/gas/s390/esa-highgprs-machinemode-0.d
 create mode 100644 gas/testsuite/gas/s390/esa-highgprs-machinemode-0.s
 create mode 100644 gas/testsuite/gas/s390/esa-highgprs-machinemode-1.d
 create mode 100644 gas/testsuite/gas/s390/esa-highgprs-machinemode-1.s
 create mode 100644 gas/testsuite/gas/s390/zarch-base-index-0-err.l
 create mode 100644 gas/testsuite/gas/s390/zarch-base-index-0-err.s
 create mode 100644 gas/testsuite/gas/s390/zarch-base-index-0.d
 create mode 100644 gas/testsuite/gas/s390/zarch-base-index-0.s
 create mode 100644 gas/testsuite/gas/s390/zarch-highgprs-0.d
 create mode 100644 gas/testsuite/gas/s390/zarch-highgprs-1.d
 create mode 100644 gas/testsuite/gas/s390/zarch-omitted-base-index-err.l
 create mode 100644 gas/testsuite/gas/s390/zarch-omitted-base-index-err.s
 create mode 100644 gas/testsuite/gas/s390/zarch-omitted-base-index.d
 create mode 100644 gas/testsuite/gas/s390/zarch-omitted-base-index.s
 create mode 100644 gas/testsuite/gas/s390/zarch-warn-areg-zero.l
 create mode 100644 gas/testsuite/gas/s390/zarch-warn-areg-zero.s
 create mode 100644 gas/testsuite/gas/s390/zarch-warn-regtype-mismatch-relaxed.l
 create mode 100644 gas/testsuite/gas/s390/zarch-warn-regtype-mismatch-relaxed.s
 create mode 100644 gas/testsuite/gas/s390/zarch-warn-regtype-mismatch-strict.l
 create mode 100644 gas/testsuite/gas/s390/zarch-warn-regtype-mismatch-strict.s
  

Comments

Jens Remus March 1, 2024, 12:24 p.m. UTC | #1
> Jens Remus (14):
>    s390: Lower severity of assembler syntax errors from fatal to error
>    s390: Enhance handling of syntax errors in assembler
>    s390: Do not erroneously use base operand value for length operand
>    s390: Correct setting of highgprs flag in ELF output
>    s390: Assemble processor specific test cases for their processor
>    s390: Add comments to assembler operand parsing logic
>    s390: Add test cases for base/index register 0
>    s390: Add test case for disassembler option warn-areg-zero
>    s390: Revise s390-specific assembler option descriptions
>    s390: Warn when register name type does not match operand
>    s390: Print base register 0 as "0" in disassembly
>    s390: Allow to explicitly omit base register operand in assembly
>    s390: Provide operand number in assembler warning and error messages
>    s390: Be more verbose about missing operand type

Committed to mainline with approval from Andreas.

Regards,
Jens