[v2,4/6] rs6000: Add tests for SSE4.1 "ceil" intrinsics

Message ID 20210716135022.489455-5-pc@us.ibm.com
State New
Headers show
Series
  • rs6000: Add SSE4.1 "blend", "ceil", "floor"
Related show

Commit Message

Michael Meissner via Gcc-patches July 16, 2021, 1:50 p.m.
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-16  Paul A. Clarke  <pc@us.ibm.com>

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.
	* gcc.target/powerpc/sse4_1-check.h (__VSX_SSE2__): Define.
---
v2: Improve formatting per review from Bill.

 .../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

-- 
2.27.0

Comments

Michael Meissner via Gcc-patches July 16, 2021, 6:22 p.m. | #1
Hi Paul,

Thanks for the cleanup, LGTM!  Recommend maintainers approve.

Bill

On 7/16/21 8:50 AM, Paul A. Clarke wrote:
> 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-16  Paul A. Clarke  <pc@us.ibm.com>

>

> 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.

> 	* gcc.target/powerpc/sse4_1-check.h (__VSX_SSE2__): Define.

> ---

> v2: Improve formatting per review from Bill.

>

>   .../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 <smmintrin.h>

> +

> +#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 <smmintrin.h>

> +

> +#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 <smmintrin.h>

> +

> +#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 <smmintrin.h>

> +

> +#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 <stdio.h>

>   #include <stdlib.h>

>   

> +/* 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..6acf8da8b766

> --- /dev/null

> +++ b/gcc/testsuite/gcc.target/powerpc/sse4_1-round.h

> @@ -0,0 +1,27 @@

> +#include <fenv.h>

> +#include <smmintrin.h>

> +#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++) {

> +    (void) 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 ();

> +      }

> +    }

> +  }

> +  (void) 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..859574e11d9a

> --- /dev/null

> +++ b/gcc/testsuite/gcc.target/powerpc/sse4_1-round2.h

> @@ -0,0 +1,27 @@

> +#include <fenv.h>

> +#include <smmintrin.h>

> +#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++) {

> +    (void) 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 ();

> +      }

> +    }

> +  }

> +  (void) 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 <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_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 ();

> +}
Segher Boessenkool July 28, 2021, 10:16 p.m. | #2
Hi!

On Fri, Jul 16, 2021 at 08:50:20AM -0500, Paul A. Clarke wrote:
> --- /dev/null

> +++ b/gcc/testsuite/gcc.target/powerpc/sse4_1-round.h

> @@ -0,0 +1,27 @@

> +#include <fenv.h>

> +#include <smmintrin.h>

> +#include "sse4_1-check.h"

> +

> +#define DIM(a) (sizeof (a) / sizeof ((a)[0]))


Pet peeve: sizeof is an operator, not a function, so even if you want to
protect the macro parameter this just is
  #define DIM(a) (sizeof (a) / sizeof (a)[0])

> +  (void) fesetround (round_save);


Please don't cast to (void).  That never does *anything*.

Okay for trunk (these are all testsuite files after all, and we should
test horrrible style as well! :-P )

Thanks,


Segher
Michael Meissner via Gcc-patches July 30, 2021, 10:13 p.m. | #3
On Wed, Jul 28, 2021 at 05:16:32PM -0500, Segher Boessenkool wrote:
> On Fri, Jul 16, 2021 at 08:50:20AM -0500, Paul A. Clarke wrote:

> > --- /dev/null

> > +++ b/gcc/testsuite/gcc.target/powerpc/sse4_1-round.h

> > @@ -0,0 +1,27 @@

> > +#include <fenv.h>

> > +#include <smmintrin.h>

> > +#include "sse4_1-check.h"

> > +

> > +#define DIM(a) (sizeof (a) / sizeof ((a)[0]))

> 

> Pet peeve: sizeof is an operator, not a function, so even if you want to

> protect the macro parameter this just is

>   #define DIM(a) (sizeof (a) / sizeof (a)[0])

> 

> > +  (void) fesetround (round_save);

> 

> Please don't cast to (void).  That never does *anything*.

> 

> Okay for trunk (these are all testsuite files after all, and we should

> test horrrible style as well! :-P )


I didn't want to be responsible for promulgating horrible style, so
I incorporated the above changes and pushed as
d656a3d3ce88d402a14e8c120f1b0e78a3979deb.  :-)

PC

Patch

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 <smmintrin.h>
+
+#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 <smmintrin.h>
+
+#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 <smmintrin.h>
+
+#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 <smmintrin.h>
+
+#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 <stdio.h>
 #include <stdlib.h>
 
+/* 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..6acf8da8b766
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/sse4_1-round.h
@@ -0,0 +1,27 @@ 
+#include <fenv.h>
+#include <smmintrin.h>
+#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++) {
+    (void) 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 ();
+      }
+    }
+  }
+  (void) 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..859574e11d9a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/sse4_1-round2.h
@@ -0,0 +1,27 @@ 
+#include <fenv.h>
+#include <smmintrin.h>
+#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++) {
+    (void) 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 ();
+      }
+    }
+  }
+  (void) 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 <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_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 ();
+}