Backport Power10 prefix tests with large offsets. These tests test whether a prefixed instruction is generated if the offset is larger than the 16-bits used by the traditional instructions, but smaller than the 34-bit limit of the prefixed instructions. These tests have been on the master branch since June, and no changes were needed for GCC 10. Can I check these into the GCC 10 branch?
gcc/testsuite/ 2020-08-03 Michael Meissner <meiss...@linux.ibm.com> Backport from the master branch: 2020-06-28 David Edelsohn <dje....@gmail.com> * gcc.target/powerpc/prefix-large-dd.c: Require DFP. * gcc.target/powerpc/prefix-large-sd.c: Require DFP. * gcc.target/powerpc/prefix-large-kf.c: Require float128. 2020-06-27 Michael Meissner <meiss...@linux.ibm.com> * gcc.target/powerpc/prefix-large-dd.c: New test. * gcc.target/powerpc/prefix-large-df.c: New test. * gcc.target/powerpc/prefix-large-di.c: New test. * gcc.target/powerpc/prefix-large-hi.c: New test. * gcc.target/powerpc/prefix-large-kf.c: New test. * gcc.target/powerpc/prefix-large-qi.c: New test. * gcc.target/powerpc/prefix-large-sd.c: New test. * gcc.target/powerpc/prefix-large-sf.c: New test. * gcc.target/powerpc/prefix-large-si.c: New test. * gcc.target/powerpc/prefix-large-udi.c: New test. * gcc.target/powerpc/prefix-large-uhi.c: New test. * gcc.target/powerpc/prefix-large-uqi.c: New test. * gcc.target/powerpc/prefix-large-usi.c: New test. * gcc.target/powerpc/prefix-large-v2df.c: New test. * gcc.target/powerpc/prefix-large.h: Include file for new tests. --- gcc/testsuite/gcc.target/powerpc/prefix-large-dd.c | 14 ++++++++ gcc/testsuite/gcc.target/powerpc/prefix-large-df.c | 13 +++++++ gcc/testsuite/gcc.target/powerpc/prefix-large-di.c | 14 ++++++++ gcc/testsuite/gcc.target/powerpc/prefix-large-hi.c | 13 +++++++ gcc/testsuite/gcc.target/powerpc/prefix-large-kf.c | 14 ++++++++ gcc/testsuite/gcc.target/powerpc/prefix-large-qi.c | 13 +++++++ gcc/testsuite/gcc.target/powerpc/prefix-large-sd.c | 20 +++++++++++ gcc/testsuite/gcc.target/powerpc/prefix-large-sf.c | 13 +++++++ gcc/testsuite/gcc.target/powerpc/prefix-large-si.c | 13 +++++++ .../gcc.target/powerpc/prefix-large-udi.c | 14 ++++++++ .../gcc.target/powerpc/prefix-large-uhi.c | 13 +++++++ .../gcc.target/powerpc/prefix-large-uqi.c | 13 +++++++ .../gcc.target/powerpc/prefix-large-usi.c | 13 +++++++ .../gcc.target/powerpc/prefix-large-v2df.c | 13 +++++++ gcc/testsuite/gcc.target/powerpc/prefix-large.h | 40 ++++++++++++++++++++++ 15 files changed, 233 insertions(+) create mode 100644 gcc/testsuite/gcc.target/powerpc/prefix-large-dd.c create mode 100644 gcc/testsuite/gcc.target/powerpc/prefix-large-df.c create mode 100644 gcc/testsuite/gcc.target/powerpc/prefix-large-di.c create mode 100644 gcc/testsuite/gcc.target/powerpc/prefix-large-hi.c create mode 100644 gcc/testsuite/gcc.target/powerpc/prefix-large-kf.c create mode 100644 gcc/testsuite/gcc.target/powerpc/prefix-large-qi.c create mode 100644 gcc/testsuite/gcc.target/powerpc/prefix-large-sd.c create mode 100644 gcc/testsuite/gcc.target/powerpc/prefix-large-sf.c create mode 100644 gcc/testsuite/gcc.target/powerpc/prefix-large-si.c create mode 100644 gcc/testsuite/gcc.target/powerpc/prefix-large-udi.c create mode 100644 gcc/testsuite/gcc.target/powerpc/prefix-large-uhi.c create mode 100644 gcc/testsuite/gcc.target/powerpc/prefix-large-uqi.c create mode 100644 gcc/testsuite/gcc.target/powerpc/prefix-large-usi.c create mode 100644 gcc/testsuite/gcc.target/powerpc/prefix-large-v2df.c create mode 100644 gcc/testsuite/gcc.target/powerpc/prefix-large.h diff --git a/gcc/testsuite/gcc.target/powerpc/prefix-large-dd.c b/gcc/testsuite/gcc.target/powerpc/prefix-large-dd.c new file mode 100644 index 0000000..a498b18 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/prefix-large-dd.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target powerpc_prefixed_addr } */ +/* { dg-require-effective-target dfp } */ +/* { dg-options "-O2 -mdejagnu-cpu=power10" } */ + +/* Tests whether prefixed instructions with large numeric offsets are generated + for the _Decimal64 type. */ + +#define TYPE _Decimal64 + +#include "prefix-large.h" + +/* { dg-final { scan-assembler-times {\mplfd\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mpstfd\M} 2 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/prefix-large-df.c b/gcc/testsuite/gcc.target/powerpc/prefix-large-df.c new file mode 100644 index 0000000..49a049b --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/prefix-large-df.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target powerpc_prefixed_addr } */ +/* { dg-options "-O2 -mdejagnu-cpu=power10" } */ + +/* Tests whether prefixed instructions with large numeric offsets are generated + for the double type. */ + +#define TYPE double + +#include "prefix-large.h" + +/* { dg-final { scan-assembler-times {\mplfd\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mpstfd\M} 2 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/prefix-large-di.c b/gcc/testsuite/gcc.target/powerpc/prefix-large-di.c new file mode 100644 index 0000000..399f696 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/prefix-large-di.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target powerpc_prefixed_addr } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-options "-O2 -mdejagnu-cpu=power10" } */ + +/* Tests whether prefixed instructions with large numeric offsets are generated + for the long long type. */ + +#define TYPE long long + +#include "prefix-large.h" + +/* { dg-final { scan-assembler-times {\mpld\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mpstd\M} 2 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/prefix-large-hi.c b/gcc/testsuite/gcc.target/powerpc/prefix-large-hi.c new file mode 100644 index 0000000..18380ca --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/prefix-large-hi.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target powerpc_prefixed_addr } */ +/* { dg-options "-O2 -mdejagnu-cpu=power10" } */ + +/* Tests whether prefixed instructions with large numeric offsets are generated + for the short type. */ + +#define TYPE short + +#include "prefix-large.h" + +/* { dg-final { scan-assembler-times {\mplh[az]\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mpsth\M} 2 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/prefix-large-kf.c b/gcc/testsuite/gcc.target/powerpc/prefix-large-kf.c new file mode 100644 index 0000000..42ec7b7 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/prefix-large-kf.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target powerpc_prefixed_addr } */ +/* { dg-require-effective-target float128 } */ +/* { dg-options "-O2 -mdejagnu-cpu=power10" } */ + +/* Tests whether prefixed instructions with large numeric offsets are generated + for the _Float128 type. */ + +#define TYPE _Float128 + +#include "prefix-large.h" + +/* { dg-final { scan-assembler-times {\mplxv\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mpstxv\M} 2 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/prefix-large-qi.c b/gcc/testsuite/gcc.target/powerpc/prefix-large-qi.c new file mode 100644 index 0000000..24cdac1 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/prefix-large-qi.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target powerpc_prefixed_addr } */ +/* { dg-options "-O2 -mdejagnu-cpu=power10" } */ + +/* Tests whether prefixed instructions with large numeric offsets are generated + for the signed char type. */ + +#define TYPE signed char + +#include "prefix-large.h" + +/* { dg-final { scan-assembler-times {\mplbz\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mpstb\M} 2 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/prefix-large-sd.c b/gcc/testsuite/gcc.target/powerpc/prefix-large-sd.c new file mode 100644 index 0000000..bc992ee --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/prefix-large-sd.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target powerpc_prefixed_addr } */ +/* { dg-require-effective-target dfp } */ +/* { dg-options "-O2 -mdejagnu-cpu=power10" } */ + +/* Tests whether prefixed instructions with large numeric offsets 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 of load addresses that are generated. */ + +#define TYPE _Decimal32 + +#include "prefix-large.h" + +/* { dg-final { scan-assembler-times {\mpli\M} 3 } } */ +/* { dg-final { scan-assembler-times {\mlfiwzx\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mstfiwx\M} 2 } } */ + + diff --git a/gcc/testsuite/gcc.target/powerpc/prefix-large-sf.c b/gcc/testsuite/gcc.target/powerpc/prefix-large-sf.c new file mode 100644 index 0000000..9fde1f0 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/prefix-large-sf.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target powerpc_prefixed_addr } */ +/* { dg-options "-O2 -mdejagnu-cpu=power10" } */ + +/* Tests whether prefixed instructions with large numeric offsets are generated + for the float type. */ + +#define TYPE float + +#include "prefix-large.h" + +/* { dg-final { scan-assembler-times {\mplfs\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mpstfs\M} 2 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/prefix-large-si.c b/gcc/testsuite/gcc.target/powerpc/prefix-large-si.c new file mode 100644 index 0000000..876a013 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/prefix-large-si.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target powerpc_prefixed_addr } */ +/* { dg-options "-O2 -mdejagnu-cpu=power10" } */ + +/* Tests whether prefixed instructions with large numeric offsets are generated + for the _Decimal64 type. */ + +#define TYPE int + +#include "prefix-large.h" + +/* { dg-final { scan-assembler-times {\mplw[az]\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mpstw\M} 2 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/prefix-large-udi.c b/gcc/testsuite/gcc.target/powerpc/prefix-large-udi.c new file mode 100644 index 0000000..e6365d3 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/prefix-large-udi.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target powerpc_prefixed_addr } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-options "-O2 -mdejagnu-cpu=power10" } */ + +/* Tests whether prefixed instructions with large numeric offsets are generated + for the unsigned long long type. */ + +#define TYPE unsigned long long + +#include "prefix-large.h" + +/* { dg-final { scan-assembler-times {\mpld\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mpstd\M} 2 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/prefix-large-uhi.c b/gcc/testsuite/gcc.target/powerpc/prefix-large-uhi.c new file mode 100644 index 0000000..3523767 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/prefix-large-uhi.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target powerpc_prefixed_addr } */ +/* { dg-options "-O2 -mdejagnu-cpu=power10" } */ + +/* Tests whether prefixed instructions with large numeric offsets are generated + for the unsigned short type. */ + +#define TYPE unsigned short + +#include "prefix-large.h" + +/* { dg-final { scan-assembler-times {\mplhz\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mpsth\M} 2 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/prefix-large-uqi.c b/gcc/testsuite/gcc.target/powerpc/prefix-large-uqi.c new file mode 100644 index 0000000..f251c4a --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/prefix-large-uqi.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target powerpc_prefixed_addr } */ +/* { dg-options "-O2 -mdejagnu-cpu=power10" } */ + +/* Tests whether prefixed instructions with large numeric offsets are generated + for the unsigned char type. */ + +#define TYPE unsigned char + +#include "prefix-large.h" + +/* { dg-final { scan-assembler-times {\mplbz\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mpstb\M} 2 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/prefix-large-usi.c b/gcc/testsuite/gcc.target/powerpc/prefix-large-usi.c new file mode 100644 index 0000000..d60036d --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/prefix-large-usi.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target powerpc_prefixed_addr } */ +/* { dg-options "-O2 -mdejagnu-cpu=power10" } */ + +/* Tests whether prefixed instructions with large numeric offsets are generated + for the unsigned int type. */ + +#define TYPE unsigned int + +#include "prefix-large.h" + +/* { dg-final { scan-assembler-times {\mplwz\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mpstw\M} 2 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/prefix-large-v2df.c b/gcc/testsuite/gcc.target/powerpc/prefix-large-v2df.c new file mode 100644 index 0000000..f6d042f --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/prefix-large-v2df.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target powerpc_prefixed_addr } */ +/* { dg-options "-O2 -mdejagnu-cpu=power10" } */ + +/* Tests whether prefixed instructions with large numeric offsets are generated + for the vector double type. */ + +#define TYPE vector double + +#include "prefix-large.h" + +/* { dg-final { scan-assembler-times {\mplxv\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mpstxv\M} 2 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/prefix-large.h b/gcc/testsuite/gcc.target/powerpc/prefix-large.h new file mode 100644 index 0000000..07b38ae --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/prefix-large.h @@ -0,0 +1,40 @@ +/* Common tests for prefixed instructions testing whether we can generate a + 34-bit offset using 1 instruction. */ + +#ifndef TYPE +#define TYPE unsigned int +#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 0x12480UL +#endif + +#if DO_ADD +void +add (TYPE *p, TYPE a) +{ + p[CONSTANT] += a; +} +#endif + +#if DO_VALUE +TYPE +value (TYPE *p) +{ + return p[CONSTANT]; +} +#endif + +#if DO_SET +void +set (TYPE *p, TYPE a) +{ + p[CONSTANT] = a; +} +#endif -- 1.8.3.1 -- 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