OSDN Git Service

PR tree-optimization/40542
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / vect / pr21591.c
1 /* { dg-do compile } */
2 /* { dg-require-effective-target vect_int } */
3
4 struct a
5 {
6   int length;
7   int a1[256];
8 };
9
10 struct a *malloc1(__SIZE_TYPE__) __attribute__((malloc));
11 void free(void*);
12
13 void f(void)
14 {
15    struct a *a = malloc1(sizeof(struct a));
16    struct a *b = malloc1(sizeof(struct a));
17    struct a *c = malloc1(sizeof(struct a));
18    int i;
19
20    for (i = 0; i < 256; i++) 
21    {
22       b->a1[i] = i;
23       c->a1[i] = i;
24    }
25    for (i = 0; i < 256; i++) 
26    {
27       a->a1[i] = b->a1[i] + c->a1[i];
28    }
29    free(a);
30    free(b);
31    free(c);
32 }
33
34 /* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */
35 /* { dg-final { cleanup-tree-dump "vect" } } */
36