aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Meissner <meissner@linux.ibm.com>2020-06-09 15:32:52 -0500
committerMichael Meissner <meissner@linux.ibm.com>2020-06-09 15:32:52 -0500
commit2753f2f8b4a4534ab364595ba4b8a913cc7254a7 (patch)
tree714527389d0d6d26c2d3f47527bea1f2034427fa
parent7ba33e898fa4a097c0f2b4d9cae35041a5933f9c (diff)
downloadgcc-2753f2f8b4a4534ab364595ba4b8a913cc7254a7.zip
gcc-2753f2f8b4a4534ab364595ba4b8a913cc7254a7.tar.gz
gcc-2753f2f8b4a4534ab364595ba4b8a913cc7254a7.tar.bz2
PowerPC: Add future hwcap2 bits
This patch adds support for the two new HWCAP2 fields used by the __builtin_cpu_supports function. It adds support in the target_clones attribute for -mcpu=future. The two new __builtin_cpu_supports tests are: __builtin_cpu_supports ("isa_3_1") __builtin_cpu_supports ("mma") The bits used are the bits that the Linux kernel engineers will be using for these new features. testsuite/ 2020-06-05 Michael Meissner <meissner@linux.ibm.com> * gcc.target/powerpc/clone3.c: New test for using 'future' with the target_clones attribute.
-rw-r--r--gcc/testsuite/gcc.target/powerpc/clone3.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/powerpc/clone3.c b/gcc/testsuite/gcc.target/powerpc/clone3.c
new file mode 100644
index 0000000..93ee41d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/clone3.c
@@ -0,0 +1,33 @@
+/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */
+/* { dg-options "-mdejagnu-cpu=power8 -O2" } */
+/* { dg-require-effective-target powerpc_pcrel } */
+/* { dg-require-effective-target ppc_cpu_supports_hw } */
+
+/* Power9 (aka, ISA 3.0) has a MODSD instruction to do modulus, while Power8
+ (aka, ISA 2.07) has to do modulus with divide and multiply. Make sure
+ both clone functions are generated.
+
+ FUTURE has pc-relative instructions to access static values, while earlier
+ systems used TOC addressing.
+
+ Restrict ourselves to Linux, since IFUNC might not be supported in other
+ operating systems. */
+
+static long s;
+long *p = &s;
+
+__attribute__((target_clones("cpu=future,cpu=power9,default")))
+long mod_func (long a, long b)
+{
+ return (a % b) + s;
+}
+
+long mod_func_or (long a, long b, long c)
+{
+ return mod_func (a, b) | c;
+}
+
+/* { dg-final { scan-assembler-times {\mdivd\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mmulld\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mmodsd\M} 2 } } */
+/* { dg-final { scan-assembler-times {\mpld\M} 1 } } */