[3/3] Add power11 tests

Message ID Zo7HOdgl1pbn6lP4@cowardly-lion.the-meissners.org
State New
Headers
Series Add support for -mcpu=power11 |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gcc_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_gcc_check--master-aarch64 success Test passed
linaro-tcwg-bot/tcwg_gcc_check--master-arm success Test passed

Commit Message

Michael Meissner July 10, 2024, 5:39 p.m. UTC
  This patch is a modification of the patch posted on June 4th.  It only does a
compile of the tests, and not an assemble as suggested by Kewen.Lin.  I have
removed the power11 target support option that was previously added.

This patch adds some simple tests for -mcpu=power11 support.

I have bootstrapped these patches on both little endian and big endian systems.
There were no regressions.  Can I check these patches into the GCC 15 trunk?
After a waiting period to make sure there are no errors, can I check these
patches into the GCC 14 branch?

2024-07-10  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.
---
 gcc/testsuite/gcc.target/powerpc/power11-1.c | 12 +++++++++++
 gcc/testsuite/gcc.target/powerpc/power11-2.c | 22 ++++++++++++++++++++
 gcc/testsuite/gcc.target/powerpc/power11-3.c | 11 ++++++++++
 3 files changed, 45 insertions(+)
 create mode 100644 gcc/testsuite/gcc.target/powerpc/power11-1.c
 create mode 100644 gcc/testsuite/gcc.target/powerpc/power11-2.c
 create mode 100644 gcc/testsuite/gcc.target/powerpc/power11-3.c
  

Patch

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 00000000000..a1bd9538cba
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/power11-1.c
@@ -0,0 +1,12 @@ 
+/* { dg-do compile { target powerpc*-*-* } } */
+/* { 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 00000000000..4521c2a37c7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/power11-2.c
@@ -0,0 +1,22 @@ 
+/* Require VSX and Linux to eliminate systems where you can't do
+   __attribute__((__target__(...))).  */
+/* { dg-do compile { target { powerpc*-*-linux* } } } */
+/* { dg-require-effective-target powerpc_vsx_ok } */
+/* { 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 00000000000..abf0c5866a9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/power11-3.c
@@ -0,0 +1,11 @@ 
+/* { dg-do compile { target powerpc*-*-* } }  */
+/* Require VSX and Linux to eliminate systems where you can't do
+   __attribute__((__target_clones__(...))).  */
+/* { 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)
+{
+}