This it part 2/2 for contributing PPC64LE support for X86 MMX
instrisics. This patch adds the DG tests to verify the headers contents.
Oddly there are very few MMX specific included in i386 so I had to adapt
some the SSE tested to smaller vector size.

[gcc/testsuite]

2017-07-18  Steven Munroe  <munro...@gcc.gnu.org>

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

Index: gcc/testsuite/gcc.target/powerpc/mmx-check.h
===================================================================
--- gcc/testsuite/gcc.target/powerpc/mmx-check.h        (nonexistent)
+++ gcc/testsuite/gcc.target/powerpc/mmx-check.h        (working copy)
@@ -0,0 +1,35 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+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;
+  }
Index: gcc/testsuite/gcc.target/powerpc/mmx-packs.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/mmx-packs.c        (nonexistent)
+++ gcc/testsuite/gcc.target/powerpc/mmx-packs.c        (working copy)
@@ -0,0 +1,91 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -mpower8-vector" } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-require-effective-target p8vector_hw { target powerpc*-*-* } }
*/
+
+#define NO_WARN_X86_INTRINSICS 1
+#include <mmintrin.h>
+#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]);
+    }
+}
+
Index: gcc/testsuite/gcc.target/powerpc/mmx-packssdw-1.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/mmx-packssdw-1.c   (nonexistent)
+++ gcc/testsuite/gcc.target/powerpc/mmx-packssdw-1.c   (working copy)
@@ -0,0 +1,60 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -mpower8-vector" } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-require-effective-target p8vector_hw { target powerpc*-*-* } }
*/
+
+#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 <mmintrin.h>
+
+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 ();
+}
Index: gcc/testsuite/gcc.target/powerpc/mmx-packsswb-1.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/mmx-packsswb-1.c   (nonexistent)
+++ gcc/testsuite/gcc.target/powerpc/mmx-packsswb-1.c   (working copy)
@@ -0,0 +1,60 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -mpower8-vector" } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-require-effective-target p8vector_hw { target powerpc*-*-* } }
*/
+
+#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 <mmintrin.h>
+
+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 ();
+}
Index: gcc/testsuite/gcc.target/powerpc/mmx-packuswb-1.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/mmx-packuswb-1.c   (nonexistent)
+++ gcc/testsuite/gcc.target/powerpc/mmx-packuswb-1.c   (working copy)
@@ -0,0 +1,50 @@
+/* { dg-do run } */
+/* { dg-options "-O3" } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-require-effective-target p8vector_hw { powerpc*-*-* } } */
+
+#ifndef CHECK_H
+#define CHECK_H "mmx-check.h"
+#endif
+
+#ifndef TEST
+#define TEST mmx_test
+#endif
+
+#include CHECK_H
+
+#include <mmintrin.h>
+
+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 ();
+}
Index: gcc/testsuite/gcc.target/powerpc/mmx-paddb-1.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/mmx-paddb-1.c      (nonexistent)
+++ gcc/testsuite/gcc.target/powerpc/mmx-paddb-1.c      (working copy)
@@ -0,0 +1,42 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -mpower8-vector" } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-require-effective-target p8vector_hw { target powerpc*-*-* } }
*/
+
+#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 <mmintrin.h>
+
+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 ();
+}
Index: gcc/testsuite/gcc.target/powerpc/mmx-paddd-1.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/mmx-paddd-1.c      (nonexistent)
+++ gcc/testsuite/gcc.target/powerpc/mmx-paddd-1.c      (working copy)
@@ -0,0 +1,42 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -mpower8-vector" } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-require-effective-target p8vector_hw { target powerpc*-*-* } }
*/
+
+#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 <mmintrin.h>
+
+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 ();
+}
Index: gcc/testsuite/gcc.target/powerpc/mmx-paddsb-1.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/mmx-paddsb-1.c     (nonexistent)
+++ gcc/testsuite/gcc.target/powerpc/mmx-paddsb-1.c     (working copy)
@@ -0,0 +1,51 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -mpower8-vector" } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-require-effective-target p8vector_hw { target powerpc*-*-* } }
*/
+
+#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 <mmintrin.h>
+
+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 ();
+}
Index: gcc/testsuite/gcc.target/powerpc/mmx-paddsw-1.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/mmx-paddsw-1.c     (nonexistent)
+++ gcc/testsuite/gcc.target/powerpc/mmx-paddsw-1.c     (working copy)
@@ -0,0 +1,51 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -mpower8-vector" } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-require-effective-target p8vector_hw { target powerpc*-*-* } }
*/
+
+#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 <mmintrin.h>
+
+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 ();
+}
Index: gcc/testsuite/gcc.target/powerpc/mmx-paddusb-1.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/mmx-paddusb-1.c    (nonexistent)
+++ gcc/testsuite/gcc.target/powerpc/mmx-paddusb-1.c    (working copy)
@@ -0,0 +1,51 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -mpower8-vector" } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-require-effective-target p8vector_hw { target powerpc*-*-* } }
*/
+
+#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 <mmintrin.h>
+
+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 ();
+}
Index: gcc/testsuite/gcc.target/powerpc/mmx-paddusw-1.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/mmx-paddusw-1.c    (nonexistent)
+++ gcc/testsuite/gcc.target/powerpc/mmx-paddusw-1.c    (working copy)
@@ -0,0 +1,52 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -mpower8-vector" } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-require-effective-target p8vector_hw { target powerpc*-*-* } }
*/
+
+#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 <mmintrin.h>
+
+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 ();
+}
Index: gcc/testsuite/gcc.target/powerpc/mmx-paddw-1.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/mmx-paddw-1.c      (nonexistent)
+++ gcc/testsuite/gcc.target/powerpc/mmx-paddw-1.c      (working copy)
@@ -0,0 +1,42 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -mpower8-vector" } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-require-effective-target p8vector_hw { target powerpc*-*-* } }
*/
+
+#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 <mmintrin.h>
+
+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 ();
+}
Index: gcc/testsuite/gcc.target/powerpc/mmx-pcmpeqb-1.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/mmx-pcmpeqb-1.c    (nonexistent)
+++ gcc/testsuite/gcc.target/powerpc/mmx-pcmpeqb-1.c    (working copy)
@@ -0,0 +1,42 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -mpower8-vector" } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-require-effective-target p8vector_hw { target powerpc*-*-* } }
*/
+
+#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 <mmintrin.h>
+
+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 ();
+}
Index: gcc/testsuite/gcc.target/powerpc/mmx-pcmpeqd-1.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/mmx-pcmpeqd-1.c    (nonexistent)
+++ gcc/testsuite/gcc.target/powerpc/mmx-pcmpeqd-1.c    (working copy)
@@ -0,0 +1,42 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -mpower8-vector" } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-require-effective-target p8vector_hw { target powerpc*-*-* } }
*/
+
+#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 <mmintrin.h>
+
+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 ();
+}
Index: gcc/testsuite/gcc.target/powerpc/mmx-pcmpeqw-1.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/mmx-pcmpeqw-1.c    (nonexistent)
+++ gcc/testsuite/gcc.target/powerpc/mmx-pcmpeqw-1.c    (working copy)
@@ -0,0 +1,42 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -mpower8-vector" } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-require-effective-target p8vector_hw { target powerpc*-*-* } }
*/
+
+#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 <mmintrin.h>
+
+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 ();
+}
Index: gcc/testsuite/gcc.target/powerpc/mmx-pcmpgtb-1.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/mmx-pcmpgtb-1.c    (nonexistent)
+++ gcc/testsuite/gcc.target/powerpc/mmx-pcmpgtb-1.c    (working copy)
@@ -0,0 +1,42 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -mpower8-vector" } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-require-effective-target p8vector_hw { target powerpc*-*-* } }
*/
+
+#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 <mmintrin.h>
+
+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 ();
+}
Index: gcc/testsuite/gcc.target/powerpc/mmx-pcmpgtd-1.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/mmx-pcmpgtd-1.c    (nonexistent)
+++ gcc/testsuite/gcc.target/powerpc/mmx-pcmpgtd-1.c    (working copy)
@@ -0,0 +1,42 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -mpower8-vector" } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-require-effective-target p8vector_hw { target powerpc*-*-* } }
*/
+
+#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 <mmintrin.h>
+
+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 ();
+}
Index: gcc/testsuite/gcc.target/powerpc/mmx-pcmpgtw-1.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/mmx-pcmpgtw-1.c    (nonexistent)
+++ gcc/testsuite/gcc.target/powerpc/mmx-pcmpgtw-1.c    (working copy)
@@ -0,0 +1,42 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -mpower8-vector" } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-require-effective-target p8vector_hw { target powerpc*-*-* } }
*/
+
+#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 <mmintrin.h>
+
+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 ();
+}
Index: gcc/testsuite/gcc.target/powerpc/mmx-pmaddwd-1.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/mmx-pmaddwd-1.c    (nonexistent)
+++ gcc/testsuite/gcc.target/powerpc/mmx-pmaddwd-1.c    (working copy)
@@ -0,0 +1,43 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -mpower8-vector" } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-require-effective-target p8vector_hw { target powerpc*-*-* } }
*/
+
+#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 <mmintrin.h>
+
+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 ();
+}
Index: gcc/testsuite/gcc.target/powerpc/mmx-pmulhw-1.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/mmx-pmulhw-1.c     (nonexistent)
+++ gcc/testsuite/gcc.target/powerpc/mmx-pmulhw-1.c     (working copy)
@@ -0,0 +1,46 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -mpower8-vector" } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-require-effective-target p8vector_hw { target powerpc*-*-* } }
*/
+
+#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 <mmintrin.h>
+
+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 ();
+}
Index: gcc/testsuite/gcc.target/powerpc/mmx-pmullw-1.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/mmx-pmullw-1.c     (nonexistent)
+++ gcc/testsuite/gcc.target/powerpc/mmx-pmullw-1.c     (working copy)
@@ -0,0 +1,46 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -mpower8-vector" } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-require-effective-target p8vector_hw { target powerpc*-*-* } }
*/
+
+#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 <mmintrin.h>
+
+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 ();
+}
Index: gcc/testsuite/gcc.target/powerpc/mmx-pslld-1.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/mmx-pslld-1.c      (nonexistent)
+++ gcc/testsuite/gcc.target/powerpc/mmx-pslld-1.c      (working copy)
@@ -0,0 +1,45 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -mpower8-vector" } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-require-effective-target p8vector_hw { target powerpc*-*-* } }
*/
+
+#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 <mmintrin.h>
+
+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 ();
+}
Index: gcc/testsuite/gcc.target/powerpc/mmx-psllw-1.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/mmx-psllw-1.c      (nonexistent)
+++ gcc/testsuite/gcc.target/powerpc/mmx-psllw-1.c      (working copy)
@@ -0,0 +1,45 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -mpower8-vector" } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-require-effective-target p8vector_hw { target powerpc*-*-* } }
*/
+
+#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 <mmintrin.h>
+
+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 ();
+}
Index: gcc/testsuite/gcc.target/powerpc/mmx-psrad-1.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/mmx-psrad-1.c      (nonexistent)
+++ gcc/testsuite/gcc.target/powerpc/mmx-psrad-1.c      (working copy)
@@ -0,0 +1,44 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -mpower8-vector" } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-require-effective-target p8vector_hw { target powerpc*-*-* } }
*/
+
+#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 <mmintrin.h>
+
+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 ();
+}
Index: gcc/testsuite/gcc.target/powerpc/mmx-psraw-1.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/mmx-psraw-1.c      (nonexistent)
+++ gcc/testsuite/gcc.target/powerpc/mmx-psraw-1.c      (working copy)
@@ -0,0 +1,44 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -mpower8-vector" } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-require-effective-target p8vector_hw { target powerpc*-*-* } }
*/
+
+#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 <mmintrin.h>
+
+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 ();
+}
Index: gcc/testsuite/gcc.target/powerpc/mmx-psrld-1.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/mmx-psrld-1.c      (nonexistent)
+++ gcc/testsuite/gcc.target/powerpc/mmx-psrld-1.c      (working copy)
@@ -0,0 +1,44 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -mpower8-vector" } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-require-effective-target p8vector_hw { target powerpc*-*-* } }
*/
+
+#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 <mmintrin.h>
+
+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 ();
+}
Index: gcc/testsuite/gcc.target/powerpc/mmx-psrlw-1.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/mmx-psrlw-1.c      (nonexistent)
+++ gcc/testsuite/gcc.target/powerpc/mmx-psrlw-1.c      (working copy)
@@ -0,0 +1,44 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -mpower8-vector" } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-require-effective-target p8vector_hw { target powerpc*-*-* } }
*/
+
+#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 <mmintrin.h>
+
+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 ();
+}
Index: gcc/testsuite/gcc.target/powerpc/mmx-psubb-2.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/mmx-psubb-2.c      (nonexistent)
+++ gcc/testsuite/gcc.target/powerpc/mmx-psubb-2.c      (working copy)
@@ -0,0 +1,42 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -mpower8-vector" } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-require-effective-target p8vector_hw { target powerpc*-*-* } }
*/
+
+#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 <mmintrin.h>
+
+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 ();
+}
Index: gcc/testsuite/gcc.target/powerpc/mmx-psubd-2.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/mmx-psubd-2.c      (nonexistent)
+++ gcc/testsuite/gcc.target/powerpc/mmx-psubd-2.c      (working copy)
@@ -0,0 +1,42 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -mpower8-vector" } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-require-effective-target p8vector_hw { target powerpc*-*-* } }
*/
+
+#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 <mmintrin.h>
+
+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 ();
+}
Index: gcc/testsuite/gcc.target/powerpc/mmx-psubsb-1.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/mmx-psubsb-1.c     (nonexistent)
+++ gcc/testsuite/gcc.target/powerpc/mmx-psubsb-1.c     (working copy)
@@ -0,0 +1,51 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -mpower8-vector" } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-require-effective-target p8vector_hw { target powerpc*-*-* } }
*/
+
+#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 <mmintrin.h>
+
+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 ();
+}
Index: gcc/testsuite/gcc.target/powerpc/mmx-psubsw-1.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/mmx-psubsw-1.c     (nonexistent)
+++ gcc/testsuite/gcc.target/powerpc/mmx-psubsw-1.c     (working copy)
@@ -0,0 +1,51 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -mpower8-vector" } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-require-effective-target p8vector_hw { target powerpc*-*-* } }
*/
+
+#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 <mmintrin.h>
+
+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 ();
+}
Index: gcc/testsuite/gcc.target/powerpc/mmx-psubusb-1.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/mmx-psubusb-1.c    (nonexistent)
+++ gcc/testsuite/gcc.target/powerpc/mmx-psubusb-1.c    (working copy)
@@ -0,0 +1,51 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -mpower8-vector" } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-require-effective-target p8vector_hw { target powerpc*-*-* } }
*/
+
+#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 <mmintrin.h>
+
+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 ();
+}
Index: gcc/testsuite/gcc.target/powerpc/mmx-psubusw-1.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/mmx-psubusw-1.c    (nonexistent)
+++ gcc/testsuite/gcc.target/powerpc/mmx-psubusw-1.c    (working copy)
@@ -0,0 +1,52 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -mpower8-vector" } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-require-effective-target p8vector_hw { target powerpc*-*-* } }
*/
+
+#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 <mmintrin.h>
+
+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 ();
+}
Index: gcc/testsuite/gcc.target/powerpc/mmx-psubw-2.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/mmx-psubw-2.c      (nonexistent)
+++ gcc/testsuite/gcc.target/powerpc/mmx-psubw-2.c      (working copy)
@@ -0,0 +1,42 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -mpower8-vector" } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-require-effective-target p8vector_hw { target powerpc*-*-* } }
*/
+
+#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 <mmintrin.h>
+
+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 ();
+}
Index: gcc/testsuite/gcc.target/powerpc/mmx-punpckhbw-1.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/mmx-punpckhbw-1.c  (nonexistent)
+++ gcc/testsuite/gcc.target/powerpc/mmx-punpckhbw-1.c  (working copy)
@@ -0,0 +1,44 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -mpower8-vector" } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-require-effective-target p8vector_hw { target powerpc*-*-* } }
*/
+
+#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 <mmintrin.h>
+
+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 ();
+}
Index: gcc/testsuite/gcc.target/powerpc/mmx-punpckhdq-1.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/mmx-punpckhdq-1.c  (nonexistent)
+++ gcc/testsuite/gcc.target/powerpc/mmx-punpckhdq-1.c  (working copy)
@@ -0,0 +1,40 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -mpower8-vector" } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-require-effective-target p8vector_hw { target powerpc*-*-* } }
*/
+
+#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 <mmintrin.h>
+
+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 ();
+}
Index: gcc/testsuite/gcc.target/powerpc/mmx-punpckhwd-1.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/mmx-punpckhwd-1.c  (nonexistent)
+++ gcc/testsuite/gcc.target/powerpc/mmx-punpckhwd-1.c  (working copy)
@@ -0,0 +1,44 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -mpower8-vector" } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-require-effective-target p8vector_hw { target powerpc*-*-* } }
*/
+
+#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 <mmintrin.h>
+
+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 ();
+}
Index: gcc/testsuite/gcc.target/powerpc/mmx-punpcklbw-1.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/mmx-punpcklbw-1.c  (nonexistent)
+++ gcc/testsuite/gcc.target/powerpc/mmx-punpcklbw-1.c  (working copy)
@@ -0,0 +1,44 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -mpower8-vector" } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-require-effective-target p8vector_hw { target powerpc*-*-* } }
*/
+
+#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 <mmintrin.h>
+
+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 ();
+}
Index: gcc/testsuite/gcc.target/powerpc/mmx-punpckldq-1.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/mmx-punpckldq-1.c  (nonexistent)
+++ gcc/testsuite/gcc.target/powerpc/mmx-punpckldq-1.c  (working copy)
@@ -0,0 +1,40 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -mpower8-vector" } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-require-effective-target p8vector_hw { target powerpc*-*-* } }
*/
+
+#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 <mmintrin.h>
+
+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 ();
+}
Index: gcc/testsuite/gcc.target/powerpc/mmx-punpcklwd-1.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/mmx-punpcklwd-1.c  (nonexistent)
+++ gcc/testsuite/gcc.target/powerpc/mmx-punpcklwd-1.c  (working copy)
@@ -0,0 +1,44 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -mpower8-vector" } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-require-effective-target p8vector_hw { target powerpc*-*-* } }
*/
+
+#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 <mmintrin.h>
+
+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 ();
+}


Reply via email to