| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-require-effective-target int32plus } */ |
| 3 |
/* { dg-additional-options "-ftree-vectorize -fno-vect-cost-model" } */ |
| 4 |
/* { dg-additional-options "-mavx2" { target avx2_runtime } } */ |
| 5 |
|
| 6 |
double getdot(int n, const double *x, int inc_x, const double *y) |
| 7 |
{ |
| 8 |
int i, ix = 0; |
| 9 |
double dot[4] = { 0.0, 0.0, 0.0, 0.0 } ; |
| 10 |
|
| 11 |
for(i = 0; i < n; i++) { |
| 12 |
dot[0] += x[ix] * y[ix] ; |
| 13 |
dot[1] += x[ix+1] * y[ix+1] ; |
| 14 |
dot[2] += x[ix] * y[ix+1] ; |
| 15 |
dot[3] += x[ix+1] * y[ix] ; |
| 16 |
ix += inc_x ; |
| 17 |
} |
| 18 |
|
| 19 |
return dot[0] + dot[1] + dot[2] + dot[3]; |
| 20 |
} |
| 21 |
|
| 22 |
int main() |
| 23 |
{ |
| 24 |
double x[2] = {0, 0}, y[2] = {0, 0}; |
| 25 |
if (getdot(1, x, 4096*4096, y) != 0.) |
| 26 |
__builtin_abort (); |
| 27 |
return 0; |
| 28 |
} |