From: Tom de Vries <tdevries@suse.de>
To: Shiven Kashyap <shivenkashyap24@gmail.com>, gdb-patches@sourceware.org
Cc: guinevere@redhat.com
Subject: Re: [PATCH 1/1] [gdb/reverse] Fix failing test: i386-avx-reverse
Date: Sun, 20 Jul 2025 04:48:19 +0200 [thread overview]
Message-ID: <c9b3be89-3150-4545-9b5a-015605dec8b1@suse.de> (raw)
In-Reply-To: <20250719200052.28404-1-shivenkashyap24@gmail.com>
On 7/19/25 22:00, Shiven Kashyap wrote:
> Running the standalone test `gdb.reverse` leads to the following failure:
> '''
> FAIL: gdb.reverse/i386-avx-reverse.exp: verify ymm15 before vbroadcastsd
> '''
>
Hi,
thanks for the patch.
I first couldn't reproduce this, but then I managed using target board
unix/-fPIE/-pie.
> 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));
> '''
>
This is a bit misleading, because vbroadcastss can handle memory
operands, not just "actual values".
After your fix (which looks correct to me), the generated instruction
still accesses a memory address:
...
400abd: 48 8b 05 04 26 00 00 mov 0x2604(%rip),%rax
# 4030c8 <dyn_buf0>
400ac4: c4 62 79 18 38 vbroadcastss (%rax),%xmm15
...
but this time, the correct one.
Thanks,
- Tom
> 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"
>
next prev parent reply other threads:[~2025-07-20 2:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-19 20:00 Shiven Kashyap
2025-07-20 2:48 ` Tom de Vries [this message]
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=c9b3be89-3150-4545-9b5a-015605dec8b1@suse.de \
--to=tdevries@suse.de \
--cc=gdb-patches@sourceware.org \
--cc=guinevere@redhat.com \
--cc=shivenkashyap24@gmail.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