aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/powerpc/mmx-packuswb-1.c
diff options
context:
space:
mode:
authorEdward Smith-Rowland <3dw4rd@verizon.net>2017-08-12 19:09:40 +0000
committerEdward Smith-Rowland <3dw4rd@verizon.net>2017-08-12 19:09:40 +0000
commit40fa8ee5f9da161462fde48776ef6262366f9a13 (patch)
treed3c3bf913950c59ef83b8d9ede50b0978ec0c12f /gcc/testsuite/gcc.target/powerpc/mmx-packuswb-1.c
parent3acaf2e51caf356a9afc763cfd70b91d1ab094b5 (diff)
Merged revisions r232323 through r251067 to the branchtr29124
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/tr29124@251068 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.target/powerpc/mmx-packuswb-1.c')
-rw-r--r--gcc/testsuite/gcc.target/powerpc/mmx-packuswb-1.c50
1 files changed, 50 insertions, 0 deletions
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 <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 ();
+}