Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Shiven Kashyap <shivenkashyap24@gmail.com>
To: gdb-patches@sourceware.org
Cc: guinevere@redhat.com, Shiven Kashyap <shivenkashyap24@gmail.com>
Subject: [PATCH 1/1] [gdb/reverse] Fix failing test: i386-avx-reverse
Date: Sun, 20 Jul 2025 01:30:48 +0530	[thread overview]
Message-ID: <20250719200052.28404-1-shivenkashyap24@gmail.com> (raw)

Running the standalone test `gdb.reverse` leads to the following failure:
'''
FAIL: gdb.reverse/i386-avx-reverse.exp: verify ymm15 before vbroadcastsd
'''

This happens because the AVX broadcast instructions expect an actual value, but instead
it cast memory address of a buffer like so (see 'vpbroadcast_test' in 'i386-avx-reverse.c'):
'''
asm volatile ("vbroadcastss %0, %%xmm15": : "m" (dyn_buf0));
'''

which 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>
---
 gdb/testsuite/gdb.reverse/i386-avx-reverse.c   | 4 ++--
 gdb/testsuite/gdb.reverse/i386-avx-reverse.exp | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/gdb/testsuite/gdb.reverse/i386-avx-reverse.c b/gdb/testsuite/gdb.reverse/i386-avx-reverse.c
index a3d64272f24..bf6cb77f313 100644
--- a/gdb/testsuite/gdb.reverse/i386-avx-reverse.c
+++ b/gdb/testsuite/gdb.reverse/i386-avx-reverse.c
@@ -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.  */
diff --git a/gdb/testsuite/gdb.reverse/i386-avx-reverse.exp b/gdb/testsuite/gdb.reverse/i386-avx-reverse.exp
index 7e75542720c..fb04260766e 100644
--- a/gdb/testsuite/gdb.reverse/i386-avx-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/i386-avx-reverse.exp
@@ -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"
 
-- 
2.50.1


             reply	other threads:[~2025-07-19 20:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-19 20:00 Shiven Kashyap [this message]
2025-07-20  2:48 ` Tom de Vries
2025-07-21 19:14   ` Guinevere Larsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250719200052.28404-1-shivenkashyap24@gmail.com \
    --to=shivenkashyap24@gmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=guinevere@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox