| 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 |
| 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 |
| 53 |
main (void) |
| 54 |
{ |
| 55 |
int i; |
| 56 |
|
| 57 |
check_vect (); |
| 58 |
foo (); |
| 59 |
|
| 60 |
/* Check resiults. */ |
| 61 |
#pragma GCC novector |
| 62 |
for (i = 0; i < 16; i++) |
| 63 |
{ |
| 64 |
if (cf[i].f1 != res1[i]) |
| 65 |
abort (); |
| 66 |
if (cf[i].f2 != res2[i]) |
| 67 |
abort (); |
| 68 |
|
| 69 |
} |
| 70 |
return 0; |
| 71 |
} |
| 72 |
|
| 73 |
/* { dg-final { scan-tree-dump-times "vectorization not profitable" 0 "vect" } } */ |
| 74 |
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ |
| 75 |
/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" } } */ |