This patch adds tests for all of the types using large address offsets that would not fit into 16 bits, and verifies that prefixed instructions are generated.
The tests in this patch all succeed when patches 1-7 are applied on a little endian power8 system. Can I check these patches into the trunk when the previous patches have been applied? 2019-08-14 Michael Meissner <meiss...@linux.ibm.com> * gcc/testsuite/gcc.target/powerpc/prefix-large.h: New set of tests to test prefixed addressing on 'future' system with large numeric offsets. * gcc/testsuite/gcc.target/powerpc/prefix-large-dd.c: New test. * gcc/testsuite/gcc.target/powerpc/prefix-large-df.c: New test. * gcc/testsuite/gcc.target/powerpc/prefix-large-di.c: New test. * gcc/testsuite/gcc.target/powerpc/prefix-large-hi.c: New test. * gcc/testsuite/gcc.target/powerpc/prefix-large-kf.c: New test. * gcc/testsuite/gcc.target/powerpc/prefix-large-qi.c: New test. * gcc/testsuite/gcc.target/powerpc/prefix-large-sd.c: New test. * gcc/testsuite/gcc.target/powerpc/prefix-large-sf.c: New test. * gcc/testsuite/gcc.target/powerpc/prefix-large-si.c: New test. * gcc/testsuite/gcc.target/powerpc/prefix-large-udi.c: New test. * gcc/testsuite/gcc.target/powerpc/prefix-large-uhi.c: New test. * gcc/testsuite/gcc.target/powerpc/prefix-large-uqi.c: New test. * gcc/testsuite/gcc.target/powerpc/prefix-large-usi.c: New test. * gcc/testsuite/gcc.target/powerpc/prefix-large-v2df.c: New test. Index: gcc/testsuite/gcc.target/powerpc/prefix-large-dd.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/prefix-large-dd.c (revision 0) +++ gcc/testsuite/gcc.target/powerpc/prefix-large-dd.c (working copy) @@ -0,0 +1,13 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-require-effective-target powerpc_future_ok } */ +/* { dg-options "-O2 -mdejagnu-cpu=future" } */ + +/* Tests for prefixed instructions testing whether we can generate a prefixed + load/store instruction that has a 34-bit offset. */ + +#define TYPE _Decimal64 + +#include "prefix-large.h" + +/* { dg-final { scan-assembler-times {\mplfd\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mpstfd\M} 2 } } */ Index: gcc/testsuite/gcc.target/powerpc/prefix-large-df.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/prefix-large-df.c (revision 0) +++ gcc/testsuite/gcc.target/powerpc/prefix-large-df.c (working copy) @@ -0,0 +1,13 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-require-effective-target powerpc_future_ok } */ +/* { dg-options "-O2 -mdejagnu-cpu=future" } */ + +/* Tests for prefixed instructions testing whether we can generate a prefixed + load/store instruction that has a 34-bit offset. */ + +#define TYPE double + +#include "prefix-large.h" + +/* { dg-final { scan-assembler-times {\mplfd\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mpstfd\M} 2 } } */ Index: gcc/testsuite/gcc.target/powerpc/prefix-large-di.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/prefix-large-di.c (revision 0) +++ gcc/testsuite/gcc.target/powerpc/prefix-large-di.c (working copy) @@ -0,0 +1,13 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-require-effective-target powerpc_future_ok } */ +/* { dg-options "-O2 -mdejagnu-cpu=future" } */ + +/* Tests for prefixed instructions testing whether we can generate a prefixed + load/store instruction that has a 34-bit offset. */ + +#define TYPE long + +#include "prefix-large.h" + +/* { dg-final { scan-assembler-times {\mpld\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mpstd\M} 2 } } */ Index: gcc/testsuite/gcc.target/powerpc/prefix-large-hi.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/prefix-large-hi.c (revision 0) +++ gcc/testsuite/gcc.target/powerpc/prefix-large-hi.c (working copy) @@ -0,0 +1,13 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-require-effective-target powerpc_future_ok } */ +/* { dg-options "-O2 -mdejagnu-cpu=future" } */ + +/* Tests for prefixed instructions testing whether we can generate a prefixed + load/store instruction that has a 34-bit offset. */ + +#define TYPE short + +#include "prefix-large.h" + +/* { dg-final { scan-assembler-times {\mplh[az]\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mpsth\M} 2 } } */ Index: gcc/testsuite/gcc.target/powerpc/prefix-large-kf.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/prefix-large-kf.c (revision 0) +++ gcc/testsuite/gcc.target/powerpc/prefix-large-kf.c (working copy) @@ -0,0 +1,13 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-require-effective-target powerpc_future_ok } */ +/* { dg-options "-O2 -mdejagnu-cpu=future" } */ + +/* Tests for prefixed instructions testing whether we can generate a prefixed + load/store instruction that has a 34-bit offset. */ + +#define TYPE __float128 + +#include "prefix-large.h" + +/* { dg-final { scan-assembler-times {\mplxv\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mpstxv\M} 2 } } */ Index: gcc/testsuite/gcc.target/powerpc/prefix-large-qi.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/prefix-large-qi.c (revision 0) +++ gcc/testsuite/gcc.target/powerpc/prefix-large-qi.c (working copy) @@ -0,0 +1,13 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-require-effective-target powerpc_future_ok } */ +/* { dg-options "-O2 -mdejagnu-cpu=future" } */ + +/* Tests for prefixed instructions testing whether we can generate a prefixed + load/store instruction that has a 34-bit offset. */ + +#define TYPE signed char + +#include "prefix-large.h" + +/* { dg-final { scan-assembler-times {\mplbz\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mpstb\M} 2 } } */ Index: gcc/testsuite/gcc.target/powerpc/prefix-large-sd.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/prefix-large-sd.c (revision 0) +++ gcc/testsuite/gcc.target/powerpc/prefix-large-sd.c (working copy) @@ -0,0 +1,16 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-require-effective-target powerpc_future_ok } */ +/* { dg-options "-O2 -mdejagnu-cpu=future" } */ + +/* Tests for prefixed instructions testing whether we can generate a prefixed + load/store instruction that has a 34-bit offset. */ + +#define TYPE _Decimal32 + +#include "prefix-large.h" + +/* { dg-final { scan-assembler-times {\mpaddi\M|\mpli|\mpla\M} 3 } } */ +/* { dg-final { scan-assembler-times {\mlfiwzx\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mstfiwx\M} 2 } } */ + + Index: gcc/testsuite/gcc.target/powerpc/prefix-large-sf.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/prefix-large-sf.c (revision 0) +++ gcc/testsuite/gcc.target/powerpc/prefix-large-sf.c (working copy) @@ -0,0 +1,13 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-require-effective-target powerpc_future_ok } */ +/* { dg-options "-O2 -mdejagnu-cpu=future" } */ + +/* Tests for prefixed instructions testing whether we can generate a prefixed + load/store instruction that has a 34-bit offset. */ + +#define TYPE float + +#include "prefix-large.h" + +/* { dg-final { scan-assembler-times {\mplfs\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mpstfs\M} 2 } } */ Index: gcc/testsuite/gcc.target/powerpc/prefix-large-si.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/prefix-large-si.c (revision 0) +++ gcc/testsuite/gcc.target/powerpc/prefix-large-si.c (working copy) @@ -0,0 +1,13 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-require-effective-target powerpc_future_ok } */ +/* { dg-options "-O2 -mdejagnu-cpu=future" } */ + +/* Tests for prefixed instructions testing whether we can generate a prefixed + load/store instruction that has a 34-bit offset. */ + +#define TYPE int + +#include "prefix-large.h" + +/* { dg-final { scan-assembler-times {\mplw[az]\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mpstw\M} 2 } } */ Index: gcc/testsuite/gcc.target/powerpc/prefix-large-udi.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/prefix-large-udi.c (revision 0) +++ gcc/testsuite/gcc.target/powerpc/prefix-large-udi.c (working copy) @@ -0,0 +1,13 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-require-effective-target powerpc_future_ok } */ +/* { dg-options "-O2 -mdejagnu-cpu=future" } */ + +/* Tests for prefixed instructions testing whether we can generate a prefixed + load/store instruction that has a 34-bit offset. */ + +#define TYPE unsigned long + +#include "prefix-large.h" + +/* { dg-final { scan-assembler-times {\mpld\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mpstd\M} 2 } } */ Index: gcc/testsuite/gcc.target/powerpc/prefix-large-uhi.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/prefix-large-uhi.c (revision 0) +++ gcc/testsuite/gcc.target/powerpc/prefix-large-uhi.c (working copy) @@ -0,0 +1,13 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-require-effective-target powerpc_future_ok } */ +/* { dg-options "-O2 -mdejagnu-cpu=future" } */ + +/* Tests for prefixed instructions testing whether we can generate a prefixed + load/store instruction that has a 34-bit offset. */ + +#define TYPE unsigned short + +#include "prefix-large.h" + +/* { dg-final { scan-assembler-times {\mplhz\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mpsth\M} 2 } } */ Index: gcc/testsuite/gcc.target/powerpc/prefix-large-uqi.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/prefix-large-uqi.c (revision 0) +++ gcc/testsuite/gcc.target/powerpc/prefix-large-uqi.c (working copy) @@ -0,0 +1,13 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-require-effective-target powerpc_future_ok } */ +/* { dg-options "-O2 -mdejagnu-cpu=future" } */ + +/* Tests for prefixed instructions testing whether we can generate a prefixed + load/store instruction that has a 34-bit offset. */ + +#define TYPE unsigned char + +#include "prefix-large.h" + +/* { dg-final { scan-assembler-times {\mplbz\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mpstb\M} 2 } } */ Index: gcc/testsuite/gcc.target/powerpc/prefix-large-usi.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/prefix-large-usi.c (revision 0) +++ gcc/testsuite/gcc.target/powerpc/prefix-large-usi.c (working copy) @@ -0,0 +1,13 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-require-effective-target powerpc_future_ok } */ +/* { dg-options "-O2 -mdejagnu-cpu=future" } */ + +/* Tests for prefixed instructions testing whether we can generate a prefixed + load/store instruction that has a 34-bit offset. */ + +#define TYPE unsigned int + +#include "prefix-large.h" + +/* { dg-final { scan-assembler-times {\mplwz\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mpstw\M} 2 } } */ Index: gcc/testsuite/gcc.target/powerpc/prefix-large-v2df.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/prefix-large-v2df.c (revision 0) +++ gcc/testsuite/gcc.target/powerpc/prefix-large-v2df.c (working copy) @@ -0,0 +1,13 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-require-effective-target powerpc_future_ok } */ +/* { dg-options "-O2 -mdejagnu-cpu=future" } */ + +/* Tests for prefixed instructions testing whether we can generate a prefixed + load/store instruction that has a 34-bit offset. */ + +#define TYPE vector double + +#include "prefix-large.h" + +/* { dg-final { scan-assembler-times {\mplxv\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mpstxv\M} 2 } } */ Index: gcc/testsuite/gcc.target/powerpc/prefix-large.h =================================================================== --- gcc/testsuite/gcc.target/powerpc/prefix-large.h (revision 0) +++ gcc/testsuite/gcc.target/powerpc/prefix-large.h (working copy) @@ -0,0 +1,59 @@ +/* Common tests for prefixed instructions testing whether we can generate a + 34-bit offset using 1 instruction. */ + +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 + +#if !defined(DO_ADD) && !defined(DO_VALUE) && !defined(DO_SET) +#define DO_ADD 1 +#define DO_VALUE 1 +#define DO_SET 1 +#endif + +#ifndef CONSTANT +#define CONSTANT 0x123450UL +#endif + +#if DO_ADD +void +add (TYPE *p, TYPE a) +{ + p[CONSTANT] += a; +} +#endif + +#if DO_VALUE +OTYPE +value (TYPE *p) +{ + return p[CONSTANT]; +} +#endif + +#if DO_SET +void +set (TYPE *p, ITYPE a) +{ + p[CONSTANT] = a; +} +#endif -- 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