diff mbox series

PowerPC -mcpu=future Patch 2 of 7, Add PLI/PADDI tests

Message ID 20200427194839.GB24986@ibm-tinman.the-meissners.org
State New
Headers show
Series PowerPC -mcpu=future Patch 2 of 7, Add PLI/PADDI tests | expand

Commit Message

Michael Meissner April 27, 2020, 7:48 p.m. UTC
Add tests for generating PLI/PADDI with -mcpu=future.

This is patch #2 of 7.  This patch was run on a little endian power8 system
running Linux and the patches succeeded.

2020-04-27  Michael Meissner  <meissner@linux.ibm.com>

	* gcc.target/powerpc/prefix-add.c: New test for -mcpu=future
	generating PADDI for large constant adds.
	* gcc.target/powerpc/prefix-di-constant.c: New test for
	-mcpu=future generating PLI to load up large DImode constants.
	* gcc.target/powerpc/prefix-si-constant.c: New test for
	-mcpu=future generating PLI to load up large SImode constants.

Comments

will schmidt April 27, 2020, 9:48 p.m. UTC | #1
On Mon, 2020-04-27 at 15:48 -0400, Michael Meissner via Gcc-patches
wrote:
> Add tests for generating PLI/PADDI with -mcpu=future.
> 
> This is patch #2 of 7.  This patch was run on a little endian power8
> system
> running Linux and the patches succeeded.
> 
> 2020-04-27  Michael Meissner  <meissner@linux.ibm.com>
> 
> 	* gcc.target/powerpc/prefix-add.c: New test for -mcpu=future
> 	generating PADDI for large constant adds.
> 	* gcc.target/powerpc/prefix-di-constant.c: New test for
> 	-mcpu=future generating PLI to load up large DImode constants.
> 	* gcc.target/powerpc/prefix-si-constant.c: New test for
> 	-mcpu=future generating PLI to load up large SImode constants.
> 
> --- /tmp/V53gPm_prefix-add.c	2020-04-27 13:51:49.231124761 -0400
> +++ gcc/testsuite/gcc.target/powerpc/prefix-add.c	2020-04-27 13:51:38.392270487 -0400
> @@ -0,0 +1,12 @@
> +/* { dg-do compile } */
> +/* { dg-require-effective-target powerpc_prefixed_addr } */
> +/* { dg-options "-O2 -mdejagnu-cpu=future" } */
> +
> +/* Test that PADDI is generated to add a large constant.  */
> +unsigned long

Just 'long' or should that be 'long long' ? 

otherwise, seems straightforward.

lgtm.

thanks,
-Will



