1/* { dg-require-effective-target vect_int } */
2
3#include <stdarg.h>
4#include "../../tree-vect.h"
5
6struct mystr {
7  int f1;
8  int f2;
9};
10
11struct mystr af[16] = {
12  10, 11, 12, 13, 14, 15, 16, 17,
13  20, 21, 22, 23, 24, 25, 26, 27,
14  30, 31, 32, 33, 34, 35, 36, 37,
15  40, 41, 42, 43, 44, 45, 46, 47
16};
17
18struct mystr bf[16] = {
19  12, 13, 14, 15, 16, 17, 18, 19,
20  22, 23, 24, 25, 26, 27, 28, 29,
21  32, 33, 34, 35, 36, 37, 38, 39,
22  42, 43, 44, 45, 46, 47, 48, 49
23};
24
25struct mystr cf[16];
26
27int res1[16] = {
28  22, 26, 30, 34, 42, 46, 50, 54,
29  62, 66, 70, 74, 82, 86, 90, 94,
30};
31
32int res2[16] = {
33  24, 28, 32, 36, 44, 48, 52, 56,
34  64, 68, 72, 76, 84, 88, 92, 96,
35};
36
37__attribute__ ((noinline)) void
38foo (void)
39{
40  int i;
41
42  for (i = 0; i < 16; i++)
43  {
44    cf[i].f1 = af[i].f1 + bf[i].f1;
45    cf[i].f2 = af[i].f2 + bf[i].f2;
46  }
47}
48
49
50
51int
52main (void)
53{
54  int i;
55
56  check_vect ();
57  foo ();
58
59  /* Check resiults. */
60  for (i = 0; i < 16; i++)
61    {
62      if (cf[i].f1 != res1[i])
63	abort ();
64      if (cf[i].f2 != res2[i])
65        abort ();
66
67    }
68  return 0;
69}
70
71/* { dg-final { scan-tree-dump-times "vectorization not profitable" 0 "vect" } } */
72/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
73/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect"  } } */
74/* { dg-final { cleanup-tree-dump "vect" } } */
75