From 929c046d575c273e80000310b88c24af94cc4cf8 Mon Sep 17 00:00:00 2001 From: Bill Schmidt Date: Fri, 31 May 2019 12:22:52 +0000 Subject: [PATCH] cpu-future.c: Require powerpc_future_ok. 2019-05-31 Bill Schmidt Michael Meissner * gcc.target/powerpc/cpu-future.c: Require powerpc_future_ok. * gcc.target/powerpc/localentry-1.c: Likewise. * gcc.target/powerpc/localentry-direct-1.c: Likewise. * gcc.target/powerpc/notoc-direct-1.c: Likewise. * gcc.target/powerpc/pcrel-sibcall-1.c: Likewise. * lib/target-supports.exp (check_powerpc_future_hw_available): New. (check_effective_target_powerpc_future_ok): New. Co-Authored-By: Michael Meissner From-SVN: r271810 --- gcc/testsuite/ChangeLog | 11 ++++++ gcc/testsuite/gcc.target/powerpc/cpu-future.c | 1 + .../gcc.target/powerpc/localentry-1.c | 1 + .../gcc.target/powerpc/localentry-detect-1.c | 1 + .../gcc.target/powerpc/notoc-direct-1.c | 1 + .../gcc.target/powerpc/pcrel-sibcall-1.c | 1 + gcc/testsuite/lib/target-supports.exp | 37 +++++++++++++++++++ 7 files changed, 53 insertions(+) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b2f4478126d..31743766289 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,14 @@ +2019-05-31 Bill Schmidt + Michael Meissner + + * gcc.target/powerpc/cpu-future.c: Require powerpc_future_ok. + * gcc.target/powerpc/localentry-1.c: Likewise. + * gcc.target/powerpc/localentry-direct-1.c: Likewise. + * gcc.target/powerpc/notoc-direct-1.c: Likewise. + * gcc.target/powerpc/pcrel-sibcall-1.c: Likewise. + * lib/target-supports.exp (check_powerpc_future_hw_available): New. + (check_effective_target_powerpc_future_ok): New. + 2019-05-31 Thomas De Schampheleire PR debug/86964 diff --git a/gcc/testsuite/gcc.target/powerpc/cpu-future.c b/gcc/testsuite/gcc.target/powerpc/cpu-future.c index d0725867ffa..ae406d08b23 100644 --- a/gcc/testsuite/gcc.target/powerpc/cpu-future.c +++ b/gcc/testsuite/gcc.target/powerpc/cpu-future.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-effective-target powerpc_future_ok } */ /* { dg-options "-mdejagnu-cpu=future -O2" } */ /* Ensure -mcpu=future compiles cleanly. */ diff --git a/gcc/testsuite/gcc.target/powerpc/localentry-1.c b/gcc/testsuite/gcc.target/powerpc/localentry-1.c index ce687a7f6ec..dc4867d0a3c 100644 --- a/gcc/testsuite/gcc.target/powerpc/localentry-1.c +++ b/gcc/testsuite/gcc.target/powerpc/localentry-1.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-mdejagnu-cpu=future -O2" } */ /* { dg-require-effective-target powerpc_elfv2 } */ +/* { dg-require-effective-target powerpc_future_ok } */ /* Ensure we generate ".localentry fn,1" for both leaf and non-leaf functions. */ diff --git a/gcc/testsuite/gcc.target/powerpc/localentry-detect-1.c b/gcc/testsuite/gcc.target/powerpc/localentry-detect-1.c index db20aedeb71..70b18ff0aca 100644 --- a/gcc/testsuite/gcc.target/powerpc/localentry-detect-1.c +++ b/gcc/testsuite/gcc.target/powerpc/localentry-detect-1.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-require-effective-target powerpc_elfv2 } */ +/* { dg-require-effective-target powerpc_future_ok } */ /* { dg-options "-O2 -mdejagnu-cpu=future" } */ diff --git a/gcc/testsuite/gcc.target/powerpc/notoc-direct-1.c b/gcc/testsuite/gcc.target/powerpc/notoc-direct-1.c index 31497261ddf..0917f307e65 100644 --- a/gcc/testsuite/gcc.target/powerpc/notoc-direct-1.c +++ b/gcc/testsuite/gcc.target/powerpc/notoc-direct-1.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-mdejagnu-cpu=future -O2" } */ /* { dg-require-effective-target powerpc_elfv2 } */ +/* { dg-require-effective-target powerpc_future_ok } */ /* Test that calls generated from PC-relative code are annotated with @notoc. */ diff --git a/gcc/testsuite/gcc.target/powerpc/pcrel-sibcall-1.c b/gcc/testsuite/gcc.target/powerpc/pcrel-sibcall-1.c index 7c767e2ba32..bd7a0a9bcda 100644 --- a/gcc/testsuite/gcc.target/powerpc/pcrel-sibcall-1.c +++ b/gcc/testsuite/gcc.target/powerpc/pcrel-sibcall-1.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-mdejagnu-cpu=future -O2" } */ /* { dg-require-effective-target powerpc_elfv2 } */ +/* { dg-require-effective-target powerpc_future_ok } */ /* Test that potential sibcalls are not generated when the caller preserves the TOC and the callee doesn't, or vice versa. */ diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 13c3a6a7157..6aa814b35bc 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -2140,6 +2140,25 @@ proc check_p9modulo_hw_available { } { }] } + +# Return 1 if the target supports executing FUTURE instructions, 0 otherwise. +# Cache the result. It is assumed that if a simulator does not support the +# FUTURE instructions, that it will generate an error and this test will fail. + +proc check_powerpc_future_hw_available { } { + return [check_cached_effective_target powerpc_future_hw_available { + check_runtime_nocache powerpc_future_hw_available { + int main() + { + /* Set e first and use +r to check if pli actually works. */ + long e = -1; + asm ("pli %0,%1" : "+r" (e) : "n" (0x12345)); + return (e == 0x12345); + } + } "-mfuture" + }] +} + # Return 1 if the target supports executing __float128 on PowerPC via software # emulation, 0 otherwise. Cache the result. @@ -5157,6 +5176,24 @@ proc check_effective_target_powerpc_p9modulo_ok { } { } } +# Return 1 if this is a PowerPC target supporting -mfuture. +# Limit this to 64-bit linux systems for now until other +# targets support FUTURE. + +proc check_effective_target_powerpc_future_ok { } { + if { ([istarget powerpc64*-*-linux*]) } { + return [check_no_compiler_messages powerpc_future_ok object { + int main (void) { + long e; + asm ("pli %0,%1" : "=r" (e) : "n" (0x12345)); + return e; + } + } "-mfuture"] + } else { + return 0 + } +} + # Return 1 if this is a PowerPC target supporting -mfloat128 via either # software emulation on power7/power8 systems or hardware support on power9. -- 2.30.2