Merged revisions 208012,208018-208019,208021,208023-208030,208033,208037,208040-20804...
[official-gcc.git] / main / gcc / testsuite / gcc.dg / vect / vect-105.c
blobbbf42af897ffa24319972f39e2b94c76d8ae06c3
1 /* { dg-require-effective-target vect_int } */
3 #include <stdlib.h>
4 #include <stdarg.h>
5 #include "tree-vect.h"
7 #define N 4
9 struct extraction
11 int a[N][N];
12 int b[N][N];
15 static int a[N][N] = {{1,2,3,11},{4,5,6,12},{7,8,9,13},{34,45,67,83}};
16 static int b[N][N] = {{17,28,15,23},{0,2,3,24},{4,31,82,25},{29,31,432,256}};
17 static int c[N][N] = {{1,2,3,11},{4,9,13,34},{45,67,83,13},{34,45,67,83}};
19 volatile int y;
21 __attribute__ ((noinline))
22 int main1 (int x) {
23 int i,j;
24 struct extraction *p;
25 p = (struct extraction *) malloc (sizeof (struct extraction));
27 for (i = 0; i < N; i++)
29 for (j = 0; j < N; j++)
31 p->a[i][j] = a[i][j];
32 p->b[i][j] = b[i][j];
33 /* Because Y is volatile, the compiler cannot move this check out
34 of the loop. */
35 if (y)
36 abort (); /* to avoid vectorization */
40 /* Vectorizable: distance > number of iterations. */
41 for (i = 1; i < N; i++)
43 for (j = 0; j < N; j++)
45 *((int *)p + x + i + j) = *((int *)p + x + i + j + 5);
49 /* check results: */
50 for (i = 0; i < N; i++)
52 for (j = 0; j < N; j++)
54 if (p->a[i][j] != c[i][j])
55 abort();
58 return 0;
61 int main (void)
63 check_vect ();
65 return main1 (N);
68 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
69 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 2 "vect" { target vect_no_align } } } */
70 /* { dg-final { scan-tree-dump-times "possible dependence between data-refs" 0 "vect" } } */
71 /* { dg-final { cleanup-tree-dump "vect" } } */