| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O3 -mavx2 -mno-avx512f -fdump-tree-vect-details" } */ |
| 3 |
|
| 4 |
#define N 32 |
| 5 |
int foo (int *a, int n) |
| 6 |
{ |
| 7 |
int sum = 1; |
| 8 |
for (int i = 0; i < 8*N + 4; ++i) |
| 9 |
sum += a[i]; |
| 10 |
return sum; |
| 11 |
} |
| 12 |
|
| 13 |
/* The reduction epilog should be vectorized and the accumulator |
| 14 |
re-used. */ |
| 15 |
/* { dg-final { scan-tree-dump "LOOP EPILOGUE VECTORIZED" "vect" } } */ |
| 16 |
/* { dg-final { scan-assembler-times "psrl" 2 } } */ |
| 17 |
/* { dg-final { scan-assembler-times "padd" 5 } } */ |