1/* { dg-do run } */ 2/* { dg-require-effective-target avx512f } */ 3/* { dg-options "-O3 -mavx512f" } */ 4 5#include "avx512f-check.h" 6 7#define N 1024 8int a[N], b[N], c[N], d[N]; 9 10__attribute__((noinline, noclone)) void 11foo (float *__restrict p, float *__restrict q, float *__restrict r, 12 int s1, int s2, int s3) 13{ 14 int i; 15 for (i = 0; i < N; i++) 16 p[i] = q[a[i] * s1 + b[i] * s2 + s3] * r[c[i] * s1 + d[i] * s2 + s3]; 17} 18 19static void 20avx512f_test (void) 21{ 22 int i; 23 float e[N], f[N], g[N]; 24 for (i = 0; i < N; i++) 25 { 26 a[i] = (i * 7) & (N / 8 - 1); 27 b[i] = (i * 13) & (N / 8 - 1); 28 c[i] = (i * 23) & (N / 8 - 1); 29 d[i] = (i * 5) & (N / 8 - 1); 30 e[i] = 16.5 + i; 31 f[i] = 127.5 - i; 32 } 33 foo (g, e, f, 3, 2, 4); 34 for (i = 0; i < N; i++) 35 if (g[i] != (float) ((20.5 + a[i] * 3 + b[i] * 2) 36 * (123.5 - c[i] * 3 - d[i] * 2))) 37 abort (); 38} 39