> +add (unsigned long a)
> +{
> +  return a + 0x12345678UL;
> +}
> +
> +/* { dg-final { scan-assembler {\mpaddi\M} } } */
> --- /tmp/5x1erh_prefix-di-constant.c	2020-04-27 13:51:49.239124653 -0400
> +++ gcc/testsuite/gcc.target/powerpc/prefix-di-constant.c	2020-04-27 13:51:38.396270434 -0400
> @@ -0,0 +1,12 @@
> +/* { dg-do compile } */
> +/* { dg-require-effective-target powerpc_prefixed_addr } */
> +/* { dg-options "-O2 -mdejagnu-cpu=future" } */
> +
> +/* Test that PLI (PADDI) is generated to load a large constant.  */
> +unsigned long
> +large (void)
> +{
> +  return 0x12345678UL;
> +}
> +
> +/* { dg-final { scan-assembler {\mpli\M} } } */
> --- /tmp/NGLE4b_prefix-si-constant.c	2020-04-27 13:51:49.246124559 -0400
> +++ gcc/testsuite/gcc.target/powerpc/prefix-si-constant.c	2020-04-27 13:51:38.400270380 -0400
> @@ -0,0 +1,12 @@
> +/* { dg-do compile } */
> +/* { dg-require-effective-target powerpc_prefixed_addr } */
> +/* { dg-options "-O2 -mdejagnu-cpu=future" } */
> +
> +/* Test that PLI (PADDI) is generated to load a large constant for SImode.  */
> +void
> +large_si (unsigned int *p)
> +{
> +  *p = 0x12345U;
> +}
> +
> +/* { dg-final { scan-assembler {\mpli\M} } } */
>
Segher Boessenkool May 1, 2020, 1:50 p.m. UTC | #2
On Mon, Apr 27, 2020 at 04:48:02PM -0500, will schmidt wrote:
> On Mon, 2020-04-27 at 15:48 -0400, Michael Meissner via Gcc-patches
> wrote:
> > Add tests for generating PLI/PADDI with -mcpu=future.
> > 
> > This is patch #2 of 7.  This patch was run on a little endian power8
> > system
> > running Linux and the patches succeeded.
> > 
> > 2020-04-27  Michael Meissner  <meissner@linux.ibm.com>
> > 
> > 	* gcc.target/powerpc/prefix-add.c: New test for -mcpu=future
> > 	generating PADDI for large constant adds.
> > 	* gcc.target/powerpc/prefix-di-constant.c: New test for
> > 	-mcpu=future generating PLI to load up large DImode constants.
> > 	* gcc.target/powerpc/prefix-si-constant.c: New test for
> > 	-mcpu=future generating PLI to load up large SImode constants.
> > 
> > --- /tmp/V53gPm_prefix-add.c	2020-04-27 13:51:49.231124761 -0400
> > +++ gcc/testsuite/gcc.target/powerpc/prefix-add.c	2020-04-27 13:51:38.392270487 -0400
> > @@ -0,0 +1,12 @@
> > +/* { dg-do compile } */
> > +/* { dg-require-effective-target powerpc_prefixed_addr } */
> > +/* { dg-options "-O2 -mdejagnu-cpu=future" } */
> > +
> > +/* Test that PADDI is generated to add a large constant.  */
> > +unsigned long
> 
> Just 'long' or should that be 'long long' ? 
> 
> otherwise, seems straightforward.

The testsuite should usually use "int" and "long long", for 32-bit resp.
64-bit items, so that it works on both 32-bit and 64-bit configureations;
and "long" for register size.  Both "int" and "long" will work fine here.

The patch is okay for trunk, once the effective target situation has been
worked out.


Segher
diff mbox series

Patch

--- /tmp/V53gPm_prefix-add.c	2020-04-27 13:51:49.231124761 -0400
+++ gcc/testsuite/gcc.target/powerpc/prefix-add.c	2020-04-27 13:51:38.392270487 -0400
@@ -0,0 +1,12 @@ 
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_prefixed_addr } */
+/* { dg-options "-O2 -mdejagnu-cpu=future" } */
+
+/* Test that PADDI is generated to add a large constant.  */
+unsigned long
+add (unsigned long a)
+{
+  return a + 0x12345678UL;
+}
+
+/* { dg-final { scan-assembler {\mpaddi\M} } } */
--- /tmp/5x1erh_prefix-di-constant.c	2020-04-27 13:51:49.239124653 -0400
+++ gcc/testsuite/gcc.target/powerpc/prefix-di-constant.c	2020-04-27 13:51:38.396270434 -0400
@@ -0,0 +1,12 @@ 
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_prefixed_addr } */
+/* { dg-options "-O2 -mdejagnu-cpu=future" } */
+
+/* Test that PLI (PADDI) is generated to load a large constant.  */
+unsigned long
+large (void)
+{
+  return 0x12345678UL;
+}
+
+/* { dg-final { scan-assembler {\mpli\M} } } */
--- /tmp/NGLE4b_prefix-si-constant.c	2020-04-27 13:51:49.246124559 -0400
+++ gcc/testsuite/gcc.target/powerpc/prefix-si-constant.c	2020-04-27 13:51:38.400270380 -0400
@@ -0,0 +1,12 @@ 
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_prefixed_addr } */
+/* { dg-options "-O2 -mdejagnu-cpu=future" } */
+
+/* Test that PLI (PADDI) is generated to load a large constant for SImode.  */
+void
+large_si (unsigned int *p)
+{
+  *p = 0x12345U;
+}
+
+/* { dg-final { scan-assembler {\mpli\M} } } */