This is a reworking of patch V8 #5. It adds a bunch of PC-relative tests for the -mcpu=future target. https://gcc.gnu.org/ml/gcc-patches/2019-12/msg00085.html
This test passes when I run it. Can I check it in? 2019-12-20 Michael Meissner <meiss...@linux.ibm.com> * gcc.target/powerpc/prefix-pcrel.h: New set of tests to test prefixed addressing on 'future' system with PC-relative addresses for various types. * gcc.target/powerpc/prefix-pcrel-dd.c: New test for prefixed loads/stores with PC-relative addresses for the _Decimal64 type. * gcc.target/powerpc/prefix-pcrel-df.c: New test for prefixed loads/stores with PC-relative addresses for the double type. * gcc.target/powerpc/prefix-pcrel-di.c: New test for prefixed loads/stores with PC-relative addresses for the long type. * gcc.target/powerpc/prefix-pcrel-hi.c: New test for prefixed loads/stores with PC-relative addresses for the short type. * gcc.target/powerpc/prefix-pcrel-kf.c: New test for prefixed loads/stores with PC-relative addresses for the __float128 type. * gcc.target/powerpc/prefix-pcrel-qi.c: New test for prefixed loads/stores with PC-relative addresses for the signed char type. * gcc.target/powerpc/prefix-pcrel-sd.c: New test for prefixed loads/stores with PC-relative addresses for the _Decimal32 type. * gcc.target/powerpc/prefix-pcrel-sf.c: New test for prefixed loads/stores with PC-relative addresses for the float type. * gcc.target/powerpc/prefix-pcrel-si.c: New test for prefixed loads/stores with PC-relative addresses for the int type. * gcc.target/powerpc/prefix-pcrel-udi.c: New test for prefixed loads/stores with PC-relative addresses for the unsigned long type. * gcc.target/powerpc/prefix-pcrel-uhi.c: New test for prefixed loads/stores with PC-relative addresses for the unsigned short type. * gcc.target/powerpc/prefix-pcrel-uqi.c: New test for prefixed loads/stores with PC-relative addresses for the unsigned char type. * gcc.target/powerpc/prefix-pcrel-usi.c: New test for prefixed loads/stores with PC-relative addresses for the unsigned int type. * gcc.target/powerpc/prefix-pcrel-v2df.c: New test for prefixed loads/stores with PC-relative addresses for the vector double type. Index: gcc/testsuite/gcc.target/powerpc/prefix-pcrel.h =================================================================== --- gcc/testsuite/gcc.target/powerpc/prefix-pcrel.h (revision 279322) +++ gcc/testsuite/gcc.target/powerpc/prefix-pcrel.h (working copy) @@ -0,0 +1,58 @@ +/* Common tests for prefixed instructions testing whether pc-relative prefixed + instructions are generated for each type. */ + +typedef signed char schar; +typedef unsigned char uchar; +typedef unsigned short ushort; +typedef unsigned int uint; +typedef unsigned long ulong; +typedef long double ldouble; +typedef vector double v2df; +typedef vector long v2di; +typedef vector float v4sf; +typedef vector int v4si; + +#ifndef TYPE +#define TYPE ulong +#endif + +#ifndef ITYPE +#define ITYPE TYPE +#endif + +#ifndef OTYPE +#define OTYPE TYPE +#endif + +static TYPE a; +TYPE *p = &a; + +#if !defined(DO_ADD) && !defined(DO_VALUE) && !defined(DO_SET) +#define DO_ADD 1 +#define DO_VALUE 1 +#define DO_SET 1 +#endif + +#if DO_ADD +void +add (TYPE b) +{ + a += b; +} +#endif + +#if DO_VALUE +OTYPE +value (void) +{ + return (OTYPE)a; +} +#endif + +#if DO_SET +void +set (ITYPE b) +{ + a = (TYPE)b; +} +#endif Index: gcc/testsuite/gcc.target/powerpc/prefix-pcrel-dd.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/prefix-pcrel-dd.c (revision 279322) +++ gcc/testsuite/gcc.target/powerpc/prefix-pcrel-dd.c (working copy) @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target powerpc_pcrel } */ +/* { dg-options "-O2 -mdejagnu-cpu=future" } */ + +/* Tests for prefixed instructions testing whether pc-relative prefixed + instructions are generated for the _Decimal64 type. */ + +#define TYPE _Decimal64 + +#include "prefix-pcrel.h" + +/* { dg-final { scan-assembler-times {[@]pcrel} 4 } } */ +/* { dg-final { scan-assembler-times {\mplfd\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mpstfd\M} 2 } } */ Index: gcc/testsuite/gcc.target/powerpc/prefix-pcrel-df.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/prefix-pcrel-df.c (revision 279322) +++ gcc/testsuite/gcc.target/powerpc/prefix-pcrel-df.c (working copy) @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target powerpc_pcrel } */ +/* { dg-options "-O2 -mdejagnu-cpu=future" } */ + +/* Tests for prefixed instructions testing whether pc-relative prefixed + instructions are generated for the double type. */ + +#define TYPE double + +#include "prefix-pcrel.h" + +/* { dg-final { scan-assembler-times {[@]pcrel} 4 } } */ +/* { dg-final { scan-assembler-times {\mplfd\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mpstfd\M} 2 } } */ Index: gcc/testsuite/gcc.target/powerpc/prefix-pcrel-di.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/prefix-pcrel-di.c (revision 279322) +++ gcc/testsuite/gcc.target/powerpc/prefix-pcrel-di.c (working copy) @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target powerpc_pcrel } */ +/* { dg-options "-O2 -mdejagnu-cpu=future" } */ + +/* Tests for prefixed instructions testing whether pc-relative prefixed + instructions are generated for the long type. */ + +#define TYPE long + +#include "prefix-pcrel.h" + +/* { dg-final { scan-assembler-times {[@]pcrel} 4 } } */ +/* { dg-final { scan-assembler-times {\mpld\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mpstd\M} 2 } } */ Index: gcc/testsuite/gcc.target/powerpc/prefix-pcrel-hi.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/prefix-pcrel-hi.c (revision 279322) +++ gcc/testsuite/gcc.target/powerpc/prefix-pcrel-hi.c (working copy) @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target powerpc_pcrel } */ +/* { dg-options "-O2 -mdejagnu-cpu=future" } */ + +/* Tests for prefixed instructions testing whether pc-relative prefixed + instructions are generated for the short type. */ + +#define TYPE short + +#include "prefix-pcrel.h" + +/* { dg-final { scan-assembler-times {[@]pcrel} 4 } } */ +/* { dg-final { scan-assembler-times {\mplh[az]\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mpsth\M} 2 } } */ Index: gcc/testsuite/gcc.target/powerpc/prefix-pcrel-kf.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/prefix-pcrel-kf.c (revision 279322) +++ gcc/testsuite/gcc.target/powerpc/prefix-pcrel-kf.c (working copy) @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target powerpc_pcrel } */ +/* { dg-options "-O2 -mdejagnu-cpu=future" } */ + +/* Tests for prefixed instructions testing whether pc-relative prefixed + instructions are generated for the __float128 type. */ + +#define TYPE __float128 + +#include "prefix-pcrel.h" + +/* { dg-final { scan-assembler-times {[@]pcrel} 4 } } */ +/* { dg-final { scan-assembler-times {\mplxv\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mpstxv\M} 2 } } */ Index: gcc/testsuite/gcc.target/powerpc/prefix-pcrel-qi.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/prefix-pcrel-qi.c (revision 279322) +++ gcc/testsuite/gcc.target/powerpc/prefix-pcrel-qi.c (working copy) @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target powerpc_pcrel } */ +/* { dg-options "-O2 -mdejagnu-cpu=future" } */ + +/* Tests for prefixed instructions testing whether pc-relative prefixed + instructions are generated for the signed char type. */ + +#define TYPE signed char + +#include "prefix-pcrel.h" + +/* { dg-final { scan-assembler-times {[@]pcrel} 4 } } */ +/* { dg-final { scan-assembler-times {\mplbz\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mpstb\M} 2 } } */ Index: gcc/testsuite/gcc.target/powerpc/prefix-pcrel-sd.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/prefix-pcrel-sd.c (revision 279322) +++ gcc/testsuite/gcc.target/powerpc/prefix-pcrel-sd.c (working copy) @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target powerpc_pcrel } */ +/* { dg-options "-O2 -mdejagnu-cpu=future" } */ + +/* Tests for prefixed instructions testing whether pc-relative prefixed + instructions are generated for the _Decimal32 type. Note, the _Decimal32 + type will not generate any prefixed load or stores, because there is no + prefixed load/store instruction to load up a vector register as a zero + extended 32-bit integer. So we count the number load addresses that are + generated. */ + +#define TYPE _Decimal32 + +#include "prefix-pcrel.h" + +/* { dg-final { scan-assembler-times {[@]pcrel} 3 } } */ +/* { dg-final { scan-assembler-times {\mpla\M} 3 } } */ Index: gcc/testsuite/gcc.target/powerpc/prefix-pcrel-sf.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/prefix-pcrel-sf.c (revision 279322) +++ gcc/testsuite/gcc.target/powerpc/prefix-pcrel-sf.c (working copy) @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target powerpc_pcrel } */ +/* { dg-options "-O2 -mdejagnu-cpu=future" } */ + +/* Tests for prefixed instructions testing whether pc-relative prefixed + instructions are generated for the float type. */ + +#define TYPE float + +#include "prefix-pcrel.h" + +/* { dg-final { scan-assembler-times {[@]pcrel} 4 } } */ +/* { dg-final { scan-assembler-times {\mplfs\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mpstfs\M} 2 } } */ Index: gcc/testsuite/gcc.target/powerpc/prefix-pcrel-si.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/prefix-pcrel-si.c (revision 279322) +++ gcc/testsuite/gcc.target/powerpc/prefix-pcrel-si.c (working copy) @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target powerpc_pcrel } */ +/* { dg-options "-O2 -mdejagnu-cpu=future" } */ + +/* Tests for prefixed instructions testing whether pc-relative prefixed + instructions are generated for the int type. */ + +#define TYPE int + +#include "prefix-pcrel.h" + +/* { dg-final { scan-assembler-times {[@]pcrel} 4 } } */ +/* { dg-final { scan-assembler-times {\mplw[az]\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mpstw\M} 2 } } */ Index: gcc/testsuite/gcc.target/powerpc/prefix-pcrel-udi.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/prefix-pcrel-udi.c (revision 279322) +++ gcc/testsuite/gcc.target/powerpc/prefix-pcrel-udi.c (working copy) @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target powerpc_pcrel } */ +/* { dg-options "-O2 -mdejagnu-cpu=future" } */ + +/* Tests for prefixed instructions testing whether pc-relative prefixed + instructions are generated for unsigned long type. */ + +#define TYPE unsigned long + +#include "prefix-pcrel.h" + +/* { dg-final { scan-assembler-times {[@]pcrel} 4 } } */ +/* { dg-final { scan-assembler-times {\mpld\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mpstd\M} 2 } } */ Index: gcc/testsuite/gcc.target/powerpc/prefix-pcrel-uhi.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/prefix-pcrel-uhi.c (revision 279322) +++ gcc/testsuite/gcc.target/powerpc/prefix-pcrel-uhi.c (working copy) @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target powerpc_pcrel } */ +/* { dg-options "-O2 -mdejagnu-cpu=future" } */ + +/* Tests for prefixed instructions testing whether pc-relative prefixed + instructions are generated for the unsigned short type. */ + +#define TYPE unsigned short + +#include "prefix-pcrel.h" + +/* { dg-final { scan-assembler-times {[@]pcrel} 4 } } */ +/* { dg-final { scan-assembler-times {\mplhz\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mpsth\M} 2 } } */ Index: gcc/testsuite/gcc.target/powerpc/prefix-pcrel-uqi.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/prefix-pcrel-uqi.c (revision 279322) +++ gcc/testsuite/gcc.target/powerpc/prefix-pcrel-uqi.c (working copy) @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target powerpc_pcrel } */ +/* { dg-options "-O2 -mdejagnu-cpu=future" } */ + +/* Tests for prefixed instructions testing whether pc-relative prefixed + instructions are generated for the unsigned char type. */ + +#define TYPE unsigned char + +#include "prefix-pcrel.h" + +/* { dg-final { scan-assembler-times {[@]pcrel} 4 } } */ +/* { dg-final { scan-assembler-times {\mplbz\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mpstb\M} 2 } } */ Index: gcc/testsuite/gcc.target/powerpc/prefix-pcrel-usi.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/prefix-pcrel-usi.c (revision 279322) +++ gcc/testsuite/gcc.target/powerpc/prefix-pcrel-usi.c (working copy) @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target powerpc_pcrel } */ +/* { dg-options "-O2 -mdejagnu-cpu=future" } */ + +/* Tests for prefixed instructions testing whether pc-relative prefixed + instructions are generated for unsigned int type. */ + +#define TYPE unsigned int + +#include "prefix-pcrel.h" + +/* { dg-final { scan-assembler-times {[@]pcrel} 4 } } */ +/* { dg-final { scan-assembler-times {\mplwz\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mpstw\M} 2 } } */ Index: gcc/testsuite/gcc.target/powerpc/prefix-pcrel-v2df.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/prefix-pcrel-v2df.c (revision 279322) +++ gcc/testsuite/gcc.target/powerpc/prefix-pcrel-v2df.c (working copy) @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target powerpc_pcrel } */ +/* { dg-options "-O2 -mdejagnu-cpu=future" } */ + +/* Tests for prefixed instructions testing whether pc-relative prefixed + instructions are generated for the vector double type. */ + +#define TYPE vector double + +#include "prefix-pcrel.h" + +/* { dg-final { scan-assembler-times {[@]pcrel} 4 } } */ +/* { dg-final { scan-assembler-times {\mplxv\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mpstxv\M} 2 } } */ -- 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