rs6000: Add support for __builtin_cpu_is ("power10")

Message ID 1e6cebca-72aa-e2b3-f71e-965e0a57847e@linux.ibm.com
State New
Headers show
Series
  • rs6000: Add support for __builtin_cpu_is ("power10")
Related show

Commit Message

Peter Bergner via Gcc-patches June 25, 2020, 11:36 p.m.
rs6000: Add support for __builtin_cpu_is ("power10")

Add support for __builtin_cpu_is ("power10").  Also add documentation for
the recently added "arch_3_1" and "mma" __builtin_cpu_supports arguments.

This passed bootstrap and regtesting with no regressions.  Ok for trunk?

Peter


gcc/
	* config/rs6000/rs6000-call.c (cpu_is_info) <power10>: New.
	<mma>: Remove unneeded ','.
	* gcc/doc/extend.texi (PowerPC Built-in Functions): Document power10,
	arch_3_1 and mma.

gcc/testsuite/
	* gcc.target/powerpc/cpu-builtin-1.c: Add tests for power10, arch_3_1
	and mma.

Comments

Segher Boessenkool June 25, 2020, 11:54 p.m. | #1
Hi!

On Thu, Jun 25, 2020 at 06:36:51PM -0500, Peter Bergner wrote:
> rs6000: Add support for __builtin_cpu_is ("power10")

> 

> Add support for __builtin_cpu_is ("power10").  Also add documentation for

> the recently added "arch_3_1" and "mma" __builtin_cpu_supports arguments.


> gcc/

> 	* config/rs6000/rs6000-call.c (cpu_is_info) <power10>: New.

> 	<mma>: Remove unneeded ','.


The comma helps making the diff less for future additions (and, makes
merging/refactoring easier, that way).  A trailing comma was not allowed
with older C standards (or just with some implementations?), but it
should be fine with C++11 as we require now.  Is there something I am
missing here?

> 	* gcc/doc/extend.texi (PowerPC Built-in Functions): Document power10,

> 	arch_3_1 and mma.

> 

> gcc/testsuite/

> 	* gcc.target/powerpc/cpu-builtin-1.c: Add tests for power10, arch_3_1

> 	and mma.


> @@ -17199,6 +17201,8 @@ CPU supports ISA 2.06 (eg, POWER7)

>  CPU supports ISA 2.07 (eg, POWER8)

>  @item arch_3_00

>  CPU supports ISA 3.0 (eg, POWER9)

> +@item arch_3_1

> +CPU supports ISA 3.1 (eg, POWER10)


Nothing new apparently, but it is spelled "e.g." :-/  Oh well.

Okay for trunk (maybe leave out the comma part).  Thanks!


Segher
Peter Bergner via Gcc-patches June 26, 2020, 12:11 a.m. | #2
On 6/25/20 6:54 PM, Segher Boessenkool wrote:
> Okay for trunk (maybe leave out the comma part).  Thanks!


Ok, I pushed the patch without the ',' change.  Thanks!

Peter
Peter Bergner via Gcc-patches June 26, 2020, 7:52 a.m. | #3
On Thu, Jun 25, 2020 at 06:54:26PM -0500, Segher Boessenkool wrote:
> Hi!

> 

> On Thu, Jun 25, 2020 at 06:36:51PM -0500, Peter Bergner wrote:

> > rs6000: Add support for __builtin_cpu_is ("power10")

> > 

> > Add support for __builtin_cpu_is ("power10").  Also add documentation for

> > the recently added "arch_3_1" and "mma" __builtin_cpu_supports arguments.

> 

> > gcc/

> > 	* config/rs6000/rs6000-call.c (cpu_is_info) <power10>: New.

> > 	<mma>: Remove unneeded ','.

> 

> The comma helps making the diff less for future additions (and, makes

> merging/refactoring easier, that way).  A trailing comma was not allowed

> with older C standards (or just with some implementations?), but it

> should be fine with C++11 as we require now.  Is there something I am

> missing here?


A trailing comma has always been allowed for structure and array
initializations.  Where it is not allowed is for enumeration names.

-- 
Michael Meissner, IBM
IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA
email: meissner@linux.ibm.com, phone: +1 (978) 899-4797
Segher Boessenkool June 26, 2020, 1:41 p.m. | #4
On Fri, Jun 26, 2020 at 03:52:33AM -0400, Michael Meissner wrote:
> On Thu, Jun 25, 2020 at 06:54:26PM -0500, Segher Boessenkool wrote:

