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