From 5a5838e09e1e7fdb51d45c094a570f36de133b93 Mon Sep 17 00:00:00 2001 From: Steven Munroe Date: Fri, 21 Jul 2017 17:44:22 +0000 Subject: [PATCH] Now completeting the mmintrin.h intrinsic headers for PowerPC by adding the DG tests. 2017-07-21 Steven Munroe * gcc.target/powerpc/mmx-check.h: New file. * gcc.target/powerpc/mmx-packs.c: New file. * gcc.target/powerpc/mmx-packssdw-1.c: New file. * gcc.target/powerpc/mmx-packsswb-1.c: New file. * gcc.target/powerpc/mmx-packuswb-1.c: New file. * gcc.target/powerpc/mmx-paddb-1.c: New file. * gcc.target/powerpc/mmx-paddd-1.c: New file. * gcc.target/powerpc/mmx-paddsb-1.c: New file. * gcc.target/powerpc/mmx-paddsw-1.c: New file. * gcc.target/powerpc/mmx-paddusb-1.c: New file. * gcc.target/powerpc/mmx-paddusw-1.c: New file. * gcc.target/powerpc/mmx-paddw-1.c: New file. * gcc.target/powerpc/mmx-pcmpeqb-1.c: New file. * gcc.target/powerpc/mmx-pcmpeqd-1.c: New file. * gcc.target/powerpc/mmx-pcmpeqw-1.c: New file. * gcc.target/powerpc/mmx-pcmpgtb-1.c: New file. * gcc.target/powerpc/mmx-pcmpgtd-1.c: New file. * gcc.target/powerpc/mmx-pcmpgtw-1.c: New file. * gcc.target/powerpc/mmx-pmaddwd-1.c: New file. * gcc.target/powerpc/mmx-pmulhw-1.c: New file. * gcc.target/powerpc/mmx-pmullw-1.c: New file. * gcc.target/powerpc/mmx-pslld-1.c: New file. * gcc.target/powerpc/mmx-psllw-1.c: New file. * gcc.target/powerpc/mmx-psrad-1.c: New file. * gcc.target/powerpc/mmx-psraw-1.c: New file. * gcc.target/powerpc/mmx-psrld-1.c: New file. * gcc.target/powerpc/mmx-psrlw-1.c: New file. * gcc.target/powerpc/mmx-psubb-2.c: New file. * gcc.target/powerpc/mmx-psubd-2.c: New file. * gcc.target/powerpc/mmx-psubsb-1.c: New file. * gcc.target/powerpc/mmx-psubsw-1.c: New file. * gcc.target/powerpc/mmx-psubusb-1.c: New file. * gcc.target/powerpc/mmx-psubusw-1.c: New file. * gcc.target/powerpc/mmx-psubw-2.c: New file. * gcc.target/powerpc/mmx-punpckhbw-1.c: New file. * gcc.target/powerpc/mmx-punpckhdq-1.c: New file. * gcc.target/powerpc/mmx-punpckhwd-1.c: New file. * gcc.target/powerpc/mmx-punpcklbw-1.c: New file. * gcc.target/powerpc/mmx-punpckldq-1.c: New file. * gcc.target/powerpc/mmx-punpcklwd-1.c: New file. From-SVN: r250432 --- gcc/testsuite/ChangeLog | 43 +++++++++ gcc/testsuite/gcc.target/powerpc/mmx-check.h | 35 +++++++ gcc/testsuite/gcc.target/powerpc/mmx-packs.c | 91 +++++++++++++++++++ .../gcc.target/powerpc/mmx-packssdw-1.c | 60 ++++++++++++ .../gcc.target/powerpc/mmx-packsswb-1.c | 60 ++++++++++++ .../gcc.target/powerpc/mmx-packuswb-1.c | 50 ++++++++++ .../gcc.target/powerpc/mmx-paddb-1.c | 42 +++++++++ .../gcc.target/powerpc/mmx-paddd-1.c | 42 +++++++++ .../gcc.target/powerpc/mmx-paddsb-1.c | 51 +++++++++++ .../gcc.target/powerpc/mmx-paddsw-1.c | 51 +++++++++++ .../gcc.target/powerpc/mmx-paddusb-1.c | 51 +++++++++++ .../gcc.target/powerpc/mmx-paddusw-1.c | 52 +++++++++++ .../gcc.target/powerpc/mmx-paddw-1.c | 42 +++++++++ .../gcc.target/powerpc/mmx-pcmpeqb-1.c | 42 +++++++++ .../gcc.target/powerpc/mmx-pcmpeqd-1.c | 42 +++++++++ .../gcc.target/powerpc/mmx-pcmpeqw-1.c | 42 +++++++++ .../gcc.target/powerpc/mmx-pcmpgtb-1.c | 42 +++++++++ .../gcc.target/powerpc/mmx-pcmpgtd-1.c | 42 +++++++++ .../gcc.target/powerpc/mmx-pcmpgtw-1.c | 42 +++++++++ .../gcc.target/powerpc/mmx-pmaddwd-1.c | 43 +++++++++ .../gcc.target/powerpc/mmx-pmulhw-1.c | 46 ++++++++++ .../gcc.target/powerpc/mmx-pmullw-1.c | 46 ++++++++++ .../gcc.target/powerpc/mmx-pslld-1.c | 45 +++++++++ .../gcc.target/powerpc/mmx-psllw-1.c | 45 +++++++++ .../gcc.target/powerpc/mmx-psrad-1.c | 44 +++++++++ .../gcc.target/powerpc/mmx-psraw-1.c | 44 +++++++++ .../gcc.target/powerpc/mmx-psrld-1.c | 44 +++++++++ .../gcc.target/powerpc/mmx-psrlw-1.c | 44 +++++++++ .../gcc.target/powerpc/mmx-psubb-2.c | 42 +++++++++ .../gcc.target/powerpc/mmx-psubd-2.c | 42 +++++++++ .../gcc.target/powerpc/mmx-psubsb-1.c | 51 +++++++++++ .../gcc.target/powerpc/mmx-psubsw-1.c | 51 +++++++++++ .../gcc.target/powerpc/mmx-psubusb-1.c | 51 +++++++++++ .../gcc.target/powerpc/mmx-psubusw-1.c | 52 +++++++++++ .../gcc.target/powerpc/mmx-psubw-2.c | 42 +++++++++ .../gcc.target/powerpc/mmx-punpckhbw-1.c | 44 +++++++++ .../gcc.target/powerpc/mmx-punpckhdq-1.c | 40 ++++++++ .../gcc.target/powerpc/mmx-punpckhwd-1.c | 44 +++++++++ .../gcc.target/powerpc/mmx-punpcklbw-1.c | 44 +++++++++ .../gcc.target/powerpc/mmx-punpckldq-1.c | 40 ++++++++ .../gcc.target/powerpc/mmx-punpcklwd-1.c | 44 +++++++++ 41 files changed, 1910 insertions(+) create mode 100644 gcc/testsuite/gcc.target/powerpc/mmx-check.h create mode 100644 gcc/testsuite/gcc.target/powerpc/mmx-packs.c create mode 100644 gcc/testsuite/gcc.target/powerpc/mmx-packssdw-1.c create mode 100644 gcc/testsuite/gcc.target/powerpc/mmx-packsswb-1.c create mode 100644 gcc/testsuite/gcc.target/powerpc/mmx-packuswb-1.c create mode 100644 gcc/testsuite/gcc.target/powerpc/mmx-paddb-1.c create mode 100644 gcc/testsuite/gcc.target/powerpc/mmx-paddd-1.c create mode 100644 gcc/testsuite/gcc.target/powerpc/mmx-paddsb-1.c create mode 100644 gcc/testsuite/gcc.target/powerpc/mmx-paddsw-1.c create mode 100644 gcc/testsuite/gcc.target/powerpc/mmx-paddusb-1.c create mode 100644 gcc/testsuite/gcc.target/powerpc/mmx-paddusw-1.c create mode 100644 gcc/testsuite/gcc.target/powerpc/mmx-paddw-1.c create mode 100644 gcc/testsuite/gcc.target/powerpc/mmx-pcmpeqb-1.c create mode 100644 gcc/testsuite/gcc.target/powerpc/mmx-pcmpeqd-1.c create mode 100644 gcc/testsuite/gcc.target/powerpc/mmx-pcmpeqw-1.c create mode 100644 gcc/testsuite/gcc.target/powerpc/mmx-pcmpgtb-1.c create mode 100644 gcc/testsuite/gcc.target/powerpc/mmx-pcmpgtd-1.c create mode 100644 gcc/testsuite/gcc.target/powerpc/mmx-pcmpgtw-1.c create mode 100644 gcc/testsuite/gcc.target/powerpc/mmx-pmaddwd-1.c create mode 100644 gcc/testsuite/gcc.target/powerpc/mmx-pmulhw-1.c create mode 100644 gcc/testsuite/gcc.target/powerpc/mmx-pmullw-1.c create mode 100644 gcc/testsuite/gcc.target/powerpc/mmx-pslld-1.c create mode 100644 gcc/testsuite/gcc.target/powerpc/mmx-psllw-1.c create mode 100644 gcc/testsuite/gcc.target/powerpc/mmx-psrad-1.c create mode 100644 gcc/testsuite/gcc.target/powerpc/mmx-psraw-1.c create mode 100644 gcc/testsuite/gcc.target/powerpc/mmx-psrld-1.c create mode 100644 gcc/testsuite/gcc.target/powerpc/mmx-psrlw-1.c create mode 100644 gcc/testsuite/gcc.target/powerpc/mmx-psubb-2.c create mode 100644 gcc/testsuite/gcc.target/powerpc/mmx-psubd-2.c create mode 100644 gcc/testsuite/gcc.target/powerpc/mmx-psubsb-1.c create mode 100644 gcc/testsuite/gcc.target/powerpc/mmx-psubsw-1.c create mode 100644 gcc/testsuite/gcc.target/powerpc/mmx-psubusb-1.c create mode 100644 gcc/testsuite/gcc.target/powerpc/mmx-psubusw-1.c create mode 100644 gcc/testsuite/gcc.target/powerpc/mmx-psubw-2.c create mode 100644 gcc/testsuite/gcc.target/powerpc/mmx-punpckhbw-1.c create mode 100644 gcc/testsuite/gcc.target/powerpc/mmx-punpckhdq-1.c create mode 100644 gcc/testsuite/gcc.target/powerpc/mmx-punpckhwd-1.c create mode 100644 gcc/testsuite/gcc.target/powerpc/mmx-punpcklbw-1.c create mode 100644 gcc/testsuite/gcc.target/powerpc/mmx-punpckldq-1.c create mode 100644 gcc/testsuite/gcc.target/powerpc/mmx-punpcklwd-1.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 148bb429f71..530a4abc1a7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,46 @@ +2017-07-21 Steven Munroe + + * gcc.target/powerpc/mmx-check.h: New file. + * gcc.target/powerpc/mmx-packs.c: New file. + * gcc.target/powerpc/mmx-packssdw-1.c: New file. + * gcc.target/powerpc/mmx-packsswb-1.c: New file. + * gcc.target/powerpc/mmx-packuswb-1.c: New file. + * gcc.target/powerpc/mmx-paddb-1.c: New file. + * gcc.target/powerpc/mmx-paddd-1.c: New file. + * gcc.target/powerpc/mmx-paddsb-1.c: New file. + * gcc.target/powerpc/mmx-paddsw-1.c: New file. + * gcc.target/powerpc/mmx-paddusb-1.c: New file. + * gcc.target/powerpc/mmx-paddusw-1.c: New file. + * gcc.target/powerpc/mmx-paddw-1.c: New file. + * gcc.target/powerpc/mmx-pcmpeqb-1.c: New file. + * gcc.target/powerpc/mmx-pcmpeqd-1.c: New file. + * gcc.target/powerpc/mmx-pcmpeqw-1.c: New file. + * gcc.target/powerpc/mmx-pcmpgtb-1.c: New file. + * gcc.target/powerpc/mmx-pcmpgtd-1.c: New file. + * gcc.target/powerpc/mmx-pcmpgtw-1.c: New file. + * gcc.target/powerpc/mmx-pmaddwd-1.c: New file. + * gcc.target/powerpc/mmx-pmulhw-1.c: New file. + * gcc.target/powerpc/mmx-pmullw-1.c: New file. + * gcc.target/powerpc/mmx-pslld-1.c: New file. + * gcc.target/powerpc/mmx-psllw-1.c: New file. + * gcc.target/powerpc/mmx-psrad-1.c: New file. + * gcc.target/powerpc/mmx-psraw-1.c: New file. + * gcc.target/powerpc/mmx-psrld-1.c: New file. + * gcc.target/powerpc/mmx-psrlw-1.c: New file. + * gcc.target/powerpc/mmx-psubb-2.c: New file. + * gcc.target/powerpc/mmx-psubd-2.c: New file. + * gcc.target/powerpc/mmx-psubsb-1.c: New file. + * gcc.target/powerpc/mmx-psubsw-1.c: New file. + * gcc.target/powerpc/mmx-psubusb-1.c: New file. + * gcc.target/powerpc/mmx-psubusw-1.c: New file. + * gcc.target/powerpc/mmx-psubw-2.c: New file. + * gcc.target/powerpc/mmx-punpckhbw-1.c: New file. + * gcc.target/powerpc/mmx-punpckhdq-1.c: New file. + * gcc.target/powerpc/mmx-punpckhwd-1.c: New file. + * gcc.target/powerpc/mmx-punpcklbw-1.c: New file. + * gcc.target/powerpc/mmx-punpckldq-1.c: New file. + * gcc.target/powerpc/mmx-punpcklwd-1.c: New file. + 2017-06-21 Richard Biener PR tree-optimization/81500 diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-check.h b/gcc/testsuite/gcc.target/powerpc/mmx-check.h new file mode 100644 index 00000000000..e08077f6d80 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-check.h @@ -0,0 +1,35 @@ +#include +#include + +static void mmx_test (void); + +static void +__attribute__ ((noinline)) +do_test (void) +{ + mmx_test (); +} + +int +main () + { +#ifdef __BUILTIN_CPU_SUPPORTS__ + /* Many MMX intrinsics are simpler / faster to implement by + transferring the __m64 (long int) to vector registers for SIMD + operations. To be efficient we also need the direct register + transfer instructions from POWER8. So we can test for + arch_2_07. */ + if ( __builtin_cpu_supports ("arch_2_07") ) + { + do_test (); +#ifdef DEBUG + printf ("PASSED\n"); +#endif + } +#ifdef DEBUG + else + printf ("SKIPPED\n"); +#endif +#endif /* __BUILTIN_CPU_SUPPORTS__ */ + return 0; + } diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-packs.c b/gcc/testsuite/gcc.target/powerpc/mmx-packs.c new file mode 100644 index 00000000000..18faa5a18eb --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-packs.c @@ -0,0 +1,91 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#include +#include "mmx-check.h" + +#ifndef TEST +#define TEST mmx_test +#endif + +static void +__attribute__ ((noinline)) +check_packs_pu16 (unsigned long long int src1, unsigned long long int src2, + unsigned long long int res_ref) +{ + unsigned long long int res; + + res = (unsigned long long int) _mm_packs_pu16 ((__m64 ) src1, (__m64 ) src2); + + if (res != res_ref) + abort (); +} + +static void +__attribute__ ((noinline)) +check_packs_pi16 (unsigned long long int src1, unsigned long long int src2, + unsigned long long int res_ref) +{ + unsigned long long int res; + + res = (unsigned long long int) _mm_packs_pi16 ((__m64 ) src1, (__m64 ) src2); + + + if (res != res_ref) + abort (); +} + +static void +__attribute__ ((noinline)) +check_packs_pi32 (unsigned long long int src1, unsigned long long int src2, + unsigned long long int res_ref) +{ + unsigned long long int res; + + res = (unsigned long long int) _mm_packs_pi32 ((__m64 ) src1, (__m64 ) src2); + + if (res != res_ref) + abort (); +} + +static unsigned long long int src1[] = + { 0xffff0000fffe0000UL, 0x0001000000020000UL, 0xfffffffffffffffeUL, + 0x0000000100000002UL, 0x0001000200030004UL, 0xfffffffefffdfffcUL, + 0x0100020003000400UL, 0xff00fe01fe02fe03UL }; + +static unsigned long long int src2[] = + { 0xfffffffdfffffffcUL, 0x0000000200000003UL, 0xfffffffdfffffffcUL, + 0x0000000300000004UL, 0x0005000600070008UL, 0xfffbfffafff9fff8UL, + 0x0005000600070008UL, 0xfffbfffafff9fff8UL }; + +static unsigned long long int res_pi16[] = + { 0xfffdfffcff00fe00UL, 0x0002000301000200UL, 0xfffdfffcfffffffeUL, + 0x0003000400010002UL, 0x0506070801020304UL, 0xfbfaf9f8fffefdfcUL, + 0x050607087f7f7f7fUL, 0xfbfaf9f880808080UL }; + +static unsigned long long int res_pi32[] = + { 0xfffdfffc80008000UL, 0x000200037fff7fffUL, 0xfffdfffcfffffffeUL, + 0x0003000400010002UL, 0x7fff7fff7fff7fffUL, 0x80008000fffe8000UL, + 0x7fff7fff7fff7fffUL, 0x8000800080008000UL }; + +static unsigned long long int res_pu16[] = + { 0x0000000000000000UL, 0x0002000301000200UL, 0x0000000000000000UL, + 0x0003000400010002UL, 0x0506070801020304UL, 0x000000000000000UL, + 0x5060708ffffffffUL, 0x0000000000000000UL }; + +static void +TEST () +{ + long i; + + for (i = 0; i < 8; i++) + { + check_packs_pu16 (src1[i], src2[i], res_pu16[i]); + check_packs_pi16 (src1[i], src2[i], res_pi16[i]); + check_packs_pi32 (src1[i], src2[i], res_pi32[i]); + } +} + diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-packssdw-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-packssdw-1.c new file mode 100644 index 00000000000..8698d55f012 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-packssdw-1.c @@ -0,0 +1,60 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_packs_pi32 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union s1, s2; + __m64_union u; + __m64_union e; + int i; + + s1.as_m64 = _mm_set_pi32 (2134, -128); + s2.as_m64 = _mm_set_pi32 (41124, 234); + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 2; i++) + { + if (s1.as_int[i] > 32767) + e.as_short[i] = 32767; + else if (s1.as_int[i] < -32768) + e.as_short[i] = -32768; + else + e.as_short[i] = s1.as_int[i]; + } + + for (i = 0; i < 2; i++) + { + if (s2.as_int[i] > 32767) + e.as_short[i+2] = 32767; + else if (s2.as_int[i] < -32768) + e.as_short[i+2] = -32768; + else + e.as_short[i+2] = s2.as_int[i]; + } + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-packsswb-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-packsswb-1.c new file mode 100644 index 00000000000..96bea7b81ab --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-packsswb-1.c @@ -0,0 +1,60 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_packs_pi16 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union s1, s2; + __m64_union u; + __m64_union e; + int i; + + s1.as_m64 = _mm_set_pi16 (2134, -128, 1234, 6354); + s2.as_m64 = _mm_set_pi16 (41124, 234, 2344, 2354); + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 4; i++) + { + if (s1.as_short[i] > 127) + e.as_char[i] = 127; + else if (s1.as_short[i] < -128) + e.as_char[i] = -128; + else + e.as_char[i] = s1.as_short[i]; + } + + for (i = 0; i < 4; i++) + { + if (s2.as_short[i] > 127) + e.as_char[i+4] = 127; + else if (s2.as_short[i] < -128) + e.as_char[i+4] = -128; + else + e.as_char[i+4] = s2.as_short[i]; + } + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-packuswb-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-packuswb-1.c new file mode 100644 index 00000000000..029d5687d71 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-packuswb-1.c @@ -0,0 +1,50 @@ +/* { dg-do run } */ +/* { dg-options "-O3" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_packs_pu16 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union s1, s2; + __m64_union u; + __m64_union e; + int i, tmp; + + s1.as_m64 = _mm_set_pi16 (1, 2, 3, 4); + s2.as_m64 = _mm_set_pi16 (-9, -10, -11, -12); + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i=0; i<4; i++) + { + tmp = s1.as_short[i]<0 ? 0 : s1.as_short[i]; + tmp = tmp>255 ? 255 : tmp; + e.as_char[i] = tmp; + + tmp = s2.as_short[i]<0 ? 0 : s2.as_short[i]; + tmp = tmp>255 ? 255 : tmp; + e.as_char[i+4] = tmp; + } + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-paddb-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-paddb-1.c new file mode 100644 index 00000000000..46b0584549e --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-paddb-1.c @@ -0,0 +1,42 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_add_pi8 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2; + __m64_union e; + int i; + + s1.as_m64 = _mm_set_pi8 (1, 2, 3, 4, 10, 20, 30, 90); + s2.as_m64 = _mm_set_pi8 (88, 44, 33, 22, 11, 98, 76, -100); + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 8; i++) + e.as_char[i] = s1.as_char[i] + s2.as_char[i]; + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-paddd-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-paddd-1.c new file mode 100644 index 00000000000..a006dda0ee4 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-paddd-1.c @@ -0,0 +1,42 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_add_pi32 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2; + __m64_union e; + int i; + + s1.as_m64 = _mm_set_pi32 (30, 90); + s2.as_m64 = _mm_set_pi32 (76, -100); + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 2; i++) + e.as_int[i] = s1.as_int[i] + s2.as_int[i]; + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-paddsb-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-paddsb-1.c new file mode 100644 index 00000000000..5722302095e --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-paddsb-1.c @@ -0,0 +1,51 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_adds_pi8 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2; + __m64_union e; + int i, tmp; + + s1.as_m64 = _mm_set_pi8 (1, 2, 3, 4, 10, 20, 30, 90); + s2.as_m64 = _mm_set_pi8 (88, 44, 33, 22, 11, 98, 76, -100); + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 8; i++) + { + tmp = s1.as_signed_char[i] + s2.as_signed_char[i]; + + if (tmp > 127) + tmp = 127; + if (tmp < -128) + tmp = -128; + + e.as_signed_char[i] = tmp; + } + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-paddsw-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-paddsw-1.c new file mode 100644 index 00000000000..f7518b4dbae --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-paddsw-1.c @@ -0,0 +1,51 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_adds_pi16 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2; + __m64_union e; + int i, tmp; + + s1.as_m64 = _mm_set_pi16 (1, 2, 3, 4); + s2.as_m64 = _mm_set_pi16 (11, 98, 76, -100); + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 4; i++) + { + tmp = s1.as_short[i] + s2.as_short[i]; + + if (tmp > 32767) + tmp = 32767; + if (tmp < -32768) + tmp = -32768; + + e.as_short[i] = tmp; + } + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-paddusb-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-paddusb-1.c new file mode 100644 index 00000000000..a209e3e30dd --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-paddusb-1.c @@ -0,0 +1,51 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_adds_pu8 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2; + __m64_union e; + int i, tmp; + + s1.as_m64 = _mm_set_pi8 (30, 2, 3, 4, 10, 20, 30, 90); + s2.as_m64 = _mm_set_pi8 (88, 44, 33, 22, 11, 98, 76, 100); + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 8; i++) + { + tmp = s1.as_char[i] + s2.as_char[i]; + + if (tmp > 255) + tmp = -1; + if (tmp < 0) + tmp = 0; + + e.as_char[i] = tmp; + } + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-paddusw-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-paddusw-1.c new file mode 100644 index 00000000000..b46b7f636bb --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-paddusw-1.c @@ -0,0 +1,52 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_adds_pu16 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2; + __m64_union e; + int i, tmp; + + s1.as_m64 = _mm_set_pi16 (1, 2, 3, 4); + s2.as_m64 = _mm_set_pi16 (11, 98, 76, 100); + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 4; i++) + { + tmp = (unsigned short)s1.as_short[i] + (unsigned short)s2.as_short[i]; + + if (tmp > 65535) + tmp = -1; + + if (tmp < 0) + tmp = 0; + + e.as_short[i] = tmp; + } + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-paddw-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-paddw-1.c new file mode 100644 index 00000000000..748fe2b5703 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-paddw-1.c @@ -0,0 +1,42 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_add_pi16 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2; + __m64_union e; + int i; + + s1.as_m64 = _mm_set_pi16 (10, 20, 30, 90); + s2.as_m64 = _mm_set_pi16 (11, 98, 76, -100); + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 4; i++) + e.as_short[i] = s1.as_short[i] + s2.as_short[i]; + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-pcmpeqb-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-pcmpeqb-1.c new file mode 100644 index 00000000000..c779b26e691 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-pcmpeqb-1.c @@ -0,0 +1,42 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_cmpeq_pi8 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2; + __m64_union e; + int i; + + s1.as_m64 = _mm_set_pi8 (1, 2, 3, 4, 10, 20, 30, 90); + s2.as_m64 = _mm_set_pi8 (88, 44, 3, 22, 11, 98, 30, 100); + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 8; i++) + e.as_char[i] = (s1.as_char[i] == s2.as_char[i]) ? -1:0; + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-pcmpeqd-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-pcmpeqd-1.c new file mode 100644 index 00000000000..a7807a2fdd9 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-pcmpeqd-1.c @@ -0,0 +1,42 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_cmpeq_pi32 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2; + __m64_union e; + int i; + + s1.as_m64 = _mm_set_pi32 (98, 25); + s2.as_m64 = _mm_set_pi32 (98, -100); + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 2; i++) + e.as_int[i] = (s1.as_int[i] == s2.as_int[i]) ? -1:0; + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-pcmpeqw-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-pcmpeqw-1.c new file mode 100644 index 00000000000..e25fd54c6b5 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-pcmpeqw-1.c @@ -0,0 +1,42 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_cmpeq_pi16 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2; + __m64_union e; + int i; + + s1.as_m64 = _mm_set_pi16 (20, 30, 90, 80); + s2.as_m64 = _mm_set_pi16 (34, 78, 90, 6); + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 4; i++) + e.as_short[i] = (s1.as_short[i] == s2.as_short[i]) ? -1:0; + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-pcmpgtb-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-pcmpgtb-1.c new file mode 100644 index 00000000000..7f841b0b26e --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-pcmpgtb-1.c @@ -0,0 +1,42 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_cmpgt_pi8 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2; + __m64_union e; + int i; + + s1.as_m64 = _mm_set_pi8 (1, 2, 3, 4, 10, 20, 30, 90); + s2.as_m64 = _mm_set_pi8 (88, 44, 3, 22, 11, 98, 28, 100); + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 8; i++) + e.as_char[i] = (s1.as_char[i] > s2.as_char[i]) ? -1 : 0; + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-pcmpgtd-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-pcmpgtd-1.c new file mode 100644 index 00000000000..9f503b5ec9e --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-pcmpgtd-1.c @@ -0,0 +1,42 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_cmpgt_pi32 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2; + __m64_union e; + int i; + + s1.as_m64 = _mm_set_pi32 (99, 25); + s2.as_m64 = _mm_set_pi32 (98, -100); + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 2; i++) + e.as_int[i] = (s1.as_int[i] > s2.as_int[i]) ? -1:0; + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-pcmpgtw-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-pcmpgtw-1.c new file mode 100644 index 00000000000..85716937e0d --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-pcmpgtw-1.c @@ -0,0 +1,42 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_cmpgt_pi16 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2; + __m64_union e; + int i; + + s1.as_m64 = _mm_set_pi16 (20, 30, 90, 80); + s2.as_m64 = _mm_set_pi16 (34, 78, 90, 6); + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 4; i++) + e.as_short[i] = (s1.as_short[i] > s2.as_short[i]) ? -1:0; + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-pmaddwd-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-pmaddwd-1.c new file mode 100644 index 00000000000..220b4f65209 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-pmaddwd-1.c @@ -0,0 +1,43 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_madd_pi16 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2; + __m64_union e; + int i; + + s1.as_m64 = _mm_set_pi16 (2134, 3334, 1234, 6354); + s2.as_m64 = _mm_set_pi16 (1, 3, 4, 5); + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 2; i++) + e.as_int[i] = (s1.as_short[i * 2] * s2.as_short[i * 2]) + + (s1.as_short[(i * 2) + 1] * s2.as_short[(i * 2) + 1]); + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-pmulhw-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-pmulhw-1.c new file mode 100644 index 00000000000..79b7c7b1838 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-pmulhw-1.c @@ -0,0 +1,46 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_mulhi_pi16 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2; + __m64_union e; + int i, tmp; + + s1.as_m64 = _mm_set_pi16 (10, 2067, -3033, 90); + s2.as_m64 = _mm_set_pi16 (11, 9834, 7444, -10222); + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 4; i++) + { + tmp = s1.as_short[i] * s2.as_short[i]; + + e.as_short[i] = (tmp & 0xffff0000)>>16; + } + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-pmullw-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-pmullw-1.c new file mode 100644 index 00000000000..6d041691772 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-pmullw-1.c @@ -0,0 +1,46 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_mullo_pi16 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2; + __m64_union e; + int i, tmp; + + s1.as_m64 = _mm_set_pi16 (10, 2067, -3033, 90); + s2.as_m64 = _mm_set_pi16 (11, 9834, 7444, -10222); + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 4; i++) + { + tmp = s1.as_short[i] * s2.as_short[i]; + + e.as_short[i] = tmp; + } + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-pslld-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-pslld-1.c new file mode 100644 index 00000000000..af687cd1e96 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-pslld-1.c @@ -0,0 +1,45 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#define N 0xb + +#include CHECK_H + +#include + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1) +{ + return _mm_sll_pi32 (s1, N); +} + +static void +TEST (void) +{ + __m64_union u, s1; + __m64_union e; + int i; + + s1.as_m64 = _mm_setr_pi32 (1, -2); + u.as_m64 = test (s1.as_m64); + + + if (N < 16) + for (i = 0; i < 2; i++) + e.as_int[i] = s1.as_int[i] << N; + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-psllw-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-psllw-1.c new file mode 100644 index 00000000000..415f6a84176 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-psllw-1.c @@ -0,0 +1,45 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#define N 0xb + +#include CHECK_H + +#include + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1) +{ + return _mm_sll_pi16 (s1, N); +} + +static void +TEST (void) +{ + __m64_union u, s1; + __m64_union e; + int i; + + s1.as_m64 = _mm_setr_pi16 (1, 2, 0x7000, 0x9000); + u.as_m64 = test (s1.as_m64); + + + if (N < 16) + for (i = 0; i < 4; i++) + e.as_short[i] = s1.as_short[i] << N; + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-psrad-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-psrad-1.c new file mode 100644 index 00000000000..eaaf214292e --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-psrad-1.c @@ -0,0 +1,44 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#define N 0xb + +#include CHECK_H + +#include + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1) +{ + return _mm_sra_pi32 (s1, N); +} + +static void +TEST (void) +{ + __m64_union u, s1; + __m64_union e; + int i; + + s1.as_m64 = _mm_setr_pi32 (1000, -20000); + u.as_m64 = test (s1.as_m64); + + if (N < 16) + for (i = 0; i < 2; i++) + e.as_int[i] = s1.as_int[i] >> N; + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-psraw-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-psraw-1.c new file mode 100644 index 00000000000..eb7c3aec150 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-psraw-1.c @@ -0,0 +1,44 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#define N 0xb + +#include CHECK_H + +#include + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1) +{ + return _mm_sra_pi16 (s1, N); +} + +static void +TEST (void) +{ + __m64_union u, s1; + __m64_union e; + int i; + + s1.as_m64 = _mm_setr_pi16 (1, -2, 0x7000, 0x9000); + u.as_m64 = test (s1.as_m64); + + if (N < 16) + for (i = 0; i < 4; i++) + e.as_short[i] = s1.as_short[i] >> N; + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-psrld-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-psrld-1.c new file mode 100644 index 00000000000..1eb9d2897a7 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-psrld-1.c @@ -0,0 +1,44 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#define N 0xb + +#include CHECK_H + +#include + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1) +{ + return _mm_srl_pi32 (s1, N); +} + +static void +TEST (void) +{ + __m64_union u, s1; + __m64_union e; + int i; + + s1.as_m64 = _mm_setr_pi32 (1000, -20000); + u.as_m64 = test (s1.as_m64); + + if (N < 16) + for (i = 0; i < 2; i++) + e.as_int[i] = (unsigned int)s1.as_int[i] >> N; + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-psrlw-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-psrlw-1.c new file mode 100644 index 00000000000..d066159e8eb --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-psrlw-1.c @@ -0,0 +1,44 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#define N 0xb + +#include CHECK_H + +#include + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1) +{ + return _mm_srl_pi16 (s1, N); +} + +static void +TEST (void) +{ + __m64_union u, s1; + __m64_union e; + int i; + + s1.as_m64 = _mm_setr_pi16 (1, -2, 0x7000, 0x9000); + u.as_m64 = test (s1.as_m64); + + if (N < 16) + for (i = 0; i < 4; i++) + e.as_short[i] = (unsigned short)s1.as_short[i] >> N; + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-psubb-2.c b/gcc/testsuite/gcc.target/powerpc/mmx-psubb-2.c new file mode 100644 index 00000000000..c64204afa41 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-psubb-2.c @@ -0,0 +1,42 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_sub_pi8 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2; + __m64_union e; + int i; + + s1.as_m64 = _mm_set_pi8 (1, 2, 3, 4, 10, 20, 30, 90); + s2.as_m64 = _mm_set_pi8 (88, 44, 3, 22, 11, 98, 76, -100); + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 8; i++) + e.as_char[i] = s1.as_char[i] - s2.as_char[i]; + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-psubd-2.c b/gcc/testsuite/gcc.target/powerpc/mmx-psubd-2.c new file mode 100644 index 00000000000..3260f611748 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-psubd-2.c @@ -0,0 +1,42 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_sub_pi32 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2; + __m64_union e; + int i; + + s1.as_m64 = _mm_setr_pi32 (30, 90); + s2.as_m64 = _mm_setr_pi32 (76, -100); + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 2; i++) + e.as_int[i] = s1.as_int[i] - s2.as_int[i]; + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-psubsb-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-psubsb-1.c new file mode 100644 index 00000000000..3f0fb2af899 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-psubsb-1.c @@ -0,0 +1,51 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_subs_pi8 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2; + __m64_union e; + int i, tmp; + + s1.as_m64 = _mm_set_pi8 (1, 2, 3, 4, 10, 20, 30, 90); + s2.as_m64 = _mm_set_pi8 (88, 44, 3, 22, 11, 98, 76, -100); + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 8; i++) + { + tmp = s1.as_signed_char[i] - s2.as_signed_char[i]; + + if (tmp > 127) + tmp = 127; + if (tmp < -128) + tmp = -128; + + e.as_signed_char[i] = tmp; + } + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-psubsw-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-psubsw-1.c new file mode 100644 index 00000000000..ae819e19c25 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-psubsw-1.c @@ -0,0 +1,51 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_subs_pi16 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2; + __m64_union e; + int i, tmp; + + s1.as_m64 = _mm_set_pi16 (10, 20, 30, 00); + s2.as_m64 = _mm_set_pi16 (11, 98, 76, -100); + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 4; i++) + { + tmp = s1.as_short[i] - s2.as_short[i]; + + if (tmp > 32767) + tmp = 32767; + if (tmp < -32768) + tmp = -32768; + + e.as_short[i] = tmp; + } + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-psubusb-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-psubusb-1.c new file mode 100644 index 00000000000..bbdc0977109 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-psubusb-1.c @@ -0,0 +1,51 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_subs_pu8 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2; + __m64_union e; + int i, tmp; + + s1.as_m64 = _mm_set_pi8 (30, 2, 3, 4, 10, 20, 30, 90); + s2.as_m64 = _mm_set_pi8 (88, 44, 3, 22, 11, 98, 76, 100); + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 8; i++) + { + tmp = s1.as_char[i] - s2.as_char[i]; + + if (tmp > 255) + tmp = -1; + if (tmp < 0) + tmp = 0; + + e.as_char[i] = tmp; + } + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-psubusw-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-psubusw-1.c new file mode 100644 index 00000000000..e26c380daee --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-psubusw-1.c @@ -0,0 +1,52 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_subs_pu16 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2; + __m64_union e; + int i, tmp; + + s1.as_m64 = _mm_set_pi16 (10, 20, 30, 40); + s2.as_m64 = _mm_set_pi16 (11, 98, 76, 100); + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 4; i++) + { + tmp = (unsigned short)s1.as_short[i] - (unsigned short)s2.as_short[i]; + + if (tmp > 65535) + tmp = -1; + + if (tmp < 0) + tmp = 0; + + e.as_short[i] = tmp; + } + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-psubw-2.c b/gcc/testsuite/gcc.target/powerpc/mmx-psubw-2.c new file mode 100644 index 00000000000..39e4cdea04a --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-psubw-2.c @@ -0,0 +1,42 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_sub_pi16 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2; + __m64_union e; + int i; + + s1.as_m64 = _mm_set_pi16 (10, 20, 30, 90); + s2.as_m64 = _mm_set_pi16 (11, 98, 76, -100); + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 4; i++) + e.as_short[i] = s1.as_short[i] - s2.as_short[i]; + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-punpckhbw-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-punpckhbw-1.c new file mode 100644 index 00000000000..dba56ca205b --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-punpckhbw-1.c @@ -0,0 +1,44 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_unpackhi_pi8 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2, e; + int i; + + s1.as_m64 = 0x0706050403020100UL; + s2.as_m64 = 0x1716151413121110UL; + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 4; i++) + { + e.as_char[2*i] = s1.as_char[4+i]; + e.as_char[2*i + 1] = s2.as_char[4+i]; + } + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-punpckhdq-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-punpckhdq-1.c new file mode 100644 index 00000000000..f2f53c434c5 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-punpckhdq-1.c @@ -0,0 +1,40 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_unpackhi_pi32 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2, e; + + s1.as_m64 = 0x0706050403020100UL; + s2.as_m64 = 0x1716151413121110UL; + u.as_m64 = test (s1.as_m64, s2.as_m64); + + e.as_int[0] = s1.as_int[1]; + e.as_int[1] = s2.as_int[1]; + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-punpckhwd-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-punpckhwd-1.c new file mode 100644 index 00000000000..f0264463a81 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-punpckhwd-1.c @@ -0,0 +1,44 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_unpackhi_pi16 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2, e; + int i; + + s1.as_m64 = 0x0706050403020100UL; + s2.as_m64 = 0x1716151413121110UL; + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 2; i++) + { + e.as_short[2*i] = s1.as_short[2+i]; + e.as_short[2*i + 1] = s2.as_short[2+i]; + } + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-punpcklbw-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-punpcklbw-1.c new file mode 100644 index 00000000000..36cf241ab19 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-punpcklbw-1.c @@ -0,0 +1,44 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_unpacklo_pi8 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2, e; + int i; + + s1.as_m64 = 0x0706050403020100UL; + s2.as_m64 = 0x1716151413121110UL; + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 4; i++) + { + e.as_char[2*i] = s1.as_char[i]; + e.as_char[2*i + 1] = s2.as_char[i]; + } + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-punpckldq-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-punpckldq-1.c new file mode 100644 index 00000000000..8fb0251560a --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-punpckldq-1.c @@ -0,0 +1,40 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_unpacklo_pi32 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2, e; + + s1.as_m64 = 0x0706050403020100UL; + s2.as_m64 = 0x1716151413121110UL; + u.as_m64 = test (s1.as_m64, s2.as_m64); + + e.as_int[0] = s1.as_int[0]; + e.as_int[1] = s2.as_int[0]; + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-punpcklwd-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-punpcklwd-1.c new file mode 100644 index 00000000000..37b6b6ff8c6 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-punpcklwd-1.c @@ -0,0 +1,44 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_unpacklo_pi16 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2, e; + int i; + + s1.as_m64 = 0x0706050403020100UL; + s2.as_m64 = 0x1716151413121110UL; + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 2; i++) + { + e.as_short[2*i] = s1.as_short[i]; + e.as_short[2*i + 1] = s2.as_short[i]; + } + + if (u.as_m64 != e.as_m64) + abort (); +} -- 2.30.2