gcc/testsuite/gcc.dg/vect/pr40074.c
raw| 1 | /* { dg-require-effective-target vect_int } */ |
| 2 | |
| 3 | #include <stdarg.h> |
| 4 | #include "tree-vect.h" |
| 5 | |
| 6 | #define N 16 |
| 7 | |
| 8 | typedef struct { |
| 9 | int a; |
| 10 | int b; |
| 11 | int c; |
| 12 | int d; |
| 13 | } s; |
| 14 | |
| 15 | |
| 16 | s arr[N] = {{7,0,1,5}, {7,2,3,5}, {7,4,5,5}, {7,6,7,5}, {7,8,9,5}, {7,10,11,5}, {7,12,13,5}, {7,14,15,5}, {7,16,17,5}, {7,18,19,5}, {7,20,21,5}, {7,22,23,5}, {7,24,25,5}, {7,26,27,5}, {7,28,29,5}, {7,30,31,5}}; |
| 17 | |
| 18 | __attribute__ ((noinline)) int |
| 19 | main1 () |
| 20 | { |
| 21 | s *p = arr, *q = arr + 1; |
| 22 | int res[N]; |
| 23 | int i; |
| 24 | |
| 25 | for (i = 0; i < N-1; i++) |
| 26 | { |
| 27 | res[i] = p->b + p->d + q->b; |
| 28 | p++; |
| 29 | q++; |
| 30 | } |
| 31 | |
| 32 | /* check results: */ |
| 33 | #pragma GCC novector |
| 34 | for (i = 0; i < N-1; i++) |
| 35 | { |
| 36 | if (res[i] != arr[i].b + arr[i].d + arr[i+1].b) |
| 37 | abort (); |
| 38 | } |
| 39 | |
| 40 | return 0; |
| 41 | } |
| 42 | |
| 43 | int main (void) |
| 44 | { |
| 45 | int i; |
| 46 | |
| 47 | check_vect (); |
| 48 | |
| 49 | main1 (); |
| 50 | |
| 51 | return 0; |
| 52 | } |
| 53 | |
| 54 |