LWG 3035. std::allocator's constructors should be constexpr
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-105-big-array.c
blob433565bfd4d3cea87abe23de29edbe8823054515
1 /* { dg-require-effective-target vect_int } */
3 #include <stdlib.h>
4 #include <stdarg.h>
5 #include "tree-vect.h"
7 #define N 16
9 struct extraction
11 int a[N][N];
12 int b[N][N];
15 static int a[N][N];
16 static int b[N][N];
17 static int c[N][N];
19 __attribute__ ((noinline))
20 int main1 (int x) {
21 int i,j, off;
22 struct extraction *p;
23 p = (struct extraction *) malloc (sizeof (struct extraction));
24 for (i = 0; i < N; i++)
26 for (j = 0; j < N; j++)
28 a[i][j] = (i*7 + j*17)%53;
29 b[i][j] = (i*11+ j*13)%41;
30 asm volatile ("" ::: "memory");
33 for (i = 0; i < N; i++)
35 for (j = 0; j < N; j++)
37 c[i][j] = a[i][j];
38 asm volatile ("" ::: "memory");
41 for (i = 1; i < N; i++)
43 for (j = 0; j < N; j++)
45 off = x + i + j + N+1;
46 if (x + i + j > N*N-1)
47 break;
48 if (off > N*N-1)
49 *(&c[0][0]+x+i+j) = *(&b[0][0] + off - N*N);
50 else
51 *(&c[0][0]+x+i+j) = *(&a[0][0] + off);
52 asm volatile ("" ::: "memory");
56 for (i = 0; i < N; i++)
58 for (j = 0; j < N; j++)
60 p->a[i][j] = a[i][j];
61 p->b[i][j] = b[i][j];
62 asm volatile ("" ::: "memory");
66 /* Vectorizable: distance > number of iterations. */
67 for (i = 1; i < N; i++)
69 for (j = 0; j < N; j++)
71 *((int *)p + x + i + j) = *((int *)p + x + i + j + N+1);
75 /* check results: */
76 for (i = 0; i < N; i++)
78 for (j = 0; j < N; j++)
80 if (p->a[i][j] != c[i][j])
81 abort ();
84 return 0;
87 int main (void)
89 check_vect ();
91 return main1 (N);
94 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
95 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 2 "vect" { target { vect_no_align && { ! vect_hw_misalign } } } } } */
96 /* { dg-final { scan-tree-dump-times "possible dependence between data-refs" 0 "vect" } } */