i386/asm-4 test: use amd64's natural addressing mode on all OSs

Alexandre Oliva oliva@adacore.com
Thu Aug 15 11:56:00 GMT 2019


gcc.target/i386/asm-4.c uses amd64's natural PC-relative addressing
mode on a single platform, using the 32-bit absolute addressing mode
elsewhere.  There's no point in giving up amd64's natural addressing
mode and insisting on the 32-bit one when we're targeting amd64, and
having to make explicit exceptions for systems where that's found not
to work for whatever reason.  If we just use the best-suited way to
take the address of a function behind the compiler's back on each
target variant, we're less likely to hit unexpected failures.

Tested on x86_64-linux-gnu with unix{,-m32}.  Ok to install?


for  gcc/testsuite/ChangeLog

	* gcc.target/i386/asm-4.c: Use amd64 natural addressing mode
	on all __LP64__ targets.
---
 gcc/testsuite/gcc.target/i386/asm-4.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/testsuite/gcc.target/i386/asm-4.c b/gcc/testsuite/gcc.target/i386/asm-4.c
index b86801032bc4..69dd1d3df0bf 100644
--- a/gcc/testsuite/gcc.target/i386/asm-4.c
+++ b/gcc/testsuite/gcc.target/i386/asm-4.c
@@ -29,7 +29,7 @@ baz (void)
 {
   /* Darwin loads 64-bit regions above the 4GB boundary so
      we need to use this instead.  */
-#if defined (__LP64__) && defined (__MACH__)
+#if defined (__LP64__)
   __asm ("leaq foo(%%rip), %0" : "=r" (fn));
 #else
   __asm ("movl $foo, %k0" : "=r" (fn));

-- 
Alexandre Oliva, freedom fighter  he/him   https://FSFLA.org/blogs/lxo
Be the change, be Free!                 FSF Latin America board member
GNU Toolchain Engineer                        Free Software Evangelist
Hay que enGNUrecerse, pero sin perder la terGNUra jamás - Che GNUevara



More information about the Gcc-patches mailing list