From e473a6df6d55b9476439d05bbcb218fb98faf49f Mon Sep 17 00:00:00 2001 From: Segher Boessenkool Date: Thu, 7 May 2020 18:28:58 -0500 Subject: [PATCH] rs6000: Tests for setbc 2020-05-07 Segher Boessenkool * gcc.target/powerpc/setbc.h: New. * gcc.target/powerpc/setbceq.c: New. * gcc.target/powerpc/setbcge.c: New. * gcc.target/powerpc/setbcgt.c: New. * gcc.target/powerpc/setbcle.c: New. * gcc.target/powerpc/setbclt.c: New. * gcc.target/powerpc/setbcne.c: New. --- gcc/testsuite/ChangeLog | 10 ++++++++ gcc/testsuite/gcc.target/powerpc/setbc.h | 27 ++++++++++++++++++++++ gcc/testsuite/gcc.target/powerpc/setbceq.c | 9 ++++++++ gcc/testsuite/gcc.target/powerpc/setbcge.c | 12 ++++++++++ gcc/testsuite/gcc.target/powerpc/setbcgt.c | 10 ++++++++ gcc/testsuite/gcc.target/powerpc/setbcle.c | 10 ++++++++ gcc/testsuite/gcc.target/powerpc/setbclt.c | 12 ++++++++++ gcc/testsuite/gcc.target/powerpc/setbcne.c | 9 ++++++++ 8 files changed, 99 insertions(+) create mode 100644 gcc/testsuite/gcc.target/powerpc/setbc.h create mode 100644 gcc/testsuite/gcc.target/powerpc/setbceq.c create mode 100644 gcc/testsuite/gcc.target/powerpc/setbcge.c create mode 100644 gcc/testsuite/gcc.target/powerpc/setbcgt.c create mode 100644 gcc/testsuite/gcc.target/powerpc/setbcle.c create mode 100644 gcc/testsuite/gcc.target/powerpc/setbclt.c create mode 100644 gcc/testsuite/gcc.target/powerpc/setbcne.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 61670c97729..541f38f943d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,13 @@ +2020-05-07 Segher Boessenkool + + * gcc.target/powerpc/setbc.h: New. + * gcc.target/powerpc/setbceq.c: New. + * gcc.target/powerpc/setbcge.c: New. + * gcc.target/powerpc/setbcgt.c: New. + * gcc.target/powerpc/setbcle.c: New. + * gcc.target/powerpc/setbclt.c: New. + * gcc.target/powerpc/setbcne.c: New. + 2020-05-07 Iain Sandoe PR c++/94817 diff --git a/gcc/testsuite/gcc.target/powerpc/setbc.h b/gcc/testsuite/gcc.target/powerpc/setbc.h new file mode 100644 index 00000000000..51334246eca --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/setbc.h @@ -0,0 +1,27 @@ +#define XSTR(a,b) a ## b +#define T(a,b) XSTR(a,b) + +int T(NAME,ii)(int a, int b) { return a CODE b; } +int T(NAME,il)(long a, long b) { return a CODE b; } +long T(NAME,li)(int a, int b) { return a CODE b; } +long T(NAME,ll)(long a, long b) { return a CODE b; } + +int T(NAME,iin0)(int a) { return a CODE 0; } +int T(NAME,iln0)(long a) { return a CODE 0; } +long T(NAME,lin0)(int a) { return a CODE 0; } +long T(NAME,lln0)(long a) { return a CODE 0; } + +int T(NAME,iin1)(int a) { return a CODE 1; } +int T(NAME,iln1)(long a) { return a CODE 1; } +long T(NAME,lin1)(int a) { return a CODE 1; } +long T(NAME,lln1)(long a) { return a CODE 1; } + +int T(NAME,iinm1)(int a) { return a CODE -1; } +int T(NAME,ilnm1)(long a) { return a CODE -1; } +long T(NAME,linm1)(int a) { return a CODE -1; } +long T(NAME,llnm1)(long a) { return a CODE -1; } + +int T(NAME,iin42)(int a) { return a CODE 42; } +int T(NAME,iln42)(long a) { return a CODE 42; } +long T(NAME,lin42)(int a) { return a CODE 42; } +long T(NAME,lln42)(long a) { return a CODE 42; } diff --git a/gcc/testsuite/gcc.target/powerpc/setbceq.c b/gcc/testsuite/gcc.target/powerpc/setbceq.c new file mode 100644 index 00000000000..ee3cbffa6f5 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/setbceq.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mcpu=future" } */ + +#define NAME eq +#define CODE == + +#include "setbc.h" + +/* { dg-final { scan-assembler-times {\msetbc\M} 20 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/setbcge.c b/gcc/testsuite/gcc.target/powerpc/setbcge.c new file mode 100644 index 00000000000..06d58159768 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/setbcge.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mcpu=future" } */ + +#define NAME ge +#define CODE >= + +#include "setbc.h" + +/* "x >= 0" is done without setbc. + The generic code sometimes transforms "x >= A" to "x > A-1"; we allow + either here. */ +/* { dg-final { scan-assembler-times {\msetbcr?\M} 16 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/setbcgt.c b/gcc/testsuite/gcc.target/powerpc/setbcgt.c new file mode 100644 index 00000000000..864ae3a7e44 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/setbcgt.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mcpu=future" } */ + +#define NAME gt +#define CODE > + +#include "setbc.h" + +/* "x > -1" is done without setbc. */ +/* { dg-final { scan-assembler-times {\msetbc\M} 16 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/setbcle.c b/gcc/testsuite/gcc.target/powerpc/setbcle.c new file mode 100644 index 00000000000..05df4075b1c --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/setbcle.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mcpu=future" } */ + +#define NAME le +#define CODE <= + +#include "setbc.h" + +/* "x <= -1" is done without setbc. */ +/* { dg-final { scan-assembler-times {\msetbcr\M} 16 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/setbclt.c b/gcc/testsuite/gcc.target/powerpc/setbclt.c new file mode 100644 index 00000000000..52ffb1fd7e1 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/setbclt.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mcpu=future" } */ + +#define NAME lt +#define CODE < + +#include "setbc.h" + +/* "x < 0" is done without setbc. + The generic code sometimes transforms "x < A" to "x <= A-1"; we allow + either here. */ +/* { dg-final { scan-assembler-times {\msetbcr?\M} 16 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/setbcne.c b/gcc/testsuite/gcc.target/powerpc/setbcne.c new file mode 100644 index 00000000000..841448ab5e5 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/setbcne.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mcpu=future" } */ + +#define NAME ne +#define CODE != + +#include "setbc.h" + +/* { dg-final { scan-assembler-times {\msetbcr\M} 20 } } */ -- 2.30.2