| 1 |
/* { dg-require-effective-target vect_int } */ |
| 2 |
|
| 3 |
#include <stdarg.h> |
| 4 |
#include "tree-vect.h" |
| 5 |
|
| 6 |
#define N 128 |
| 7 |
|
| 8 |
typedef struct { |
| 9 |
unsigned int a; |
| 10 |
unsigned int b; |
| 11 |
} ii; |
| 12 |
|
| 13 |
__attribute__ ((noinline)) int |
| 14 |
main1 (unsigned short *arr, ii *iarr) |
| 15 |
{ |
| 16 |
unsigned short *ptr = arr; |
| 17 |
ii *iptr = iarr; |
| 18 |
unsigned short res[N]; |
| 19 |
ii ires[N]; |
| 20 |
int i; |
| 21 |
|
| 22 |
for (i = 0; i < N; i++) |
| 23 |
{ |
| 24 |
ires[i].a = iptr->b - iptr->a; |
| 25 |
ires[i].b = iptr->b + iptr->a; |
| 26 |
res[i] = *ptr; |
| 27 |
iptr++; |
| 28 |
ptr++; |
| 29 |
} |
| 30 |
|
| 31 |
/* check results: */ |
| 32 |
#pragma GCC novector |
| 33 |
for (i = 0; i < N; i++) |
| 34 |
{ |
| 35 |
if (res[i] != arr[i] |
| 36 |
|| ires[i].a != iarr[i].b - iarr[i].a |
| 37 |
|| ires[i].b != iarr[i].b + iarr[i].a) |
| 38 |
abort (); |
| 39 |
} |
| 40 |
|
| 41 |
return 0; |
| 42 |
} |
| 43 |
|
| 44 |
int main (void) |
| 45 |
{ |
| 46 |
int i; |
| 47 |
unsigned short arr[N]; |
| 48 |
ii iarr[N]; |
| 49 |
|
| 50 |
check_vect (); |
| 51 |
|
| 52 |
for (i = 0; i < N; i++) |
| 53 |
{ |
| 54 |
arr[i] = i; |
| 55 |
iarr[i].a = i; |
| 56 |
iarr[i].b = i * 3; |
| 57 |
__asm__ volatile (""); |
| 58 |
} |
| 59 |
main1 (arr, iarr); |
| 60 |
|
| 61 |
return 0; |
| 62 |
} |
| 63 |
|
| 64 |
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_strided2 } } } */ |
| 65 |
|