From 74d58ad2c208c9c445bb3e8288db08e092a66316 Mon Sep 17 00:00:00 2001 From: Segher Boessenkool Date: Thu, 7 May 2020 18:34:11 -0500 Subject: [PATCH] rs6000: Tests for setnbc 2020-05-07 Segher Boessenkool * gcc.target/powerpc/setnbc.h: New. * gcc.target/powerpc/setnbceq.c: New. * gcc.target/powerpc/setnbcge.c: New. * gcc.target/powerpc/setnbcgt.c: New. * gcc.target/powerpc/setnbcle.c: New. * gcc.target/powerpc/setnbclt.c: New. * gcc.target/powerpc/setnbcne.c: New. --- gcc/testsuite/ChangeLog | 10 ++++++++ gcc/testsuite/gcc.target/powerpc/setnbc.h | 27 +++++++++++++++++++++ gcc/testsuite/gcc.target/powerpc/setnbceq.c | 9 +++++++ gcc/testsuite/gcc.target/powerpc/setnbcge.c | 12 +++++++++ gcc/testsuite/gcc.target/powerpc/setnbcgt.c | 10 ++++++++ gcc/testsuite/gcc.target/powerpc/setnbcle.c | 10 ++++++++ gcc/testsuite/gcc.target/powerpc/setnbclt.c | 12 +++++++++ gcc/testsuite/gcc.target/powerpc/setnbcne.c | 9 +++++++ 8 files changed, 99 insertions(+) create mode 100644 gcc/testsuite/gcc.target/powerpc/setnbc.h create mode 100644 gcc/testsuite/gcc.target/powerpc/setnbceq.c create mode 100644 gcc/testsuite/gcc.target/powerpc/setnbcge.c create mode 100644 gcc/testsuite/gcc.target/powerpc/setnbcgt.c create mode 100644 gcc/testsuite/gcc.target/powerpc/setnbcle.c create mode 100644 gcc/testsuite/gcc.target/powerpc/setnbclt.c create mode 100644 gcc/testsuite/gcc.target/powerpc/setnbcne.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 541f38f943d..088b80ea38f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,13 @@ +2020-05-07 Segher Boessenkool + + * gcc.target/powerpc/setnbc.h: New. + * gcc.target/powerpc/setnbceq.c: New. + * gcc.target/powerpc/setnbcge.c: New. + * gcc.target/powerpc/setnbcgt.c: New. + * gcc.target/powerpc/setnbcle.c: New. + * gcc.target/powerpc/setnbclt.c: New. + * gcc.target/powerpc/setnbcne.c: New. + 2020-05-07 Segher Boessenkool * gcc.target/powerpc/setbc.h: New. diff --git a/gcc/testsuite/gcc.target/powerpc/setnbc.h b/gcc/testsuite/gcc.target/powerpc/setnbc.h new file mode 100644 index 00000000000..d278d4a687f --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/setnbc.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/setnbceq.c b/gcc/testsuite/gcc.target/powerpc/setnbceq.c new file mode 100644 index 00000000000..ff4af8f71fa --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/setnbceq.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mcpu=future" } */ + +#define NAME eq +#define CODE == + +#include "setnbc.h" + +/* { dg-final { scan-assembler-times {\msetnbc\M} 20 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/setnbcge.c b/gcc/testsuite/gcc.target/powerpc/setnbcge.c new file mode 100644 index 00000000000..68ee6bda0d0 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/setnbcge.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mcpu=future" } */ + +#define NAME ge +#define CODE >= + +#include "setnbc.h" + +/* "x >= 0" is done without setnbc. + The generic code sometimes transforms "x >= A" to "x > A-1"; we allow + either here. */ +/* { dg-final { scan-assembler-times {\msetnbcr?\M} 16 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/setnbcgt.c b/gcc/testsuite/gcc.target/powerpc/setnbcgt.c new file mode 100644 index 00000000000..e0f51d49bd1 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/setnbcgt.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mcpu=future" } */ + +#define NAME gt +#define CODE > + +#include "setnbc.h" + +/* "x > -1" is done without setnbc. */ +/* { dg-final { scan-assembler-times {\msetnbc\M} 16 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/setnbcle.c b/gcc/testsuite/gcc.target/powerpc/setnbcle.c new file mode 100644 index 00000000000..33a5da96964 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/setnbcle.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mcpu=future" } */ + +#define NAME le +#define CODE <= + +#include "setnbc.h" + +/* "x <= -1" is done without setnbc. */ +/* { dg-final { scan-assembler-times {\msetnbcr\M} 16 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/setnbclt.c b/gcc/testsuite/gcc.target/powerpc/setnbclt.c new file mode 100644 index 00000000000..127d7bfece4 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/setnbclt.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mcpu=future" } */ + +#define NAME lt +#define CODE < + +#include "setnbc.h" + +/* "x < 0" is done without setnbc. + The generic code sometimes transforms "x < A" to "x <= A-1"; we allow + either here. */ +/* { dg-final { scan-assembler-times {\msetnbcr?\M} 16 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/setnbcne.c b/gcc/testsuite/gcc.target/powerpc/setnbcne.c new file mode 100644 index 00000000000..be1624d6ec2 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/setnbcne.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mcpu=future" } */ + +#define NAME ne +#define CODE != + +#include "setnbc.h" + +/* { dg-final { scan-assembler-times {\msetnbcr\M} 20 } } */ -- 2.30.2