| 1 |
/* Test promotion of __fp16 to double as arguments to variadic function. */ |
| 2 |
|
| 3 |
/* { dg-do run } */ |
| 4 |
/* { dg-options "-mfp16-format=ieee" } */ |
| 5 |
|
| 6 |
#include <stdlib.h> |
| 7 |
#include <stdarg.h> |
| 8 |
|
| 9 |
extern int f (int n, ...); |
| 10 |
|
| 11 |
int |
| 12 |
f (int n, ...) |
| 13 |
{ |
| 14 |
if (n == 2) |
| 15 |
{ |
| 16 |
double xx, yy; |
| 17 |
va_list ap; |
| 18 |
va_start (ap, n); |
| 19 |
xx = va_arg (ap, double); |
| 20 |
yy = va_arg (ap, double); |
| 21 |
va_end (ap); |
| 22 |
if (xx == 42.0 && yy == -42.0) |
| 23 |
return 1; |
| 24 |
} |
| 25 |
return 0; |
| 26 |
} |
| 27 |
|
| 28 |
static __fp16 x = 42.0; |
| 29 |
static __fp16 y = -42.0; |
| 30 |
|
| 31 |
int |
| 32 |
main (void) |
| 33 |
{ |
| 34 |
if (!f (2, x, y)) |
| 35 |
abort (); |
| 36 |
return 0; |
| 37 |
} |