Daily bump.
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx512f-i64scatterq512-2.c
blob975973f34f9f0460c9a7a39106089adfb164c608
1 /* { dg-do run } */
2 /* { dg-options "-mavx512f -O2" } */
3 /* { dg-require-effective-target avx512f } */
5 #include "avx512f-check.h"
7 #define SCALE 2
9 static void
10 compute_scatterqq (__mmask8 m8, long long *idx, long long *src,
11 int scale, long long *r)
13 int i;
15 for (i = 0; i < 8; i++)
17 if (m8 & (1 << i))
18 *(long long *) (((unsigned char *) r) + idx[i] * scale) =
19 src[i];
23 static void
24 avx512f_test (void)
26 int i;
27 union512i_q src, idx;
28 long long res[8] = { 0 };
29 long long res_ref[8] = { 0 };
30 __mmask8 m8 = 0xC5;
32 for (i = 0; i < 8; i++)
34 src.a[i] = 1983 * (i + 1) * (i + 2);
36 /* About to gather in reverse order,
37 divide by 2 to demonstrate scale */
38 idx.a[i] = (64 - (i + 1) * 8) >> 1;
41 _mm512_mask_i64scatter_epi64 (res, m8, idx.x, src.x, SCALE);
42 compute_scatterqq (m8, idx.a, src.a, SCALE, res_ref);
44 if (checkVl (res, res_ref, 8))
45 abort ();
47 _mm512_i64scatter_epi64 (res, idx.x, src.x, SCALE);
48 compute_scatterqq (0xFF, idx.a, src.a, SCALE, res_ref);
50 if (checkVl (res, res_ref, 8))
51 abort ();