OSDN Git Service

2007-12-06 Zdenek Dvorak <ook@ucw.cz>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / vect / vect-align-2.c
1 /* { dg-require-effective-target vect_int } */
2 /* { dg-do run } */
3
4 #include <stdlib.h>
5 #include <stdarg.h>
6 #include "tree-vect.h"
7
8 /* Compile time unknown misalignment. Cannot use loop peeling to align
9    the store.  */
10
11 #define N 17
12
13 struct foo {
14   char x0;
15   int y[N][N];
16 } __attribute__ ((packed));
17
18 struct foo f2;
19 int z[16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
20
21 __attribute__ ((noinline))
22 void fbar(struct foo *fp)
23 {
24   int i,j;
25    for (i=0; i<N; i++)
26       for (j=0; j<N; j++)
27         f2.y[i][j] = z[i];
28
29    for (i=0; i<N; i++)
30       for (j=0; j<N; j++)
31         if (f2.y[i][j] != z[i])
32           abort ();
33 }
34
35 int main (void)
36 {
37   struct foo  *fp = (struct foo *) malloc (2*sizeof (struct foo));
38
39   fbar(fp);
40   return 0;
41 }
42
43
44 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 0 "vect" } } */
45 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 1 "vect" } } */
46 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
47 /* { dg-final { cleanup-tree-dump "vect" } } */