diff mbox series

[2/2] rs6000: Add tests for SSE4.1 "floor" intrinsics

Message ID 20210706225057.644872-3-pc@us.ibm.com
State New
Headers show
Series Add SSE4.1 "floor" intrinsics | expand

Commit Message

Paul A. Clarke July 6, 2021, 10:50 p.m. UTC
Add the tests for _mm_floor_pd, _mm_floor_ps, _mm_floor_sd, _mm_floor_ss.
These are modelled after (and depend upon parts of) the tests for
_mm_ceil intrinsics, recently posted.

Copy a test for _mm_floor_sd from gcc/testsuite/gcc.target/i386.

2021-07-06  Paul A. Clarke  <pc@us.ibm.com>

gcc/testsuite/ChangeLog:
	* gcc/testsuite/gcc.target/powerpc/sse4_1-floorpd.c: New.
	* gcc/testsuite/gcc.target/powerpc/sse4_1-floorps.c: New.
	* gcc/testsuite/gcc.target/powerpc/sse4_1-floorsd.c: New.
	* gcc/testsuite/gcc.target/powerpc/sse4_1-floorss.c: New.
	* gcc/testsuite/gcc.target/powerpc/sse4_1-roundpd-2.c: Copy
	from gcc/testsuite/gcc.target/i386.
---
 .../gcc.target/powerpc/sse4_1-floorpd.c       |  51 ++++++++
 .../gcc.target/powerpc/sse4_1-floorps.c       |  33 +++++
 .../gcc.target/powerpc/sse4_1-floorsd.c       | 119 ++++++++++++++++++
 .../gcc.target/powerpc/sse4_1-floorss.c       |  95 ++++++++++++++
 .../gcc.target/powerpc/sse4_1-roundpd-2.c     |  36 ++++++
 5 files changed, 334 insertions(+)
 create mode 100644 gcc/testsuite/gcc.target/powerpc/sse4_1-floorpd.c
 create mode 100644 gcc/testsuite/gcc.target/powerpc/sse4_1-floorps.c
 create mode 100644 gcc/testsuite/gcc.target/powerpc/sse4_1-floorsd.c
 create mode 100644 gcc/testsuite/gcc.target/powerpc/sse4_1-floorss.c
 create mode 100644 gcc/testsuite/gcc.target/powerpc/sse4_1-roundpd-2.c

Comments

Li, Pan2 via Gcc-patches July 11, 2021, 5:49 p.m. UTC | #1
Hi Paul,

