]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
s390: Add brasl edge test cases from ESA to z/Architecture
authorJens Remus <jremus@linux.ibm.com>
Thu, 23 Nov 2023 14:44:41 +0000 (15:44 +0100)
committerAndreas Krebbel <krebbel@linux.ibm.com>
Thu, 23 Nov 2023 14:51:03 +0000 (15:51 +0100)
The ESA opcode test cases for IBM z900 contain a few edge cases. They
exercise the brasl mnemonic with its largest allowed negative and
positive offsets. Linux on zSeries in ESA mode executes in 31-bit
addressing mode. Therefore the ESA test cases are assembled with -m31.
In 31-bit addressing mode the address computation using those large
offsets wraps, which is correctly reflected in the disassembly.

Linux on Z in z/Architecture mode executes in 64-bit addressing mode.
Therefore the z/Architecture (zarch) test cases are assembled with -m64.
In 64-bit addressing mode the address computation using those large
offsets does not necessarily wrap.

gas/
* testsuite/gas/s390/zarch-z900.s: Add brasl tests from ESA that
  exercise edge cases.
* testsuite/gas/s390/zarch-z900.d: Likewise.

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
Reviewed-by: Andreas Krebbel <krebbel@linux.ibm.com>
gas/testsuite/gas/s390/zarch-z900.d
gas/testsuite/gas/s390/zarch-z900.s

index 2848dc1eb7c66ab7a2324cf2de14ec3c416fab5a..93aee212785d4a7be17b4c6415e24310ec376bf1 100644 (file)
@@ -149,4 +149,10 @@ Disassembly of section .text:
 .*:    eb 96 5f ff 00 0f [     ]*tracg %r9,%r6,4095\(%r5\)
 .*:    e3 95 af ff 00 82 [     ]*xg    %r9,4095\(%r5,%r10\)
 .*:    b9 82 00 96 [   ]*xgr   %r9,%r6
+ *([\da-f]+):  c0 65 00 00 00 00 [     ]*brasl %r6,\1 <foo\+0x\1>
+ *([\da-f]+):  c0 65 00 00 00 00 [     ]*brasl %r6,\1 <foo\+0x\1>
+ *([\da-f]+):  c0 65 80 00 00 00 [     ]*brasl %r6,ffffffff0+\1 <foo\+0xffffffff0+\1>
+ *([\da-f]+):  c0 65 80 00 00 00 [     ]*brasl %r6,ffffffff0+\1 <foo\+0xffffffff0+\1>
+.*:    c0 65 7f ff ff ff [     ]*brasl %r6,1000002d0 <foo\+0x1000002d0>
+.*:    c0 65 7f ff ff ff [     ]*brasl %r6,1000002d6 <foo\+0x1000002d6>
 .*:    07 07 [  ]*nopr %r7
index 96d27e7b7e27095545453c9ffcadddc64a8f510b..22fa1da5a306f2f6041fe2ed321bc7ff360fdde1 100644 (file)
@@ -143,3 +143,9 @@ foo:
        tracg   %r9,%r6,4095(%r5)
        xg      %r9,4095(%r5,%r10)
        xgr     %r9,%r6
+       brasl   %r6,.
+       jasl    %r6,.
+       brasl   %r6,.-0x100000000
+       jasl    %r6,.-0x100000000
+       brasl   %r6,.+0xfffffffe
+       jasl    %r6,.+0xfffffffe