From d656a3d3ce88d402a14e8c120f1b0e78a3979deb Mon Sep 17 00:00:00 2001 From: "Paul A. Clarke" Date: Thu, 1 Jul 2021 21:00:26 -0500 Subject: [PATCH] rs6000: Add tests for SSE4.1 "ceil" intrinsics Add the tests for _mm_ceil_pd, _mm_ceil_ps, _mm_ceil_sd, _mm_ceil_ss. Copy a test for _mm_ceil_pd and _mm_ceil_ps from gcc/testsuite/gcc.target/i386. Define __VSX_SSE2__ to pick up some union definitions in m128-check.h. 2021-07-30 Paul A. Clarke gcc/testsuite * gcc.target/powerpc/sse4_1-ceilpd.c: New. * gcc.target/powerpc/sse4_1-ceilps.c: New. * gcc.target/powerpc/sse4_1-ceilsd.c: New. * gcc.target/powerpc/sse4_1-ceilss.c: New. * gcc.target/powerpc/sse4_1-round-data.h: New. * gcc.target/powerpc/sse4_1-round.h: New. * gcc.target/powerpc/sse4_1-round2.h: New. * gcc.target/powerpc/sse4_1-roundpd-3.c: Copy from gcc.target/i386 and adjust dg directives to suit. * gcc.target/powerpc/sse4_1-check.h (__VSX_SSE2__): Define. --- .../gcc.target/powerpc/sse4_1-ceilpd.c | 51 ++++++++ .../gcc.target/powerpc/sse4_1-ceilps.c | 41 ++++++ .../gcc.target/powerpc/sse4_1-ceilsd.c | 119 ++++++++++++++++++ .../gcc.target/powerpc/sse4_1-ceilss.c | 95 ++++++++++++++ .../gcc.target/powerpc/sse4_1-check.h | 4 + .../gcc.target/powerpc/sse4_1-round-data.h | 20 +++ .../gcc.target/powerpc/sse4_1-round.h | 27 ++++ .../gcc.target/powerpc/sse4_1-round2.h | 27 ++++ .../gcc.target/powerpc/sse4_1-roundpd-3.c | 36 ++++++ 9 files changed, 420 insertions(+) create mode 100644 gcc/testsuite/gcc.target/powerpc/sse4_1-ceilpd.c create mode 100644 gcc/testsuite/gcc.target/powerpc/sse4_1-ceilps.c create mode 100644 gcc/testsuite/gcc.target/powerpc/sse4_1-ceilsd.c create mode 100644 gcc/testsuite/gcc.target/powerpc/sse4_1-ceilss.c create mode 100644 gcc/testsuite/gcc.target/powerpc/sse4_1-round-data.h create mode 100644 gcc/testsuite/gcc.target/powerpc/sse4_1-round.h create mode 100644 gcc/testsuite/gcc.target/powerpc/sse4_1-round2.h create mode 100644 gcc/testsuite/gcc.target/powerpc/sse4_1-roundpd-3.c diff --git a/gcc/testsuite/gcc.target/powerpc/sse4_1-ceilpd.c b/gcc/testsuite/gcc.target/powerpc/sse4_1-ceilpd.c new file mode 100644 index 000000000000..f532fdb9c285 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/sse4_1-ceilpd.c @@ -0,0 +1,51 @@ +/* { dg-do run } */ +/* { dg-require-effective-target p8vector_hw } */ +/* { dg-options "-O2 -mpower8-vector -Wno-psabi" } */ + +#define NO_WARN_X86_INTRINSICS 1 +#include + +#define VEC_T __m128d +#define FP_T double + +#define ROUND_INTRIN(x, mode) _mm_ceil_pd (x) + +#include "sse4_1-round-data.h" + +static struct data data[] = { + { .value = { .f = { 0.00, 0.25 } }, .answer = { 0.0, 1.0 } }, + { .value = { .f = { 0.50, 0.75 } }, .answer = { 1.0, 1.0 } }, + + { { .f = { 0x1.ffffffffffffcp+50, 0x1.ffffffffffffdp+50 } }, + { 0x1.ffffffffffffcp+50, 0x1.0000000000000p+51 } }, + { { .f = { 0x1.ffffffffffffep+50, 0x1.fffffffffffffp+50 } }, + { 0x1.0000000000000p+51, 0x1.0000000000000p+51 } }, + { { .f = { 0x1.0000000000000p+51, 0x1.0000000000001p+51 } }, + { 0x1.0000000000000p+51, 0x1.0000000000002p+51 } }, + { { .f = { 0x1.0000000000002p+51, 0x1.0000000000003p+51 } }, + { 0x1.0000000000002p+51, 0x1.0000000000004p+51 } }, + + { { .f = { 0x1.ffffffffffffep+51, 0x1.fffffffffffffp+51 } }, + { 0x1.ffffffffffffep+51, 0x1.0000000000000p+52 } }, + { { .f = { 0x1.0000000000000p+52, 0x1.0000000000001p+52 } }, + { 0x1.0000000000000p+52, 0x1.0000000000001p+52 } }, + + { { .f = { -0x1.0000000000001p+52, -0x1.0000000000000p+52 } }, + { -0x1.0000000000001p+52, -0x1.0000000000000p+52 } }, + { { .f = { -0x1.fffffffffffffp+51, -0x1.ffffffffffffep+51 } }, + { -0x1.ffffffffffffep+51, -0x1.ffffffffffffep+51 } }, + + { { .f = { -0x1.0000000000003p+51, -0x1.0000000000002p+51 } }, + { -0x1.0000000000002p+51, -0x1.0000000000002p+51 } }, + { { .f = { -0x1.0000000000001p+51, -0x1.0000000000000p+51 } }, + { -0x1.0000000000000p+51, -0x1.0000000000000p+51 } }, + { { .f = { -0x1.fffffffffffffp+50, -0x1.ffffffffffffep+50 } }, + { -0x1.ffffffffffffcp+50, -0x1.ffffffffffffcp+50 } }, + { { .f = { -0x1.ffffffffffffdp+50, -0x1.ffffffffffffcp+50 } }, + { -0x1.ffffffffffffcp+50, -0x1.ffffffffffffcp+50 } }, + + { { .f = { -1.00, -0.75 } }, { -1.0, 0.0 } }, + { { .f = { -0.50, -0.25 } }, { 0.0, 0.0 } } +}; + +#include "sse4_1-round.h" diff --git a/gcc/testsuite/gcc.target/powerpc/sse4_1-ceilps.c b/gcc/testsuite/gcc.target/powerpc/sse4_1-ceilps.c new file mode 100644 index 000000000000..1e29999a57d8 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/sse4_1-ceilps.c @@ -0,0 +1,41 @@ +/* { dg-do run } */ +/* { dg-require-effective-target p8vector_hw } */ +/* { dg-options "-O2 -mpower8-vector -Wno-psabi" } */ + +#define NO_WARN_X86_INTRINSICS 1 +#include + +#define VEC_T __m128 +#define FP_T float + +#define ROUND_INTRIN(x, mode) _mm_ceil_ps (x) + +#include "sse4_1-round-data.h" + +static struct data data[] = { + { { .f = { 0.00, 0.25, 0.50, 0.75 } }, { 0.0, 1.0, 1.0, 1.0 } }, + + { { .f = { 0x1.fffff8p+21, 0x1.fffffap+21, + 0x1.fffffcp+21, 0x1.fffffep+21 } }, + { 0x1.fffff8p+21, 0x1.000000p+22, + 0x1.000000p+22, 0x1.000000p+22 } }, + + { { .f = { 0x1.fffffap+22, 0x1.fffffcp+22, + 0x1.fffffep+22, 0x1.fffffep+23 } }, + { 0x1.fffffcp+22, 0x1.fffffcp+22, + 0x1.000000p+23, 0x1.fffffep+23 } }, + + { { .f = { -0x1.fffffep+23, -0x1.fffffep+22, + -0x1.fffffcp+22, -0x1.fffffap+22 } }, + { -0x1.fffffep+23, -0x1.fffffcp+22, + -0x1.fffffcp+22, -0x1.fffff8p+22 } }, + + { { .f = { -0x1.fffffep+21, -0x1.fffffcp+21, + -0x1.fffffap+21, -0x1.fffff8p+21 } }, + { -0x1.fffff8p+21, -0x1.fffff8p+21, + -0x1.fffff8p+21, -0x1.fffff8p+21 } }, + + { { .f = { -1.00, -0.75, -0.50, -0.25 } }, { -1.0, 0.0, 0.0, 0.0 } } +}; + +#include "sse4_1-round.h" diff --git a/gcc/testsuite/gcc.target/powerpc/sse4_1-ceilsd.c b/gcc/testsuite/gcc.target/powerpc/sse4_1-ceilsd.c new file mode 100644 index 000000000000..cc0d9c1d0afe --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/sse4_1-ceilsd.c @@ -0,0 +1,119 @@ +/* { dg-do run } */ +/* { dg-require-effective-target p8vector_hw } */ +/* { dg-options "-O2 -mpower8-vector -Wno-psabi" } */ + +#define NO_WARN_X86_INTRINSICS 1 +#include + +#define VEC_T __m128d +#define FP_T double + +#define ROUND_INTRIN(x, y) _mm_ceil_sd (x, y) + +#include "sse4_1-round-data.h" + +static struct data2 data[] = { + { .value1 = { .f = { IGNORED, PASSTHROUGH } }, + .value2 = { .f = { 0.00, IGNORED } }, + .answer = { 0.0, PASSTHROUGH } }, + { .value1 = { .f = { IGNORED, PASSTHROUGH } }, + .value2 = { .f = { 0.25, IGNORED } }, + .answer = { 1.0, PASSTHROUGH } }, + { .value1 = { .f = { IGNORED, PASSTHROUGH } }, + .value2 = { .f = { 0.50, IGNORED } }, + .answer = { 1.0, PASSTHROUGH } }, + { .value1 = { .f = { IGNORED, PASSTHROUGH } }, + .value2 = { .f = { 0.75, IGNORED } }, + .answer = { 1.0, PASSTHROUGH } }, + + { .value1 = { .f = { IGNORED, PASSTHROUGH } }, + .value2 = { .f = { 0x1.ffffffffffffcp+50, IGNORED } }, + .answer = { 0x1.ffffffffffffcp+50, PASSTHROUGH } }, + { .value1 = { .f = { IGNORED, PASSTHROUGH } }, + .value2 = { .f = { 0x1.ffffffffffffdp+50, IGNORED } }, + .answer = { 0x1.0000000000000p+51, PASSTHROUGH } }, + { .value1 = { .f = { IGNORED, PASSTHROUGH } }, + .value2 = { .f = { 0x1.ffffffffffffep+50, IGNORED } }, + .answer = { 0x1.0000000000000p+51, PASSTHROUGH } }, + { .value1 = { .f = { IGNORED, PASSTHROUGH } }, + .value2 = { .f = { 0x1.fffffffffffffp+50, IGNORED } }, + .answer = { 0x1.0000000000000p+51, PASSTHROUGH } }, + { .value1 = { .f = { IGNORED, PASSTHROUGH } }, + .value2 = { .f = { 0x1.0000000000000p+51, IGNORED } }, + .answer = { 0x1.0000000000000p+51, PASSTHROUGH } }, + { .value1 = { .f = { IGNORED, PASSTHROUGH } }, + .value2 = { .f = { 0x1.0000000000001p+51, IGNORED } }, + .answer = { 0x1.0000000000002p+51, PASSTHROUGH } }, + { .value1 = { .f = { IGNORED, PASSTHROUGH } }, + .value2 = { .f = { 0x1.0000000000002p+51, IGNORED } }, + .answer = { 0x1.0000000000002p+51, PASSTHROUGH } }, + { .value1 = { .f = { IGNORED, PASSTHROUGH } }, + .value2 = { .f = { 0x1.0000000000003p+51, IGNORED } }, + .answer = { 0x1.0000000000004p+51, PASSTHROUGH } }, + + { .value1 = { .f = { IGNORED, PASSTHROUGH } }, + .value2 = { .f = { 0x1.ffffffffffffep+51, IGNORED } }, + .answer = { 0x1.ffffffffffffep+51, PASSTHROUGH } }, + { .value1 = { .f = { IGNORED, PASSTHROUGH } }, + .value2 = { .f = { 0x1.fffffffffffffp+51, IGNORED } }, + .answer = { 0x1.0000000000000p+52, PASSTHROUGH } }, + { .value1 = { .f = { IGNORED, PASSTHROUGH } }, + .value2 = { .f = { 0x1.0000000000000p+52, IGNORED } }, + .answer = { 0x1.0000000000000p+52, PASSTHROUGH } }, + { .value1 = { .f = { IGNORED, PASSTHROUGH } }, + .value2 = { .f = { 0x1.0000000000001p+52, IGNORED } }, + .answer = { 0x1.0000000000001p+52, PASSTHROUGH } }, + + { .value1 = { .f = { IGNORED, PASSTHROUGH } }, + .value2 = { .f = { -0x1.0000000000001p+52, IGNORED } }, + .answer = { -0x1.0000000000001p+52, PASSTHROUGH } }, + { .value1 = { .f = { IGNORED, PASSTHROUGH } }, + .value2 = { .f = { -0x1.0000000000000p+52, IGNORED } }, + .answer = { -0x1.0000000000000p+52, PASSTHROUGH } }, + { .value1 = { .f = { IGNORED, PASSTHROUGH } }, + .value2 = { .f = { -0x1.fffffffffffffp+51, IGNORED } }, + .answer = { -0x1.ffffffffffffep+51, PASSTHROUGH } }, + { .value1 = { .f = { IGNORED, PASSTHROUGH } }, + .value2 = { .f = { -0x1.ffffffffffffep+51, IGNORED } }, + .answer = { -0x1.ffffffffffffep+51, PASSTHROUGH } }, + + { .value1 = { .f = { IGNORED, PASSTHROUGH } }, + .value2 = { .f = { -0x1.0000000000003p+51, IGNORED } }, + .answer = { -0x1.0000000000002p+51, PASSTHROUGH } }, + { .value1 = { .f = { IGNORED, PASSTHROUGH } }, + .value2 = { .f = { -0x1.0000000000002p+51, IGNORED } }, + .answer = { -0x1.0000000000002p+51, PASSTHROUGH } }, + { .value1 = { .f = { IGNORED, PASSTHROUGH } }, + .value2 = { .f = { -0x1.0000000000001p+51, IGNORED } }, + .answer = { -0x1.0000000000000p+51, PASSTHROUGH } }, + { .value1 = { .f = { IGNORED, PASSTHROUGH } }, + .value2 = { .f = { -0x1.0000000000000p+51, IGNORED } }, + .answer = { -0x1.0000000000000p+51, PASSTHROUGH } }, + { .value1 = { .f = { IGNORED, PASSTHROUGH } }, + .value2 = { .f = { -0x1.ffffffffffffcp+50, IGNORED } }, + .answer = { -0x1.ffffffffffffcp+50, PASSTHROUGH } }, + { .value1 = { .f = { IGNORED, PASSTHROUGH } }, + .value2 = { .f = { -0x1.ffffffffffffep+50, IGNORED } }, + .answer = { -0x1.ffffffffffffcp+50, PASSTHROUGH } }, + { .value1 = { .f = { IGNORED, PASSTHROUGH } }, + .value2 = { .f = { -0x1.ffffffffffffdp+50, IGNORED } }, + .answer = { -0x1.ffffffffffffcp+50, PASSTHROUGH } }, + { .value1 = { .f = { IGNORED, PASSTHROUGH } }, + .value2 = { .f = { -0x1.ffffffffffffcp+50, IGNORED } }, + .answer = { -0x1.ffffffffffffcp+50, PASSTHROUGH } }, + + { .value1 = { .f = { IGNORED, PASSTHROUGH } }, + .value2 = { .f = { -1.00, IGNORED } }, + .answer = { -1.0, PASSTHROUGH } }, + { .value1 = { .f = { IGNORED, PASSTHROUGH } }, + .value2 = { .f = { -0.75, IGNORED } }, + .answer = { -0.0, PASSTHROUGH } }, + { .value1 = { .f = { IGNORED, PASSTHROUGH } }, + .value2 = { .f = { -0.50, IGNORED } }, + .answer = { -0.0, PASSTHROUGH } }, + { .value1 = { .f = { IGNORED, PASSTHROUGH } }, + .value2 = { .f = { -0.25, IGNORED } }, + .answer = { -0.0, PASSTHROUGH } } +}; + +#include "sse4_1-round2.h" diff --git a/gcc/testsuite/gcc.target/powerpc/sse4_1-ceilss.c b/gcc/testsuite/gcc.target/powerpc/sse4_1-ceilss.c new file mode 100644 index 000000000000..cf1a0392990e --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/sse4_1-ceilss.c @@ -0,0 +1,95 @@ +/* { dg-do run } */ +/* { dg-require-effective-target p8vector_hw } */ +/* { dg-options "-O2 -mpower8-vector -Wno-psabi" } */ + +#define NO_WARN_X86_INTRINSICS 1 +#include + +#define VEC_T __m128 +#define FP_T float + +#define ROUND_INTRIN(x, y) _mm_ceil_ss (x, y) + +#include "sse4_1-round-data.h" + +static struct data2 data[] = { + { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } }, + .value2 = { .f = { 0.00, IGNORED, IGNORED, IGNORED } }, + .answer = { 0.0, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } }, + { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } }, + .value2 = { .f = { 0.25, IGNORED, IGNORED, IGNORED } }, + .answer = { 1.0, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } }, + { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } }, + .value2 = { .f = { 0.50, IGNORED, IGNORED, IGNORED } }, + .answer = { 1.0, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } }, + { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } }, + .value2 = { .f = { 0.75, IGNORED, IGNORED, IGNORED } }, + .answer = { 1.0, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } }, + + { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } }, + .value2 = { .f = { 0x1.fffff8p+21, IGNORED, IGNORED, IGNORED } }, + .answer = { 0x1.fffff8p+21, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } }, + { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } }, + .value2 = { .f = { 0x1.fffffap+21, IGNORED, IGNORED, IGNORED } }, + .answer = { 0x1.000000p+22, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } }, + { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } }, + .value2 = { .f = { 0x1.fffffcp+21, IGNORED, IGNORED, IGNORED } }, + .answer = { 0x1.000000p+22, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } }, + { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } }, + .value2 = { .f = { 0x1.fffffep+21, IGNORED, IGNORED, IGNORED } }, + .answer = { 0x1.000000p+22, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } }, + + { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } }, + .value2 = { .f = { 0x1.fffffap+22, IGNORED, IGNORED, IGNORED } }, + .answer = { 0x1.fffffcp+22, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } }, + { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } }, + .value2 = { .f = { 0x1.fffffcp+22, IGNORED, IGNORED, IGNORED } }, + .answer = { 0x1.fffffcp+22, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } }, + { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } }, + .value2 = { .f = { 0x1.fffffep+22, IGNORED, IGNORED, IGNORED } }, + .answer = { 0x1.000000p+23, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } }, + { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } }, + .value2 = { .f = { 0x1.fffffep+23, IGNORED, IGNORED, IGNORED } }, + .answer = { 0x1.fffffep+23, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } }, + + { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } }, + .value2 = { .f = { -0x1.fffffep+23, IGNORED, IGNORED, IGNORED } }, + .answer = { -0x1.fffffep+23, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } }, + { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } }, + .value2 = { .f = { -0x1.fffffep+22, IGNORED, IGNORED, IGNORED } }, + .answer = { -0x1.fffffcp+22, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } }, + { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } }, + .value2 = { .f = { -0x1.fffffcp+22, IGNORED, IGNORED, IGNORED } }, + .answer = { -0x1.fffffcp+22, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } }, + { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } }, + .value2 = { .f = { -0x1.fffffap+22, IGNORED, IGNORED, IGNORED } }, + .answer = { -0x1.fffff8p+22, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } }, + + { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } }, + .value2 = { .f = { -0x1.fffffep+21, IGNORED, IGNORED, IGNORED } }, + .answer = { -0x1.fffff8p+21, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } }, + { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } }, + .value2 = { .f = { -0x1.fffffcp+21, IGNORED, IGNORED, IGNORED } }, + .answer = { -0x1.fffff8p+21, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } }, + { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } }, + .value2 = { .f = { -0x1.fffffap+21, IGNORED, IGNORED, IGNORED } }, + .answer = { -0x1.fffff8p+21, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } }, + { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } }, + .value2 = { .f = { -0x1.fffff8p+21, IGNORED, IGNORED, IGNORED } }, + .answer = { -0x1.fffff8p+21, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } }, + + { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } }, + .value2 = { .f = { -1.00, IGNORED, IGNORED, IGNORED } }, + .answer = { -1.0, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } }, + { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } }, + .value2 = { .f = { -0.75, IGNORED, IGNORED, IGNORED } }, + .answer = { 0.0, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } }, + { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } }, + .value2 = { .f = { -0.50, IGNORED, IGNORED, IGNORED } }, + .answer = { 0.0, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } }, + { .value1 = { .f = { IGNORED, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } }, + .value2 = { .f = { -0.25, IGNORED, IGNORED, IGNORED } }, + .answer = { 0.0, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } } +}; + +#include "sse4_1-round2.h" diff --git a/gcc/testsuite/gcc.target/powerpc/sse4_1-check.h b/gcc/testsuite/gcc.target/powerpc/sse4_1-check.h index 5f855b9fd53a..16330533e50a 100644 --- a/gcc/testsuite/gcc.target/powerpc/sse4_1-check.h +++ b/gcc/testsuite/gcc.target/powerpc/sse4_1-check.h @@ -1,6 +1,10 @@ #include #include +/* Define this to enable the combination of VSX vector double and + SSE2 data types. */ +#define __VSX_SSE2__ 1 + #include "m128-check.h" //#define DEBUG 1 diff --git a/gcc/testsuite/gcc.target/powerpc/sse4_1-round-data.h b/gcc/testsuite/gcc.target/powerpc/sse4_1-round-data.h new file mode 100644 index 000000000000..543f5bc2181b --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/sse4_1-round-data.h @@ -0,0 +1,20 @@ +/* Pick a few numbers at random which are not in the input data and + unlikely to show up naturally. */ +#define PASSTHROUGH -29.5 +#define IGNORED -61.5 + +union value { + VEC_T x; + FP_T f[sizeof (VEC_T) / sizeof (FP_T)]; +}; + +struct data { + union value value; + double answer[sizeof (VEC_T) / sizeof (FP_T)]; +}; + +struct data2 { + union value value1; + union value value2; + double answer[sizeof (VEC_T) / sizeof (FP_T)]; +}; diff --git a/gcc/testsuite/gcc.target/powerpc/sse4_1-round.h b/gcc/testsuite/gcc.target/powerpc/sse4_1-round.h new file mode 100644 index 000000000000..334090948180 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/sse4_1-round.h @@ -0,0 +1,27 @@ +#include +#include +#include "sse4_1-check.h" + +#define DIM(a) (sizeof (a) / sizeof (a)[0]) + +static int modes[] = { FE_TONEAREST, FE_UPWARD, FE_DOWNWARD, FE_TOWARDZERO }; + +static void +TEST (void) +{ + int i, j, ri, round_save; + + round_save = fegetround (); + for (ri = 0; ri < DIM (modes); ri++) { + fesetround (modes[ri]); + for (i = 0; i < DIM (data); i++) { + union value guess; + guess.x = ROUND_INTRIN (data[i].value.x, /* Ignored. */); + for (j = 0; j < DIM (data[i].value.f); j++) { + if (guess.f[j] != data[i].answer[j]) + abort (); + } + } + } + fesetround (round_save); +} diff --git a/gcc/testsuite/gcc.target/powerpc/sse4_1-round2.h b/gcc/testsuite/gcc.target/powerpc/sse4_1-round2.h new file mode 100644 index 000000000000..68a2fdcb736b --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/sse4_1-round2.h @@ -0,0 +1,27 @@ +#include +#include +#include "sse4_1-check.h" + +#define DIM(a) (sizeof (a) / sizeof (a)[0]) + +static int modes[] = { FE_TONEAREST, FE_UPWARD, FE_DOWNWARD, FE_TOWARDZERO }; + +static void +TEST (void) +{ + int i, j, ri, round_save; + + round_save = fegetround (); + for (ri = 0; ri < DIM (modes); ri++) { + fesetround (modes[ri]); + for (i = 0; i < DIM (data); i++) { + union value guess; + guess.x = ROUND_INTRIN (data[i].value1.x, data[i].value2.x); + for (j = 0; j < DIM (data[i].value1.f); j++) { + if (guess.f[j] != data[i].answer[j]) + abort (); + } + } + } + fesetround (round_save); +} diff --git a/gcc/testsuite/gcc.target/powerpc/sse4_1-roundpd-3.c b/gcc/testsuite/gcc.target/powerpc/sse4_1-roundpd-3.c new file mode 100644 index 000000000000..88a5f0718ebb --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/sse4_1-roundpd-3.c @@ -0,0 +1,36 @@ +/* { dg-do run } */ +/* { dg-require-effective-target p8vector_hw } */ +/* { dg-options "-O2 -mpower8-vector -Wno-psabi" } */ + +#ifndef CHECK_H +#define CHECK_H "sse4_1-check.h" +#endif + +#ifndef TEST +#define TEST sse4_1_test +#endif + +#include CHECK_H + +#include + +static void +TEST (void) +{ + union128d u, s; + double e[2] = {0.0}; + int i; + + s.x = _mm_set_pd (1.1234, -2.3478); + u.x = _mm_ceil_pd (s.x); + + for (i = 0; i < 2; i++) + { + __m128d tmp = _mm_load_sd (&s.a[i]); + tmp = _mm_ceil_sd (tmp, tmp); + _mm_store_sd (&e[i], tmp); + } + + if (check_union128d (u, e)) + abort (); +}