On 7/6/21 5:50 PM, Paul A. Clarke via Gcc-patches wrote:
> Add the tests for _mm_floor_pd, _mm_floor_ps, _mm_floor_sd, _mm_floor_ss.
> These are modelled after (and depend upon parts of) the tests for
> _mm_ceil intrinsics, recently posted.
>
> Copy a test for _mm_floor_sd from gcc/testsuite/gcc.target/i386.
>
> 2021-07-06  Paul A. Clarke  <pc@us.ibm.com>
>
> gcc/testsuite/ChangeLog:
[Applies to all your patches] Don't need to include "ChangeLog:" here.  
"gcc/testsuite/" works fine.
> 	* gcc/testsuite/gcc.target/powerpc/sse4_1-floorpd.c: New.
> 	* gcc/testsuite/gcc.target/powerpc/sse4_1-floorps.c: New.
> 	* gcc/testsuite/gcc.target/powerpc/sse4_1-floorsd.c: New.
> 	* gcc/testsuite/gcc.target/powerpc/sse4_1-floorss.c: New.
> 	* gcc/testsuite/gcc.target/powerpc/sse4_1-roundpd-2.c: Copy
> 	from gcc/testsuite/gcc.target/i386.
As before, these all need to be relative to gcc/testsuite, so start with 
gcc.target/...
> ---
>   .../gcc.target/powerpc/sse4_1-floorpd.c       |  51 ++++++++
>   .../gcc.target/powerpc/sse4_1-floorps.c       |  33 +++++
>   .../gcc.target/powerpc/sse4_1-floorsd.c       | 119 ++++++++++++++++++
>   .../gcc.target/powerpc/sse4_1-floorss.c       |  95 ++++++++++++++
>   .../gcc.target/powerpc/sse4_1-roundpd-2.c     |  36 ++++++
>   5 files changed, 334 insertions(+)
>   create mode 100644 gcc/testsuite/gcc.target/powerpc/sse4_1-floorpd.c
>   create mode 100644 gcc/testsuite/gcc.target/powerpc/sse4_1-floorps.c
>   create mode 100644 gcc/testsuite/gcc.target/powerpc/sse4_1-floorsd.c
>   create mode 100644 gcc/testsuite/gcc.target/powerpc/sse4_1-floorss.c
>   create mode 100644 gcc/testsuite/gcc.target/powerpc/sse4_1-roundpd-2.c
>
> diff --git a/gcc/testsuite/gcc.target/powerpc/sse4_1-floorpd.c b/gcc/testsuite/gcc.target/powerpc/sse4_1-floorpd.c
> new file mode 100644
> index 000000000000..ad21644f50c4
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/powerpc/sse4_1-floorpd.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 <smmintrin.h>
> +
> +#define VEC_T __m128d
> +#define FP_T double
> +
> +#define ROUND_INTRIN(x, mode) _mm_floor_pd (x)
> +
> +#include "sse4_1-round-data.h"
> +
> +static struct data data[] = {
> +  { .value = { .f = {  0.00,  0.25 } }, .answer = {  0.0,  0.0 } },
> +  { .value = { .f = {  0.50,  0.75 } }, .answer = {  0.0,  0.0 } },
> +
> +  { { .f = {  0x1.ffffffffffffcp+50,  0x1.ffffffffffffdp+50 } },
> +           {  0x1.ffffffffffffcp+50,  0x1.ffffffffffffcp+50 } },
> +  { { .f = {  0x1.ffffffffffffep+50,  0x1.0000000000000p+51 } },
> +           {  0x1.ffffffffffffcp+50,  0x1.0000000000000p+51 } },
> +  { { .f = {  0x1.0000000000000p+51,  0x1.0000000000001p+51 } },
> +           {  0x1.0000000000000p+51,  0x1.0000000000000p+51 } },
> +  { { .f = {  0x1.0000000000002p+51,  0x1.0000000000003p+51 } },
> +           {  0x1.0000000000002p+51,  0x1.0000000000002p+51 } },
> +
> +  { { .f = {  0x1.ffffffffffffep+51,  0x1.fffffffffffffp+51 } },
> +           {  0x1.ffffffffffffep+51,  0x1.ffffffffffffep+51 } },
> +  { { .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+52 } },
> +           { -0x1.0000000000000p+52, -0x1.ffffffffffffep+52 } },
> +
> +  { { .f = { -0x1.0000000000003p+51, -0x1.0000000000002p+51 } },
> +           { -0x1.0000000000004p+51, -0x1.0000000000002p+51 } },
> +  { { .f = { -0x1.0000000000001p+51, -0x1.0000000000000p+51 } },
> +           { -0x1.0000000000002p+51, -0x1.0000000000000p+51 } },
> +  { { .f = { -0x1.fffffffffffffp+50, -0x1.ffffffffffffep+50 } },
> +           { -0x1.0000000000000p+51, -0x1.0000000000000p+51 } },
> +  { { .f = { -0x1.ffffffffffffdp+50, -0x1.ffffffffffffcp+50 } },
> +           { -0x1.0000000000000p+51, -0x1.ffffffffffffcp+50 } },
> +
> +  { { .f = { -1.00, -0.75 } }, { -1.0, -1.0 } },
> +  { { .f = { -0.50, -0.25 } }, { -1.0, -1.0 } }
> +};
> +
> +#include "sse4_1-round.h"
> diff --git a/gcc/testsuite/gcc.target/powerpc/sse4_1-floorps.c b/gcc/testsuite/gcc.target/powerpc/sse4_1-floorps.c
> new file mode 100644
> index 000000000000..17ff35a7360f
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/powerpc/sse4_1-floorps.c
> @@ -0,0 +1,33 @@
> +/* { dg-do run } */
> +/* { dg-require-effective-target p8vector_hw } */
> +/* { dg-options "-O2 -mpower8-vector -Wno-psabi" } */
> +
> +#define NO_WARN_X86_INTRINSICS 1
> +#include <smmintrin.h>
> +
> +#define VEC_T __m128
> +#define FP_T float
> +
> +#define ROUND_INTRIN(x, mode) _mm_floor_ps (x)
> +
> +#include "sse4_1-round-data.h"
> +
> +static struct data data[] = {
> +  { { .f = {  0.00,  0.25,  0.50,  0.75 } }, {  0.0,  0.0,  0.0,  0.0 } },
> +
> +  { { .f = {  0x1.fffff8p+21,  0x1.fffffap+21,  0x1.fffffcp+21,  0x1.fffffep+21 } },
> +           {  0x1.fffff8p+21,  0x1.fffff8p+21,  0x1.fffff8p+21,  0x1.fffff8p+21 } },
> +
> +  { { .f = {  0x1.fffffap+22,  0x1.fffffcp+22,  0x1.fffffep+22,  0x1.fffffep+23 } },
> +           {  0x1.fffff8p+22,  0x1.fffffcp+22,  0x1.fffffcp+22,  0x1.fffffep+23 } },
> +
> +  { { .f = { -0x1.fffffep+23, -0x1.fffffep+22, -0x1.fffffcp+22, -0x1.fffffap+22 } },
> +           { -0x1.fffffep+23, -0x1.000000p+23, -0x1.fffffcp+22, -0x1.fffffcp+22 } },
> +
> +  { { .f = { -0x1.fffffep+21, -0x1.fffffcp+21, -0x1.fffffap+21, -0x1.fffff8p+21 } },
> +           { -0x1.000000p+22, -0x1.000000p+22, -0x1.000000p+22, -0x1.fffff8p+21 } },

Above lines are too long; please reformat by pairs.

Again, thank you for the excellent tests.  Rest LGTM.

I can't approve, but recommend approval with these changes.

Thanks,
Bill

> +
> +  { { .f = { -1.00, -0.75, -0.50, -0.25 } }, { -1.0, -1.0, -1.0, -1.0 } }
> +};
> +
> +#include "sse4_1-round.h"
> diff --git a/gcc/testsuite/gcc.target/powerpc/sse4_1-floorsd.c b/gcc/testsuite/gcc.target/powerpc/sse4_1-floorsd.c
> new file mode 100644
> index 000000000000..e4ebc550556f
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/powerpc/sse4_1-floorsd.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 <smmintrin.h>
> +
> +#define VEC_T __m128d
> +#define FP_T double
> +
> +#define ROUND_INTRIN(x, y) _mm_floor_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 = {  0.0, PASSTHROUGH } },
> +  { .value1 = { .f = { IGNORED, PASSTHROUGH } },
> +    .value2 = { .f = {  0.50, IGNORED } },
> +    .answer = {  0.0, PASSTHROUGH } },
> +  { .value1 = { .f = { IGNORED, PASSTHROUGH } },
> +    .value2 = { .f = {  0.75, IGNORED } },
> +    .answer = {  0.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.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.fffffffffffffp+50, IGNORED } },
> +    .answer = {  0x1.ffffffffffffcp+50, 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.0000000000000p+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.0000000000002p+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.ffffffffffffep+51, 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.0000000000000p+52, 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.0000000000004p+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.0000000000002p+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.0000000000000p+51, PASSTHROUGH } },
> +  { .value1 = { .f = { IGNORED, PASSTHROUGH } },
> +    .value2 = { .f = { -0x1.ffffffffffffdp+50, 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 = { -1.00, IGNORED } },
> +    .answer = { -1.0, PASSTHROUGH } },
> +  { .value1 = { .f = { IGNORED, PASSTHROUGH } },
> +    .value2 = { .f = { -0.75, 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.25, IGNORED } },
> +    .answer = { -1.0, PASSTHROUGH } }
> +};
> +
> +#include "sse4_1-round2.h"
> diff --git a/gcc/testsuite/gcc.target/powerpc/sse4_1-floorss.c b/gcc/testsuite/gcc.target/powerpc/sse4_1-floorss.c
> new file mode 100644
> index 000000000000..cfbfe2b1eba7
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/powerpc/sse4_1-floorss.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 <smmintrin.h>
> +
> +#define VEC_T __m128
> +#define FP_T float
> +
> +#define ROUND_INTRIN(x, y) _mm_floor_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 = {  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.75, IGNORED, IGNORED, IGNORED } },
> +    .answer = {  0.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.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.fffffep+21, IGNORED, IGNORED, IGNORED } },
> +    .answer = {  0x1.fffff8p+21, 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.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.fffffcp+22, 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.000000p+23, 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.fffffcp+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.fffffcp+21, IGNORED, IGNORED, IGNORED } },
> +    .answer = { -0x1.000000p+22, 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.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 = { -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.25, IGNORED, IGNORED, IGNORED } },
> +    .answer = { -1.0, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } }
> +};
> +
> +#include "sse4_1-round2.h"
> diff --git a/gcc/testsuite/gcc.target/powerpc/sse4_1-roundpd-2.c b/gcc/testsuite/gcc.target/powerpc/sse4_1-roundpd-2.c
> new file mode 100644
> index 000000000000..cec16175473f
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/powerpc/sse4_1-roundpd-2.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 <smmintrin.h>
> +
> +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_floor_pd (s.x);
> +
> +  for (i = 0; i < 2; i++)
> +    {
> +      __m128d tmp = _mm_load_sd (&s.a[i]);
> +      tmp = _mm_floor_sd (tmp, tmp);
> +      _mm_store_sd (&e[i], tmp);
> +    }
> +
> +  if (check_union128d (u, e))
> +    abort ();
> +}
diff mbox series

