]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix failing test: i386-avx-reverse
authorShiven Kashyap <shivenkashyap24@gmail.com>
Tue, 22 Jul 2025 08:32:57 +0000 (14:02 +0530)
committerGuinevere Larsen <guinevere@redhat.com>
Tue, 22 Jul 2025 13:09:59 +0000 (10:09 -0300)
Running the standalone test `gdb.reverse` with the target board configuration `unix/-fPIE/-pie` leads to the following failure:
'''
FAIL: gdb.reverse/i386-avx-reverse.exp: verify ymm15 before vbroadcastsd
'''

This happens because the test expects values stored in `dyn_buf0`, but instead (in the test source) the address of the buffer itself
got broadcast to xmm15 (and thus to ymm15).
This happened because the pointer to the start of `dyn_buf0` wasn't dereferenced (see 'vpbroadcast_test' in 'i386-avx-reverse.c'):
'''
asm volatile ("vbroadcastss %0, %%xmm15": : "m" (dyn_buf0));
 ^
'''
and this consequently lead to the test failing for the next instruction (`vbroadcastsd`), which depended on the correct value being broadcast to the register.

Also, updated the corresponding expected output (gdb.reverse/i386-avx-reverse.exp) to match.

Tested on x86-64 Linux.

Signed-off-by: Shiven Kashyap <shivenkashyap24@gmail.com>
Approved-By: Guinevere Larsen <guinevere@redhat.com>
gdb/testsuite/gdb.reverse/i386-avx-reverse.c
gdb/testsuite/gdb.reverse/i386-avx-reverse.exp

index a3d64272f2459c895227f3ba073ded80a44550de..bf6cb77f313409290906fb41201624efb6b195e6 100644 (file)
@@ -299,10 +299,10 @@ vpbroadcast_test ()
   asm volatile ("vbroadcastss %xmm1, %xmm0");
   asm volatile ("vbroadcastss %xmm1, %ymm15");
   asm volatile ("vbroadcastss %0, %%ymm0" : : "m" (global_buf0));
-  asm volatile ("vbroadcastss %0, %%xmm15": : "m" (dyn_buf0));
+  asm volatile ("vbroadcastss %0, %%xmm15": : "m" (*dyn_buf0));
   asm volatile ("vbroadcastsd %xmm1, %ymm0");
   asm volatile ("vbroadcastsd %0, %%ymm15": : "m" (global_buf0));
-  asm volatile ("vbroadcastf128 %0, %%ymm0" : : "m" (dyn_buf0));
+  asm volatile ("vbroadcastf128 %0, %%ymm0" : : "m" (*dyn_buf0));
 
   /* We have a return statement to deal with
      epilogue in different compilers.  */
index 7e75542720cc6b1a8b303fd88d84a80e3cac4fba..fb04260766e8e32432977c660ca32e5bcb45d7d9 100644 (file)
@@ -395,7 +395,7 @@ if {[record_full_function "vpbroadcast"] == true} {
     test_one_register "vbroadcastf128" "ymm0" \
        "0x17161514131211101716151413121110, 0x17161514131211101716151413121110"
     test_one_register "vbroadcastsd" "ymm15" \
-       "0x404060004040600040406000404060, 0x0"
+       "0x23222120232221202322212023222120, 0x0"
     test_one_register "vbroadcastsd" "ymm0" \
        "0x13121110131211101312111013121110, 0x13121110131211101312111013121110"