[gcc(refs/users/meissner/heads/work169)] Add -mcpu=power11 tests.

Michael Meissner meissner@gcc.gnu.org
Mon Jun 17 18:51:19 GMT 2024


https://gcc.gnu.org/g:cf9375b72fdcbfef6a10c0c5ba32f641a60005de

commit cf9375b72fdcbfef6a10c0c5ba32f641a60005de
Author: Michael Meissner <meissner@linux.ibm.com>
Date:   Mon Jun 17 14:50:47 2024 -0400

    Add -mcpu=power11 tests.
    
    This patch adds some simple tests for -mcpu=power11 support.  In order to run
    these tests, you need an assembler that supports the appropriate option for
    supporting the Power11 processor (-mpower11 under Linux or -mpwr11 under AIX).
    
    2024-06-17  Michael Meissner  <meissner@linux.ibm.com>
    
    gcc/testsuite/
    
            * gcc.target/powerpc/power11-1.c: New test.
            * gcc.target/powerpc/power11-2.c: Likewise.
            * gcc.target/powerpc/power11-3.c: Likewise.
            * lib/target-supports.exp (check_effective_target_power11_ok): Add new
            effective target.

Diff:
---
 gcc/testsuite/gcc.target/powerpc/power11-1.c | 13 +++++++++++++
 gcc/testsuite/gcc.target/powerpc/power11-2.c | 21 +++++++++++++++++++++
 gcc/testsuite/gcc.target/powerpc/power11-3.c | 11 +++++++++++
 gcc/testsuite/lib/target-supports.exp        | 17 +++++++++++++++++
 4 files changed, 62 insertions(+)

diff --git a/gcc/testsuite/gcc.target/powerpc/power11-1.c b/gcc/testsuite/gcc.target/powerpc/power11-1.c
new file mode 100644
index 000000000000..2dd0f64ead1a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/power11-1.c
@@ -0,0 +1,13 @@
+/* { dg-do assemble { target powerpc*-*-* } } */
+/* { dg-require-effective-target power11_ok } */
+/* { dg-options "-mdejagnu-cpu=power11 -O2" } */
+
+/* Basic check to see if the compiler supports -mcpu=power11.  */
+
+#ifndef _ARCH_PWR11
+#error "-mcpu=power11 is not supported"
+#endif
+
+void foo (void)
+{
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/power11-2.c b/gcc/testsuite/gcc.target/powerpc/power11-2.c
new file mode 100644
index 000000000000..625031e91465
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/power11-2.c
@@ -0,0 +1,21 @@
+/* { dg-do assemble { target powerpc*-*-* } } */
+/* { dg-require-effective-target power11_ok } */
+/* { dg-require-effective-target target_clone } */
+/* { dg-options "-O2" } */
+
+/* Check if we can set the power11 target via a target attribute.  */
+
+__attribute__((__target__("cpu=power9")))
+void foo_p9 (void)
+{
+}
+
+__attribute__((__target__("cpu=power10")))
+void foo_p10 (void)
+{
+}
+
+__attribute__((__target__("cpu=power11")))
+void foo_p11 (void)
+{
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/power11-3.c b/gcc/testsuite/gcc.target/powerpc/power11-3.c
new file mode 100644
index 000000000000..b0f245eea035
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/power11-3.c
@@ -0,0 +1,11 @@
+/* { dg-do assemble { target powerpc*-*-* } }  */
+/* { dg-require-effective-target power11_ok } */
+/* { dg-require-effective-target target_clone } */
+/* { dg-options "-mdejagnu-cpu=power8 -O2" }  */
+
+/* Check if we can set the power11 target via a target_clones attribute.  */
+
+__attribute__((__target_clones__("cpu=power11,cpu=power9,default")))
+void foo (void)
+{
+}
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index e307f4e69efb..9d0314afe59a 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -7129,6 +7129,23 @@ proc check_effective_target_power10_ok { } {
     }
 }
 
+# Return 1 if this is a PowerPC target supporting -mcpu=power11.
+
+proc check_effective_target_power11_ok { } {
+    if { ([istarget powerpc*-*-*]) } {
+	return [check_no_compiler_messages power11_ok object {
+	    int main (void) {
+	        #ifndef _ARCH_PWR11
+		#error "-mcpu=power11 is not supported"
+		#endif
+		return 0;
+	    }
+	} "-mcpu=power11"]
+    } 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.


More information about the Gcc-cvs mailing list