1 /* { dg-do run } */ 2 /* { dg-require-effective-target avx } */ 3 /* { dg-options "-O3 -ffast-math -fschedule-insns -mavx -mvzeroupper" } */ 4 5 #include "avx-check.h" 6 7 #define N 100 8 9 double 10 __attribute__((noinline)) foo(int size,double * y,double * x)11foo (int size, double *y, double *x) 12 { 13 double sum = 0.0; 14 int i; 15 16 for (i = 0; i < size; i++) 17 sum += y[i] * x[i]; 18 19 return sum; 20 } 21 22 static void 23 __attribute__ ((noinline)) avx_test()24avx_test () 25 { 26 double x[N], y[N]; 27 double s; 28 int i; 29 30 for (i = 0; i < N; i++) 31 { 32 x[i] = i; 33 y[i] = i; 34 } 35 36 s = foo (N, y, x); 37 38 if (s != 328350.0) 39 abort (); 40 } 41