| 1 |
/* Check calling convention in the vector ABI. */ |
| 2 |
|
| 3 |
/* { dg-do compile { target { s390*-*-* } } } */ |
| 4 |
/* { dg-options "-O3 -mzarch -march=z13" } */ |
| 5 |
|
| 6 |
/* No abi attribute should be emitted when nothing relevant happened. */ |
| 7 |
/* { dg-final { scan-assembler-not "gnu_attribute" } } */ |
| 8 |
|
| 9 |
#include <stdarg.h> |
| 10 |
|
| 11 |
/* Local use is ok. */ |
| 12 |
|
| 13 |
typedef int v4si __attribute__((vector_size(16))); |
| 14 |
|
| 15 |
static |
| 16 |
v4si __attribute__((__noinline__)) |
| 17 |
foo (v4si a) |
| 18 |
{ |
| 19 |
return a + (v4si){ 1, 2, 3, 4 }; |
| 20 |
} |
| 21 |
|
| 22 |
int |
| 23 |
bar (int a) |
| 24 |
{ |
| 25 |
return foo ((v4si){ 1, 1, 1, 1 })[1]; |
| 26 |
} |
| 27 |
|
| 28 |
/* Big vector type only used as function argument and return value |
| 29 |
without being a struct/union member. The alignment change is not |
| 30 |
relevant here. */ |
| 31 |
|
| 32 |
typedef double v4df __attribute__((vector_size(32))); |
| 33 |
|
| 34 |
v4df |
| 35 |
add (v4df a, v4df b, v4df c, v4df d, |
| 36 |
v4df e, v4df f, v4df g, v4df h, v4df i) |
| 37 |
{ |
| 38 |
return a + b + c + d + e + f + g + h + i; |
| 39 |
} |
| 40 |
|
| 41 |
double |
| 42 |
bar2 (int n, ...) |
| 43 |
{ |
| 44 |
double ret; |
| 45 |
v4df a; |
| 46 |
va_list va; |
| 47 |
|
| 48 |
va_start (va, n); |
| 49 |
ret = va_arg (va, v4df)[2]; |
| 50 |
va_end (va); |
| 51 |
|
| 52 |
return ret; |
| 53 |
} |