summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/avx512f-i64gatherps512-2.c
diff options
context:
space:
mode:
authormrs <mrs@138bc75d-0d04-0410-961f-82ee72b054a4>2014-01-03 23:45:56 +0000
committermrs <mrs@138bc75d-0d04-0410-961f-82ee72b054a4>2014-01-03 23:45:56 +0000
commitfe644b69d013e77c7fc2db2a9863969d4f564561 (patch)
treea2cb1398bd46b8decaea84f1b7de8c7cd35e6046 /gcc/testsuite/gcc.target/i386/avx512f-i64gatherps512-2.c
parent90079d10dd355193fe289fa0bfcb0d7be880d45a (diff)
parent04e0495a6da35f3b0bcedbd75908cb6e9ba8ff8f (diff)
downloadgcc-fe644b69d013e77c7fc2db2a9863969d4f564561.tar.gz
Merge in trunk.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/wide-int@206327 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.target/i386/avx512f-i64gatherps512-2.c')
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-i64gatherps512-2.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-i64gatherps512-2.c b/gcc/testsuite/gcc.target/i386/avx512f-i64gatherps512-2.c
new file mode 100644
index 00000000000..8ed0fcef409
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512f-i64gatherps512-2.c
@@ -0,0 +1,56 @@
+/* { dg-do run } */
+/* { dg-options "-mavx512f -O2" } */
+/* { dg-require-effective-target avx512f } */
+
+#include "avx512f-check.h"
+
+#define SCALE 2
+
+static void
+compute_gatherqps (float *res, __mmask8 m8, long long *idx,
+ float *src, int scale, float *r)
+{
+ int i;
+
+ for (i = 0; i < 8; i++)
+ {
+ if (m8 & (1 << i))
+ r[i] = *(float *) (((unsigned char *) src) + idx[i] * scale);
+ else
+ r[i] = res[i];
+ }
+}
+
+static void
+avx512f_test (void)
+{
+ int i;
+ union256 res;
+ union512i_q idx;
+ float src[8];
+ float res_ref[8];
+ __mmask8 m8 = 0xC5;
+
+ res.x = _mm256_setzero_ps();
+
+ for (i = 0; i < 8; i++)
+ {
+ src[i] = 2.718281828459045 * (i + 1) * (i + 2);
+
+ /* About to gather in reverse order,
+ divide by 2 to demonstrate scale */
+ idx.a[i] = (32 - (i + 1) * 4) >> 1;
+ }
+
+ res.x = _mm512_mask_i64gather_ps (res.x, m8, idx.x, src, SCALE);
+ compute_gatherqps (res.a, m8, idx.a, src, SCALE, res_ref);
+
+ if (check_union256 (res, res_ref))
+ abort ();
+
+ res.x = _mm512_i64gather_ps (idx.x, src, SCALE);
+ compute_gatherqps (res.a, 0xFF, idx.a, src, SCALE, res_ref);
+
+ if (check_union256 (res, res_ref))
+ abort ();
+}