> > On Thu, Jun 25, 2020 at 06:36:51PM -0500, Peter Bergner wrote:

> > > 	* config/rs6000/rs6000-call.c (cpu_is_info) <power10>: New.

> > > 	<mma>: Remove unneeded ','.

> > 

> > The comma helps making the diff less for future additions (and, makes

> > merging/refactoring easier, that way).  A trailing comma was not allowed

> > with older C standards (or just with some implementations?), but it

> > should be fine with C++11 as we require now.  Is there something I am

> > missing here?

> 

> A trailing comma has always been allowed for structure and array

> initializations.  Where it is not allowed is for enumeration names.


It is allowed even there since C99.  But GCC never required C99 for the
host compiler, and C++ didn't get this feature until C++11, which we
require since a little over a month now!  Freedom at last!  ;-)


Segher

Patch

diff --git a/gcc/config/rs6000/rs6000-call.c b/gcc/config/rs6000/rs6000-call.c
index 3a109fe626f..4bc1e588a2f 100644
--- a/gcc/config/rs6000/rs6000-call.c
+++ b/gcc/config/rs6000/rs6000-call.c
@@ -105,6 +105,7 @@  static const struct
   const char *cpu;
   unsigned int cpuid;
 } cpu_is_info[] = {
+  { "power10",	   PPC_PLATFORM_POWER10 },
   { "power9",	   PPC_PLATFORM_POWER9 },
   { "power8",	   PPC_PLATFORM_POWER8 },
   { "power7",	   PPC_PLATFORM_POWER7 },
@@ -174,7 +175,7 @@  static const struct
   { "darn",		PPC_FEATURE2_DARN,		1 },
   { "scv",		PPC_FEATURE2_SCV,		1 },
   { "arch_3_1",		PPC_FEATURE2_ARCH_3_1,		1 },
-  { "mma",		PPC_FEATURE2_MMA,		1 },
+  { "mma",		PPC_FEATURE2_MMA,		1 }
 };
 
 static void altivec_init_builtins (void);
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 95f7192e41e..343fbba8223 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -17123,6 +17123,8 @@  issues a warning.
 The following CPU names can be detected:
 
 @table @samp
+@item power10
+IBM POWER10 Server CPU.
 @item power9
 IBM POWER9 Server CPU.
 @item power8
@@ -17199,6 +17201,8 @@  CPU supports ISA 2.06 (eg, POWER7)
 CPU supports ISA 2.07 (eg, POWER8)
 @item arch_3_00
 CPU supports ISA 3.0 (eg, POWER9)
+@item arch_3_1
+CPU supports ISA 3.1 (eg, POWER10)
 @item archpmu
 CPU supports the set of compatible performance monitoring events.
 @item booke
@@ -17232,6 +17236,8 @@  CPU supports icache snooping capabilities.
 CPU supports 128-bit IEEE binary floating point instructions.
 @item isel
 CPU supports the integer select instruction.
+@item mma
+CPU supports the matrix-multiply assist instructions.
 @item mmu
 CPU has a memory management unit.
 @item notb
diff --git a/gcc/testsuite/gcc.target/powerpc/cpu-builtin-1.c b/gcc/testsuite/gcc.target/powerpc/cpu-builtin-1.c
index 960e7fb4f5f..2bcf6f679da 100644
--- a/gcc/testsuite/gcc.target/powerpc/cpu-builtin-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/cpu-builtin-1.c
@@ -24,6 +24,7 @@  use_cpu_is_builtins (unsigned int *p)
   p[12] = __builtin_cpu_is ("ppc440");
   p[13] = __builtin_cpu_is ("ppc405");
   p[14] = __builtin_cpu_is ("ppc-cell-be");
+  p[15] = __builtin_cpu_is ("power10");
 #else
   p[0] = 0;
 #endif
@@ -74,6 +75,8 @@  use_cpu_supports_builtins (unsigned int *p)
   p[38] = __builtin_cpu_supports ("darn");
   p[39] = __builtin_cpu_supports ("scv");
   p[40] = __builtin_cpu_supports ("htm-no-suspend");
+  p[41] = __builtin_cpu_supports ("arch_3_1");
+  p[42] = __builtin_cpu_supports ("mma");
 #else
   p[0] = 0;
 #endif