From: Shiven Kashyap Date: Tue, 22 Jul 2025 08:32:57 +0000 (+0530) Subject: Fix failing test: i386-avx-reverse X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9087bd989b5ff3c02386fc66afc187f37d31aa34;p=thirdparty%2Fbinutils-gdb.git Fix failing test: i386-avx-reverse 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 Approved-By: Guinevere Larsen --- 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"