[PATCH] rs6000: powerpc_future_ok and powerpc_future_hw

Bill Schmidt wschmidt@linux.ibm.com
Fri May 8 02:00:32 GMT 2020


From: Kelvin Nilsen <kelvin@gcc.gnu.org>

Dejagnu targets for these.

Bootstrapped and tested on powerpc64le-unknown-linux-gnu with no
regressions.  Is this okay for master?

Patch shepherded by Bill Schmidt on behalf of Kelvin Nilsen.

Thanks!
Bill

2020-03-04  Kelvin Nilsen  <kelvin@gcc.gnu.org>

	* gcc.target/powerpc/dg-future-0.c: New.
	* gcc.target/powerpc/dg-future-1.c: New.
	* lib/target-supports.exp (check_powerpc_future_hw_available):
	Replace -mfuture with -mcpu=future.
	(check_effective_target_powerpc_future_ok): Likewise.
	(is-effective-target): Add powerpc_future_hw.
---
 .../gcc.target/powerpc/dg-future-0.c          | 14 ++++++++++++++
 .../gcc.target/powerpc/dg-future-1.c          | 19 +++++++++++++++++++
 gcc/testsuite/lib/target-supports.exp         |  5 +++--
 3 files changed, 36 insertions(+), 2 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/powerpc/dg-future-0.c
 create mode 100644 gcc/testsuite/gcc.target/powerpc/dg-future-1.c

diff --git a/gcc/testsuite/gcc.target/powerpc/dg-future-0.c b/gcc/testsuite/gcc.target/powerpc/dg-future-0.c
new file mode 100644
index 00000000000..abfda82a684
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/dg-future-0.c
@@ -0,0 +1,14 @@
+/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-options "-mdejagnu-cpu=future" } */
+
+/* This tests that powerpc_future_ok works.  */
+
+extern void abort (void);
+
+int futurity (void) {
+  long int e = -1;
+  asm ("pli %0,%1": "+r" (e) : "n" (0x12345));
+  return (e == 0x12345);
+}
+
+/* { dg-final { scan-assembler {\mpli\M} } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/dg-future-1.c b/gcc/testsuite/gcc.target/powerpc/dg-future-1.c
new file mode 100644
index 00000000000..6087fe7c894
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/dg-future-1.c
@@ -0,0 +1,19 @@
+/* { dg-do run { target { powerpc*-*-* } } } */
+/* { dg-require-effective-target powerpc_future_hw } */
+/* { dg-options "-mdejagnu-cpu=future" } */
+
+/* This tests that powerpc_future_hw works.  */
+
+extern void abort (void);
+
+int futurity (void) {
+  long int e = -1;
+  asm ("pli %0,%1": "+r" (e) : "n" (0x12345));
+  return (e == 0x12345);
+}
+
+int main (int argc, char *argv [])
+{
+  if (!futurity ())
+    abort ();
+}
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 13761491e63..40978e580a3 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -2204,7 +2204,7 @@ proc check_powerpc_future_hw_available { } {
 		asm ("pli %0,%1" : "+r" (e) : "n" (0x12345));
 		return (e == 0x12345);
 	    }
-	} "-mfuture"
+	} "-mcpu=future"
     }]
 }
 
@@ -5816,7 +5816,7 @@ proc check_effective_target_powerpc_future_ok { } {
 		asm ("pli %0,%1" : "=r" (e) : "n" (0x12345));
 		return e;
 	    }
-	} "-mfuture"]
+	} "-mcpu=future"]
     } else {
 	return 0
     }
@@ -7763,6 +7763,7 @@ proc is-effective-target { arg } {
 	  "named_sections" { set selected [check_named_sections_available] }
 	  "gc_sections"    { set selected [check_gc_sections_available] }
 	  "cxa_atexit"     { set selected [check_cxa_atexit_available] }
+	  "powerpc_future_hw" { set selected [check_powerpc_future_hw_available] }
 	  default          { error "unknown effective target keyword `$arg'" }
 	}
     }
-- 
2.17.1



More information about the Gcc-patches mailing list