| 1 |
/* { dg-require-effective-target vect_int } */ |
| 2 |
/* { dg-additional-options "-fdump-tree-optimized-details-blocks" } */ |
| 3 |
|
| 4 |
#include <stdarg.h> |
| 5 |
#include "tree-vect.h" |
| 6 |
|
| 7 |
#define N 5 |
| 8 |
|
| 9 |
static int a[N][N] = {{ 1, 2, 3, 4, 5}, |
| 10 |
{ 6, 7, 8, 9,10}, |
| 11 |
{11,12,13,14,15}, |
| 12 |
{16,17,18,19,20}, |
| 13 |
{21,22,23,24,25}}; |
| 14 |
|
| 15 |
static int c[N][N] = {{ 1, 2, 3, 4, 5}, |
| 16 |
{ 7, 9,11, 13,15}, |
| 17 |
{18,21,24,27,30}, |
| 18 |
{34,38,42,46,50}, |
| 19 |
{55,60,65,70,75}}; |
| 20 |
|
| 21 |
__attribute__ ((noinline)) |
| 22 |
int main1 (int A[N][N], int n) |
| 23 |
{ |
| 24 |
|
| 25 |
int i,j; |
| 26 |
|
| 27 |
/* vectorizable */ |
| 28 |
for (i = 1; i < N; i++) |
| 29 |
{ |
| 30 |
for (j = 0; j < n; j++) |
| 31 |
{ |
| 32 |
A[i][j] = A[i-1][j] + A[i][j]; |
| 33 |
} |
| 34 |
} |
| 35 |
|
| 36 |
return 0; |
| 37 |
} |
| 38 |
|
| 39 |
int main (void) |
| 40 |
{ |
| 41 |
int i,j; |
| 42 |
|
| 43 |
check_vect (); |
| 44 |
|
| 45 |
main1 (a, N); |
| 46 |
|
| 47 |
/* check results: */ |
| 48 |
|
| 49 |
for (i = 0; i < N; i++) |
| 50 |
{ |
| 51 |
#pragma GCC novector |
| 52 |
for (j = 0; j < N; j++) |
| 53 |
{ |
| 54 |
if (a[i][j] != c[i][j]) |
| 55 |
abort(); |
| 56 |
} |
| 57 |
} |
| 58 |
return 0; |
| 59 |
} |
| 60 |
|
| 61 |
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ |
| 62 |
/* { dg-final { scan-tree-dump-times "possible dependence between data-refs" 0 "vect" } } */ |
| 63 |
|
| 64 |
/* { dg-final { scan-tree-dump-not "Invalid sum" "optimized" { target { lp64 } } } } */ |