]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
s390: Do not omit vector index register 0 in disassembly
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)
commite99d28e6bd6298a6115484cfe9fa2df571fc9c66
treea953cd3063e9b6aa5163c6d47ccf7ca399e88307
parent9693d2fa7d6f08c4a23a7d851e98525091d43d92
s390: Do not omit vector index register 0 in disassembly

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 do not omit vector index register 0 in disassembly, that is
disassemble D(VX,B) with VX=0 as D(VX,B) instead of D(B).  Also do not
disassemble index register 0 as "0", that is disassemble D(VX,B) with
VX=0 as D(%v0,B) instead of D(0,B).  Note that a base register 0 still
still gets disassembled as "0", that is D(VX,B) with B=0 disassembles
into D(VX,0).

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

opcodes/
* s390-dis.c (s390_print_insn_with_opcode): Do not omit vector
index register 0 in disassembly.  Disassemble it as %v0.

gas/testsuite/
* gas/s390/zarch-base-index-0.d (vgef): Expect vector index
register 0 in disassembly.
* gas/s390/zarch-omitted-base-index.d (vgef): Likewise.

Suggested-by: Florian Krohm <flo2030@eich-krohm.de>
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
gas/testsuite/gas/s390/zarch-base-index-0.d
gas/testsuite/gas/s390/zarch-omitted-base-index.d
opcodes/s390-dis.c