]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
s390: Error if vector index register omitted in assembly
authorJens Remus <jremus@linux.ibm.com>
Mon, 27 Jan 2025 15:48:58 +0000 (16:48 +0100)
committerJens Remus <jremus@linux.ibm.com>
Mon, 27 Jan 2025 15:48:58 +0000 (16:48 +0100)
commitc76c8e20985d4c5106fa538c6f80661e1c2be007
tree1eb13be9dd9ce975daf61e1f7a2180c92f7642e9
parentd77c7ae0835aec204d7d3247e187103f78d81290
s390: Error if vector index register omitted in assembly

Vector index registers are currently only used in the VRV instruction
format.  Unlike general purpose index registers an operand value of
zero (e.g. %v0, 0, or omitted) does not imply a zero value:

"For VRV format instructions, a vector element is used in the formation
of the intermediate value.  This vector element is an unsigned binary
integer value that is added to the base address and 12-bit displacement
to form a 64-bit intermediate sum.  The vector element is designated by
a vector register and an element index.  A zero V field accesses the
element in vector register zero and does not imply a zero value." [1]

Therefore require vector index register operands to be specified in
assembler source.  That is do require coding of D(VX,B) instead of
allowing to omit VX=0 as D(,B), D(B), or D.  Emit an error message if
a mandatory vector index register is omitted:

  Error: operand <n>: missing vector index register operand

Note that this change is not backwards compatible.  But any code that
omitted the specification of the vector index register is likely to be
in error.  Therefore it is favorable to report an error than to stay
backward compatible.

[1]: IBM z/Architecture Principles of Operation, SA22-7832-13, IBM z16,
     https://publibfp.dhe.ibm.com/epubs/pdf/a227832d.pdf

gas/
* config/tc-s390.c (md_gather_operands): Do not allow
vector index register operands to be optionally omitted.

gas/testsuite/
* gas/s390/zarch-base-index-0.d (vgef): Remove tests with
omitted vector index register operands.
* gas/s390/zarch-base-index-0.s (vgef): Move tests with omitted
vector index register operands ...
* gas/s390/zarch-base-index-0-err.s (vgef): ... to here.
* gas/s390/zarch-base-index-0-err.l (vgef): Expect error
for omitted vector index register operands.
* gas/s390/zarch-omitted-base-index.d (vgef): Remove tests with
omitted vector index register operands.
* gas/s390/zarch-omitted-base-index.s (vgef): Move tests with
omitted vector index register operands ...
* gas/s390/zarch-omitted-base-index-err.s (vgef): ... to here.
* gas/s390/zarch-omitted-base-index-err.l (vgef): Expect error
for omitted vector index register operands.
* gas/s390/zarch-warn-areg-zero.l (vgef): Remove tests with
omitted vector index register operands.
* gas/s390/zarch-warn-areg-zero.s (vgef): Likewise.

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
gas/config/tc-s390.c
gas/testsuite/gas/s390/zarch-base-index-0-err.l
gas/testsuite/gas/s390/zarch-base-index-0-err.s
gas/testsuite/gas/s390/zarch-base-index-0.d
gas/testsuite/gas/s390/zarch-base-index-0.s
gas/testsuite/gas/s390/zarch-omitted-base-index-err.l
gas/testsuite/gas/s390/zarch-omitted-base-index-err.s
gas/testsuite/gas/s390/zarch-omitted-base-index.d
gas/testsuite/gas/s390/zarch-omitted-base-index.s
gas/testsuite/gas/s390/zarch-warn-areg-zero.l
gas/testsuite/gas/s390/zarch-warn-areg-zero.s