diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/float128-cmp-invalid.c | 18 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/float128-div-underflow.c | 18 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/float128-extend-nan.c | 22 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/fp-int-convert-float128-timode-3.c | 23 |
5 files changed, 88 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index cb7b15bfcbb..27a76280e5d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2013-11-06 Joseph Myers <joseph@codesourcery.com> + + * gcc.dg/torture/float128-cmp-invalid.c, + gcc.dg/torture/float128-div-underflow.c, + gcc.dg/torture/float128-extend-nan.c, + gcc.dg/torture/fp-int-convert-float128-timode-3.c: New tests. + 2013-11-06 Oleg Endo <olegendo@gcc.gnu.org> * gcc.target/sh/pr51244-11.c: Remove target line. diff --git a/gcc/testsuite/gcc.dg/torture/float128-cmp-invalid.c b/gcc/testsuite/gcc.dg/torture/float128-cmp-invalid.c new file mode 100644 index 00000000000..53ef7ed01b3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/float128-cmp-invalid.c @@ -0,0 +1,18 @@ +/* Test for "invalid" exceptions from __float128 comparisons. */ +/* { dg-do run { target i?86-*-* x86_64-*-* ia64-*-* } } */ +/* { dg-options "" } */ + +#include <fenv.h> +#include <stdlib.h> + +int +main (void) +{ + volatile __float128 a = __builtin_nan (""), b = 0; + volatile int r = a < b; + if (!fetestexcept (FE_INVALID)) + abort (); + if (r) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.dg/torture/float128-div-underflow.c b/gcc/testsuite/gcc.dg/torture/float128-div-underflow.c new file mode 100644 index 00000000000..43d350f4e44 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/float128-div-underflow.c @@ -0,0 +1,18 @@ +/* Test for spurious underflow from __float128 division. */ +/* { dg-do run { target i?86-*-* x86_64-*-* ia64-*-* } } */ +/* { dg-options "" } */ + +#include <fenv.h> +#include <stdlib.h> + +int +main (void) +{ + volatile __float128 a = 0x0.fffp-16382q, b = 0x0.fffp0q, c; + c = a / b; + if (fetestexcept (FE_UNDERFLOW | FE_INEXACT)) + abort (); + if (c != 0x1p-16382q) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.dg/torture/float128-extend-nan.c b/gcc/testsuite/gcc.dg/torture/float128-extend-nan.c new file mode 100644 index 00000000000..1942d80f190 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/float128-extend-nan.c @@ -0,0 +1,22 @@ +/* Test extensions to __float128 quiet signaling NaNs. */ +/* { dg-do run { target i?86-*-* x86_64-*-* ia64-*-* } } */ +/* { dg-options "-fsignaling-nans" } */ + +#include <fenv.h> +#include <float.h> +#include <stdlib.h> + +volatile long double a = __builtin_nansl (""); + +int +main (void) +{ +#if LDBL_MANT_DIG < 113 + volatile __float128 r = a; + feclearexcept (FE_INVALID); + r += 1; + if (fetestexcept (FE_INVALID)) + abort (); +#endif + exit (0); +} diff --git a/gcc/testsuite/gcc.dg/torture/fp-int-convert-float128-timode-3.c b/gcc/testsuite/gcc.dg/torture/fp-int-convert-float128-timode-3.c new file mode 100644 index 00000000000..944494d9bcc --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/fp-int-convert-float128-timode-3.c @@ -0,0 +1,23 @@ +/* Test for correct rounding of conversions from __int128 to + __float128. */ +/* { dg-do run { target i?86-*-* x86_64-*-* ia64-*-* } } */ +/* { dg-require-effective-target int128 } */ +/* { dg-options "-frounding-math" } */ + +#include <fenv.h> +#include <stdlib.h> + +int +main (void) +{ + volatile unsigned long long h = -1ULL; + volatile unsigned __int128 u128 = (((unsigned __int128) h) << 64) | h; + volatile __int128 s128 = u128 >> 1; + fesetround (FE_TOWARDZERO); + __float128 ru = u128, rs = s128; + if (ru != 0x1.ffffffffffffffffffffffffffffp127q) + abort (); + if (rs != 0x1.ffffffffffffffffffffffffffffp126q) + abort (); + exit (0); +} |