| 1 |
/* { dg-require-effective-target ppc_float128_hw } */ |
| 2 |
/* { dg-options "-mdejagnu-cpu=power9 -O2 -mlong-double-128 -Wno-psabi -mabi=ieeelongdouble" } */ |
| 3 |
|
| 4 |
/* Test if switching long double to IEEE 128-bit maps the printf and scanf |
| 5 |
function names correctly. We leave off the \M in matching the calls, so |
| 6 |
power10 will match using bl foo@notoc. */ |
| 7 |
|
| 8 |
#include <stdlib.h> |
| 9 |
|
| 10 |
volatile long double x = 1.0L; |
| 11 |
volatile long double y, z; |
| 12 |
|
| 13 |
int |
| 14 |
main (void) |
| 15 |
{ |
| 16 |
char buffer[100]; |
| 17 |
|
| 18 |
/* { dg-final { scan-assembler {\mbl __sprintfieee128} } } */ |
| 19 |
__builtin_sprintf (buffer, "%Lg", x); |
| 20 |
|
| 21 |
/* { dg-final { scan-assembler {\mbl __printfieee128} } } */ |
| 22 |
__builtin_printf ("x is %Lg [%s]\n", x, buffer); |
| 23 |
|
| 24 |
/* { dg-final { scan-assembler {\mbl __isoc99_sscanfieee128} } } */ |
| 25 |
__builtin_sscanf (buffer, "%Lg", &y); |
| 26 |
|
| 27 |
__builtin_printf ("Type 1.0: "); |
| 28 |
|
| 29 |
/* { dg-final { scan-assembler {\mbl __isoc99_scanfieee128} } } */ |
| 30 |
__builtin_scanf ("%Lg", &z); |
| 31 |
|
| 32 |
if (x != y || x != z) |
| 33 |
abort (); |
| 34 |
|
| 35 |
return 0; |
| 36 |
} |