OSDN Git Service

PR tree-optimization/35982
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / vect / slp-37.c
1 /* { dg-require-effective-target vect_int } */
2
3 #include <stdarg.h>
4 #include <stdlib.h>
5 #include "tree-vect.h"
6
7 #define N 128 
8
9 typedef struct {
10    int a;
11    int b;
12    void *c;
13 } s1;
14
15 int
16 foo1 (s1 *arr)
17 {
18   int i;
19   s1 *ptr = arr;
20
21   /* Different constant types - not SLPable.  The group size is not power of 2,
22      interleaving is not supported either.  */
23   for (i = 0; i < N; i++)
24     {
25       ptr->a = 6;
26       ptr->b = 7;
27       ptr->c = NULL;
28       ptr++; 
29     } 
30    
31   /* check results:  */
32   for (i = 0; i < N; i++)
33     { 
34        if (arr[i].a != 6 
35            || arr[i].b != 7
36            || arr[i].c != NULL)
37          abort();
38     }
39 }
40
41 int main (void)
42 {
43   int i;
44   s1 arr1[N];
45   
46   check_vect ();
47
48   for (i = 0; i < N; i++)
49     { 
50       arr1[i].a = i;
51       arr1[i].b = i * 2;
52       arr1[i].c = (void *)arr1;
53
54       if (arr1[i].a == 178)
55          abort(); 
56     } 
57
58
59   foo1 (arr1);
60
61   return 0;
62 }
63
64 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect"  } } */
65 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect"  } } */
66 /* { dg-final { cleanup-tree-dump "vect" } } */
67