This patch adds 3 tests that tests whether PLI (PADDI) is generated to load up
DImode constants, load up SImode constants, and adding 34-bit constants.

Once the appropriate patches to generate this code have been checked in (V7,
#1-3), can I check these new tests into the FSF trunk?

2019-11-14   Michael Meissner  <meiss...@linux.ibm.com>

        * gcc.target/powerpc/paddi-1.c: New test to test using PLI to
        load up a large DImode constant.
        * gcc.target/powerpc/paddi-2.c: New test to test using PLI to
        load up a large SImode constant.
        * gcc.target/powerpc/paddi-3.c: New test to test using PADDI to
        add a large DImode constant.

--- /tmp/s2UNQW_paddi-1.c       2019-11-13 17:39:21.274807246 -0500
+++ gcc/testsuite/gcc.target/powerpc/paddi-1.c  2019-11-13 17:39:21.067805382 
-0500
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_prefixed_addr_ok } */
+/* { 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/T53ePo_paddi-2.c       2019-11-13 17:39:21.283807328 -0500
+++ gcc/testsuite/gcc.target/powerpc/paddi-2.c  2019-11-13 17:39:21.069805400 
-0500
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_prefixed_addr_ok } */
+/* { 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/gyt7OQ_paddi-3.c       2019-11-13 17:39:21.291807400 -0500
+++ gcc/testsuite/gcc.target/powerpc/paddi-3.c  2019-11-13 17:39:21.071805418 
-0500
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_prefixed_addr_ok } */
+/* { 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} } } */


-- 
Michael Meissner, IBM
IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA
email: meiss...@linux.ibm.com, phone: +1 (978) 899-4797

Reply via email to