| 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 |
int a; |
| 10 |
int b; |
| 11 |
void *c; |
| 12 |
} s1; |
| 13 |
|
| 14 |
int |
| 15 |
foo1 (s1 *arr) |
| 16 |
{ |
| 17 |
int i; |
| 18 |
s1 *ptr = arr; |
| 19 |
|
| 20 |
/* Vectorized as a strided SLP pair of accesses to <a, b> and a single |
| 21 |
strided access to c. */ |
| 22 |
for (i = 0; i < N; i++) |
| 23 |
{ |
| 24 |
ptr->a = 6; |
| 25 |
ptr->b = 7; |
| 26 |
ptr->c = 0; |
| 27 |
ptr++; |
| 28 |
} |
| 29 |
|
| 30 |
/* check results: */ |
| 31 |
#pragma GCC novector |
| 32 |
for (i = 0; i < N; i++) |
| 33 |
{ |
| 34 |
if (arr[i].a != 6 |
| 35 |
|| arr[i].b != 7 |
| 36 |
|| arr[i].c != 0) |
| 37 |
abort(); |
| 38 |
} |
| 39 |
} |
| 40 |
|
| 41 |
int main (void) |
| 42 |
{ |
| 43 |
int i; |
| 44 |
s1 arr1[N]; |
| 45 |
|
| 46 |
check_vect (); |
| 47 |
|
| 48 |
for (i = 0; i < N; i++) |
| 49 |
{ |
| 50 |
arr1[i].a = i; |
| 51 |
arr1[i].b = i * 2; |
| 52 |
arr1[i].c = (void *)arr1; |
| 53 |
asm volatile ("" ::: "memory"); |
| 54 |
} |
| 55 |
|
| 56 |
|
| 57 |
foo1 (arr1); |
| 58 |
|
| 59 |
return 0; |
| 60 |
} |
| 61 |
|
| 62 |
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_hw_misalign } } } */ |
| 63 |
/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" { target vect_hw_misalign } } } */ |