2015-12-10 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx512f-scatter-3.c
blob37137fd268a3ba5fabae33a32ac528389c1cd410
1 /* { dg-do run } */
2 /* { dg-require-effective-target avx512f } */
3 /* { dg-options "-O3 -mavx512f" } */
5 #define AVX512F
7 #include "avx512f-check.h"
9 #define N 1024
10 int a[N], b[N];
12 __attribute__((noinline, noclone)) void
13 foo (float *__restrict p, float *__restrict q,
14 int s1, int s2, int s3)
16 int i;
17 for (i = 0; i < (N / 8); i++)
18 p[a[i] * s1 + b[i] * s2 + s3] = q[i];
21 static void
22 avx512f_test (void)
24 int i;
25 float c[N], d[N];
26 for (i = 0; i < N; i++)
28 a[i] = (i * 7) & (N / 8 - 1);
29 b[i] = (i * 13) & (N / 8 - 1);
30 c[i] = 179.13 + i;
32 foo (d, c, 3, 2, 4);
33 for (i = 0; i < (N / 8); i++)
34 if (d[a[i] * 3 + b[i] * 2 + 4] != (float) (179.13 + i))
35 abort ();