Patch

diff --git a/gcc/testsuite/gcc.target/powerpc/sse4_1-floorpd.c b/gcc/testsuite/gcc.target/powerpc/sse4_1-floorpd.c
new file mode 100644
index 000000000000..ad21644f50c4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/sse4_1-floorpd.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 <smmintrin.h>
+
+#define VEC_T __m128d
+#define FP_T double
+
+#define ROUND_INTRIN(x, mode) _mm_floor_pd (x)
+
+#include "sse4_1-round-data.h"
+
+static struct data data[] = {
+  { .value = { .f = {  0.00,  0.25 } }, .answer = {  0.0,  0.0 } },
+  { .value = { .f = {  0.50,  0.75 } }, .answer = {  0.0,  0.0 } },
+
+  { { .f = {  0x1.ffffffffffffcp+50,  0x1.ffffffffffffdp+50 } },
+           {  0x1.ffffffffffffcp+50,  0x1.ffffffffffffcp+50 } },
+  { { .f = {  0x1.ffffffffffffep+50,  0x1.0000000000000p+51 } },
+           {  0x1.ffffffffffffcp+50,  0x1.0000000000000p+51 } },
+  { { .f = {  0x1.0000000000000p+51,  0x1.0000000000001p+51 } },
+           {  0x1.0000000000000p+51,  0x1.0000000000000p+51 } },
+  { { .f = {  0x1.0000000000002p+51,  0x1.0000000000003p+51 } },
+           {  0x1.0000000000002p+51,  0x1.0000000000002p+51 } },
+
+  { { .f = {  0x1.ffffffffffffep+51,  0x1.fffffffffffffp+51 } },
+           {  0x1.ffffffffffffep+51,  0x1.ffffffffffffep+51 } },
+  { { .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+52 } },
+           { -0x1.0000000000000p+52, -0x1.ffffffffffffep+52 } },
+
+  { { .f = { -0x1.0000000000003p+51, -0x1.0000000000002p+51 } },
+           { -0x1.0000000000004p+51, -0x1.0000000000002p+51 } },
+  { { .f = { -0x1.0000000000001p+51, -0x1.0000000000000p+51 } },
+           { -0x1.0000000000002p+51, -0x1.0000000000000p+51 } },
+  { { .f = { -0x1.fffffffffffffp+50, -0x1.ffffffffffffep+50 } },
+           { -0x1.0000000000000p+51, -0x1.0000000000000p+51 } },
+  { { .f = { -0x1.ffffffffffffdp+50, -0x1.ffffffffffffcp+50 } },
+           { -0x1.0000000000000p+51, -0x1.ffffffffffffcp+50 } },
+
+  { { .f = { -1.00, -0.75 } }, { -1.0, -1.0 } },
+  { { .f = { -0.50, -0.25 } }, { -1.0, -1.0 } }
+};
+
+#include "sse4_1-round.h"
diff --git a/gcc/testsuite/gcc.target/powerpc/sse4_1-floorps.c b/gcc/testsuite/gcc.target/powerpc/sse4_1-floorps.c
new file mode 100644
index 000000000000..17ff35a7360f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/sse4_1-floorps.c
@@ -0,0 +1,33 @@ 
+/* { dg-do run } */
+/* { dg-require-effective-target p8vector_hw } */
+/* { dg-options "-O2 -mpower8-vector -Wno-psabi" } */
+
+#define NO_WARN_X86_INTRINSICS 1
+#include <smmintrin.h>
+
+#define VEC_T __m128
+#define FP_T float
+
+#define ROUND_INTRIN(x, mode) _mm_floor_ps (x)
+
+#include "sse4_1-round-data.h"
+
+static struct data data[] = {
+  { { .f = {  0.00,  0.25,  0.50,  0.75 } }, {  0.0,  0.0,  0.0,  0.0 } },
+
+  { { .f = {  0x1.fffff8p+21,  0x1.fffffap+21,  0x1.fffffcp+21,  0x1.fffffep+21 } },
+           {  0x1.fffff8p+21,  0x1.fffff8p+21,  0x1.fffff8p+21,  0x1.fffff8p+21 } },
+
+  { { .f = {  0x1.fffffap+22,  0x1.fffffcp+22,  0x1.fffffep+22,  0x1.fffffep+23 } },
+           {  0x1.fffff8p+22,  0x1.fffffcp+22,  0x1.fffffcp+22,  0x1.fffffep+23 } },
+
+  { { .f = { -0x1.fffffep+23, -0x1.fffffep+22, -0x1.fffffcp+22, -0x1.fffffap+22 } },
+           { -0x1.fffffep+23, -0x1.000000p+23, -0x1.fffffcp+22, -0x1.fffffcp+22 } },
+
+  { { .f = { -0x1.fffffep+21, -0x1.fffffcp+21, -0x1.fffffap+21, -0x1.fffff8p+21 } },
+           { -0x1.000000p+22, -0x1.000000p+22, -0x1.000000p+22, -0x1.fffff8p+21 } },
+
+  { { .f = { -1.00, -0.75, -0.50, -0.25 } }, { -1.0, -1.0, -1.0, -1.0 } }
+};
+
+#include "sse4_1-round.h"
diff --git a/gcc/testsuite/gcc.target/powerpc/sse4_1-floorsd.c b/gcc/testsuite/gcc.target/powerpc/sse4_1-floorsd.c
new file mode 100644
index 000000000000..e4ebc550556f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/sse4_1-floorsd.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 <smmintrin.h>
+
+#define VEC_T __m128d
+#define FP_T double
+
+#define ROUND_INTRIN(x, y) _mm_floor_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 = {  0.0, PASSTHROUGH } },
+  { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+    .value2 = { .f = {  0.50, IGNORED } },
+    .answer = {  0.0, PASSTHROUGH } },
+  { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+    .value2 = { .f = {  0.75, IGNORED } },
+    .answer = {  0.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.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.fffffffffffffp+50, IGNORED } },
+    .answer = {  0x1.ffffffffffffcp+50, 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.0000000000000p+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.0000000000002p+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.ffffffffffffep+51, 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.0000000000000p+52, 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.0000000000004p+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.0000000000002p+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.0000000000000p+51, PASSTHROUGH } },
+  { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+    .value2 = { .f = { -0x1.ffffffffffffdp+50, 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 = { -1.00, IGNORED } },
+    .answer = { -1.0, PASSTHROUGH } },
+  { .value1 = { .f = { IGNORED, PASSTHROUGH } },
+    .value2 = { .f = { -0.75, 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.25, IGNORED } },
+    .answer = { -1.0, PASSTHROUGH } }
+};
+
+#include "sse4_1-round2.h"
diff --git a/gcc/testsuite/gcc.target/powerpc/sse4_1-floorss.c b/gcc/testsuite/gcc.target/powerpc/sse4_1-floorss.c
new file mode 100644
index 000000000000..cfbfe2b1eba7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/sse4_1-floorss.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 <smmintrin.h>
+
+#define VEC_T __m128
+#define FP_T float
+
+#define ROUND_INTRIN(x, y) _mm_floor_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 = {  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.75, IGNORED, IGNORED, IGNORED } },
+    .answer = {  0.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.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.fffffep+21, IGNORED, IGNORED, IGNORED } },
+    .answer = {  0x1.fffff8p+21, 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.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.fffffcp+22, 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.000000p+23, 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.fffffcp+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.fffffcp+21, IGNORED, IGNORED, IGNORED } },
+    .answer = { -0x1.000000p+22, 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.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 = { -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.25, IGNORED, IGNORED, IGNORED } },
+    .answer = { -1.0, PASSTHROUGH, PASSTHROUGH, PASSTHROUGH } }
+};
+
+#include "sse4_1-round2.h"
diff --git a/gcc/testsuite/gcc.target/powerpc/sse4_1-roundpd-2.c b/gcc/testsuite/gcc.target/powerpc/sse4_1-roundpd-2.c
new file mode 100644
index 000000000000..cec16175473f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/sse4_1-roundpd-2.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 <smmintrin.h>
+
+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_floor_pd (s.x);
+
+  for (i = 0; i < 2; i++)
+    {
+      __m128d tmp = _mm_load_sd (&s.a[i]);
+      tmp = _mm_floor_sd (tmp, tmp);
+      _mm_store_sd (&e[i], tmp);
+    }
+  
+  if (check_union128d (u, e))
+    abort ();
+}