summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/sse4_1-ptest-3.c
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gcc.target/i386/sse4_1-ptest-3.c
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/gcc.target/i386/sse4_1-ptest-3.c')
-rw-r--r--gcc/testsuite/gcc.target/i386/sse4_1-ptest-3.c85
1 files changed, 85 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-ptest-3.c b/gcc/testsuite/gcc.target/i386/sse4_1-ptest-3.c
new file mode 100644
index 000000000..bf2df320e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/sse4_1-ptest-3.c
@@ -0,0 +1,85 @@
+/* { dg-do run } */
+/* { dg-require-effective-target sse4 } */
+/* { dg-options "-O2 -msse4.1" } */
+
+#ifndef CHECK_H
+#define CHECK_H "sse4_1-check.h"
+#endif
+
+#ifndef TEST
+#define TEST sse4_1_test
+#endif
+
+#include CHECK_H
+
+#include <smmintrin.h>
+
+static void
+TEST (void)
+{
+ union
+ {
+ __m128i x;
+ unsigned int i[4];
+ } val[4];
+ int correct_zeros[4];
+ int correct_ones[4];
+ int correct_mixed[4];
+ int zeros[4];
+ int ones[4];
+ int mixed[4];
+ int i;
+ __m128i v;
+
+ val[0].i[0] = 0x11111111;
+ val[0].i[1] = 0x00000000;
+ val[0].i[2] = 0x00000000;
+ val[0].i[3] = 0x11111111;
+ correct_zeros[0] = 0;
+ correct_ones[0] = 0;
+ correct_mixed[0] = 1;
+
+ val[1].i[0] = 0x00000000;
+ val[1].i[1] = 0x11111111;
+ val[1].i[2] = 0x11111111;
+ val[1].i[3] = 0x00000000;
+ correct_zeros[1] = 0;
+ correct_ones[1] = 0;
+ correct_mixed[1] = 1;
+
+ val[2].i[0] = 0;
+ val[2].i[1] = 0;
+ val[2].i[2] = 0;
+ val[2].i[3] = 0;
+ correct_zeros[2] = 1;
+ correct_ones[2] = 0;
+ correct_mixed[2] = 0;
+
+ val[3].i[0] = 0xffffffff;
+ val[3].i[1] = 0xffffffff;
+ val[3].i[2] = 0xffffffff;
+ val[3].i[3] = 0xffffffff;
+ correct_zeros[3] = 0;
+ correct_ones[3] = 1;
+ correct_mixed[3] = 0;
+
+ for (i=0; i < 4; i++)
+ zeros[i] = _mm_test_all_zeros (val[i].x, val[i].x);
+
+ for( i=0; i < 4; i++ )
+ ones[i] = _mm_test_all_ones (val[i].x);
+
+ v = _mm_cmpeq_epi32 (val[0].x, val[0].x);
+ for( i=0; i < 4; i++ )
+ mixed[i] = _mm_test_mix_ones_zeros (val[i].x, v);
+
+ for( i=0; i < 4; i++ )
+ {
+ if (zeros[i] != correct_zeros[i])
+ abort ();
+ if (ones[i] != correct_ones[i])
+ abort ();
+ if (mixed[i] != correct_mixed[i])
+ abort ();
+ }
+}