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 <meiss...@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 +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} } } */ -- 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