| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-options "-fno-common" { target { hppa*-*-hpux* } } } */ |
| 3 |
#define vector __attribute__((vector_size(sizeof(int)*4) )) |
| 4 |
|
| 5 |
/* Check to make sure that we extract and insert the vector at the same |
| 6 |
location for vector subscripting and that vectors layout are the same |
| 7 |
as arrays. */ |
| 8 |
|
| 9 |
struct TV4 |
| 10 |
{ |
| 11 |
vector int v; |
| 12 |
}; |
| 13 |
|
| 14 |
typedef struct TV4 MYV4; |
| 15 |
static inline int *f(MYV4 *a, int i) |
| 16 |
{ |
| 17 |
return &(a->v[i]); |
| 18 |
} |
| 19 |
|
| 20 |
static inline MYV4 myfunc2( int x, int y, int z, int w ) |
| 21 |
{ |
| 22 |
MYV4 temp; |
| 23 |
*f(&temp, 0 ) = x; |
| 24 |
*f(&temp, 1 ) = y; |
| 25 |
*f(&temp, 2 ) = z; |
| 26 |
*f(&temp, 3 ) = w; |
| 27 |
return temp; |
| 28 |
} |
| 29 |
|
| 30 |
MYV4 val3; |
| 31 |
|
| 32 |
__attribute__((noinline)) void modify (void) |
| 33 |
{ |
| 34 |
val3 = myfunc2( 1, 2, 3, 4 ); |
| 35 |
} |
| 36 |
|
| 37 |
int main( int argc, char* argv[] ) |
| 38 |
{ |
| 39 |
int a[4]; |
| 40 |
int i; |
| 41 |
|
| 42 |
modify(); |
| 43 |
|
| 44 |
if (*f(&val3, 0 ) != 1) |
| 45 |
__builtin_abort (); |
| 46 |
if (*f(&val3, 1 ) != 2) |
| 47 |
__builtin_abort (); |
| 48 |
if (*f(&val3, 2 ) != 3) |
| 49 |
__builtin_abort (); |
| 50 |
if (*f(&val3, 3 ) != 4) |
| 51 |
__builtin_abort (); |
| 52 |
|
| 53 |
__builtin_memcpy (a, &val3, sizeof(a)); |
| 54 |
for(i = 0; i < 4; i++) |
| 55 |
if (a[i] != i+1) |
| 56 |
__builtin_abort (); |
| 57 |
|
| 58 |
|
| 59 |
return 0; |
| 60 |
} |
| 61 |
|