• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#objective-cqtwindows誰得cocoapythonphprubygameguibathyscaphec翻訳omegat計画中(planning stage)frameworktwittertestdomvb.netdirectxbtronarduinopreviewerゲームエンジン

GCC with patches for OS216


Commit MetaInfo

Revision7549286a494ef8bc4c1107724735ca867c19cefb (tree)
Zeit2020-07-03 02:29:07
AutorMichael Meissner <meissner@linu...>
CommiterPeter Bergner

Log Message

PowerPC: Add power10 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=power10.

The two new builtin_cpu_supports tests are:
builtin_cpu_supports ("arch_3_1")
builtin_cpu_supports ("mma")

The bits used are the bits that the Linux kernel engineers will be using for
these new features.

2020-06-05 Michael Meissner <meissner@linux.ibm.com>

gcc/
* config/rs6000/ppc-auxv.h (PPC_PLATFORM_POWER10): Allocate
'power10' PowerPC platform.
(PPC_FEATURE2_ARCH_3_1): New HWCAP2 bit for ARCH 3.1.
(PPC_FEATURE2_MMA): New HWCAP2 bit for MMA.
* config/rs6000/rs6000-call.c (cpu_supports_info): Add ARCH 3.1 and
MMA HWCAP2 bits.

gcc/testsuite/
* gcc.target/powerpc/clone3.c: New test for using 'power10' with
the target_clones attribute.

(cherry picked from commit 2753f2f8b4a4534ab364595ba4b8a913cc7254a7)
(cherry picked from commit 7ba33e898fa4a097c0f2b4d9cae35041a5933f9c)

Ändern Zusammenfassung

Diff

--- a/gcc/config/rs6000/ppc-auxv.h
+++ b/gcc/config/rs6000/ppc-auxv.h
@@ -48,6 +48,9 @@
4848 #define PPC_PLATFORM_POWER8 13
4949 #define PPC_PLATFORM_POWER9 14
5050
51+/* This is not yet official. */
52+#define PPC_PLATFORM_POWER10 15
53+
5154 /* AT_HWCAP bits. These must match the values defined in the Linux kernel. */
5255 #define PPC_FEATURE_32 0x80000000
5356 #define PPC_FEATURE_64 0x40000000
@@ -93,6 +96,9 @@
9396 #define PPC_FEATURE2_SCV 0x00100000
9497 #define PPC_FEATURE2_HTM_NO_SUSPEND 0x00080000
9598
99+/* These are not yet official. */
100+#define PPC_FEATURE2_ARCH_3_1 0x00040000
101+#define PPC_FEATURE2_MMA 0x00020000
96102
97103 /* Thread Control Block (TCB) offsets of the AT_PLATFORM, AT_HWCAP and
98104 AT_HWCAP2 values. These must match the values defined in GLIBC. */
--- a/gcc/config/rs6000/rs6000-call.c
+++ b/gcc/config/rs6000/rs6000-call.c
@@ -172,7 +172,9 @@ static const struct
172172 { "arch_3_00", PPC_FEATURE2_ARCH_3_00, 1 },
173173 { "ieee128", PPC_FEATURE2_HAS_IEEE128, 1 },
174174 { "darn", PPC_FEATURE2_DARN, 1 },
175- { "scv", PPC_FEATURE2_SCV, 1 }
175+ { "scv", PPC_FEATURE2_SCV, 1 },
176+ { "arch_3_1", PPC_FEATURE2_ARCH_3_1, 1 },
177+ { "mma", PPC_FEATURE2_MMA, 1 },
176178 };
177179
178180 static void altivec_init_builtins (void);
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/clone3.c
@@ -0,0 +1,33 @@
1+/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */
2+/* { dg-options "-mdejagnu-cpu=power8 -O2" } */
3+/* { dg-require-effective-target powerpc_pcrel } */
4+/* { dg-require-effective-target ppc_cpu_supports_hw } */
5+
6+/* Power9 (aka, ISA 3.0) has a MODSD instruction to do modulus, while Power8
7+ (aka, ISA 2.07) has to do modulus with divide and multiply. Make sure
8+ both clone functions are generated.
9+
10+ POWER10 has pc-relative instructions to access static values, while earlier
11+ systems used TOC addressing.
12+
13+ Restrict ourselves to Linux, since IFUNC might not be supported in other
14+ operating systems. */
15+
16+static long s;
17+long *p = &s;
18+
19+__attribute__((target_clones("cpu=power10,cpu=power9,default")))
20+long mod_func (long a, long b)
21+{
22+ return (a % b) + s;
23+}
24+
25+long mod_func_or (long a, long b, long c)
26+{
27+ return mod_func (a, b) | c;
28+}
29+
30+/* { dg-final { scan-assembler-times {\mdivd\M} 1 } } */
31+/* { dg-final { scan-assembler-times {\mmulld\M} 1 } } */
32+/* { dg-final { scan-assembler-times {\mmodsd\M} 2 } } */
33+/* { dg-final { scan-assembler-times {\mpld\M} 1 } } */