| 1 |
/* PR middle-end/116891 */ |
| 2 |
/* { dg-do run } */ |
| 3 |
/* { dg-require-effective-target fenv } */ |
| 4 |
/* { dg-require-effective-target hard_float } */ |
| 5 |
/* { dg-require-effective-target c99_runtime } */ |
| 6 |
/* { dg-options "-O2 -frounding-math" } */ |
| 7 |
|
| 8 |
#include <fenv.h> |
| 9 |
|
| 10 |
__attribute__((noipa)) double |
| 11 |
foo (double x, double y, double z) |
| 12 |
{ |
| 13 |
return -__builtin_fma (-x, y, -z); |
| 14 |
} |
| 15 |
|
| 16 |
__attribute__((noipa)) double |
| 17 |
bar (double x, double y, double z) |
| 18 |
{ |
| 19 |
return -__builtin_fma (-x, y, z); |
| 20 |
} |
| 21 |
|
| 22 |
__attribute__((noipa)) double |
| 23 |
baz (double x, double y, double z) |
| 24 |
{ |
| 25 |
return -__builtin_fma (x, y, -z); |
| 26 |
} |
| 27 |
|
| 28 |
__attribute__((noipa)) double |
| 29 |
qux (double x, double y, double z) |
| 30 |
{ |
| 31 |
return -__builtin_fma (x, y, z); |
| 32 |
} |
| 33 |
|
| 34 |
int |
| 35 |
main () |
| 36 |
{ |
| 37 |
#if defined (FE_DOWNWARD) && __DBL_MANT_DIG__ == 53 && __DBL_MAX_EXP__ == 1024 |
| 38 |
fesetround (FE_DOWNWARD); |
| 39 |
double a = foo (-0x1.p256, 0x1.p256, 0x1.p-256); |
| 40 |
if (a != -__builtin_nextafter (0x1p256 * 0x1p256, 0.)) |
| 41 |
__builtin_abort (); |
| 42 |
if (a != bar (-0x1.p256, 0x1.p256, -0x1.p-256) |
| 43 |
|| a != baz (0x1.p256, 0x1.p256, 0x1.p-256) |
| 44 |
|| a != qux (0x1.p256, 0x1.p256, -0x1.p-256)) |
| 45 |
__builtin_abort (); |
| 46 |
#endif |
| 47 |
} |