aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.target/i386/avx2-vpop-check.h
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gcc.target/i386/avx2-vpop-check.h')
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/i386/avx2-vpop-check.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/i386/avx2-vpop-check.h b/gcc-4.9/gcc/testsuite/gcc.target/i386/avx2-vpop-check.h
new file mode 100644
index 000000000..204b11cb3
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/i386/avx2-vpop-check.h
@@ -0,0 +1,55 @@
+#include "avx2-check.h"
+
+#define SIZE 256
+
+TYPE a[SIZE];
+TYPE b[SIZE];
+TYPE c[SIZE];
+volatile TYPE c_ref[SIZE];
+
+__attribute__ ((__noinline__))
+void
+gen_pop ()
+{
+ int i;
+ for (i = 0; i < SIZE; ++i)
+#ifdef BIN_OP
+ c[i] = BIN_OP (a[i], b[i]);
+#else /* Must be UN_OP */
+ c[i] = UN_OP (a[i]);
+#endif /* BIN_OP */
+}
+
+void
+check_pop ()
+{
+ int i;
+ for (i = 0; i < SIZE; ++i)
+#ifdef BIN_OP
+ c_ref[i] = BIN_OP (a[i], b[i]);
+#else /* Must be UN_OP */
+ c_ref[i] = UN_OP (a[i]);
+#endif /* BIN_OP */
+}
+
+void static
+avx2_test (void)
+{
+ int i, j;
+ for (i = 0; i < 4; ++i )
+ {
+ for ( j = 0; j < SIZE; ++j )
+ {
+ a[i] = i * i + i;
+ b[i] = i * i * i;
+ }
+
+ gen_pop ();
+ check_pop ();
+
+ /* We need to cast away volatility from c_ref here in order to eliminate
+ warning if libc version of memcpy is used here. */
+ if (memcmp (c, (void *) c_ref, SIZE * sizeof (TYPE)))
+ abort();
+ }
+}