diff options
author | Wilco Dijkstra <wdijkstr@arm.com> | 2019-03-04 12:36:04 +0000 |
---|---|---|
committer | Wilco Dijkstra <wilco@gcc.gnu.org> | 2019-03-04 12:36:04 +0000 |
commit | 5f054b17f826e2cfb4c76020bce79b2ed99bb9f9 (patch) | |
tree | 42a53f947d241a902a03d45985896fc39d2e72df | |
parent | 19d4e4d614655cf76d87522855103c01d029b2cf (diff) | |
download | gcc-5f054b17f826e2cfb4c76020bce79b2ed99bb9f9.zip gcc-5f054b17f826e2cfb4c76020bce79b2ed99bb9f9.tar.gz gcc-5f054b17f826e2cfb4c76020bce79b2ed99bb9f9.tar.bz2 |
re PR tree-optimization/89437 (incorrect result for sinl (atanl (x)))
Fix PR89437
Fix PR89437. Fix the sinatan-1.c testcase to not run without
a C99 target system. Use nextafterl for long double initialization.
Fix an issue with sinl (atanl (sqrtl (LDBL_MAX)) returning 0.0
instead of 1.0 by using x < sqrtl (LDBL_MAX) in match.pd.
gcc/
PR tree-optimization/89437
* match.pd: Use lt in sin(atan(x)) and cos(atan(x)) simplifications.
testsuite/
PR tree-optimization/89437
* gcc.dg/sinatan-1.c: Fix testcase.
From-SVN: r269364
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/match.pd | 4 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/sinatan-1.c | 4 |
4 files changed, 14 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9fcb067..38858fa 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2019-03-04 Wilco Dijkstra <wdijkstr@arm.com> + + PR tree-optimization/89437 + * match.pd: Use lt in sin(atan(x)) and cos(atan(x)) simplifications. + 2019-03-04 Richard Biener <rguenther@suse.de> PR middle-end/89572 diff --git a/gcc/match.pd b/gcc/match.pd index bccf4df..c9af2e5 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -4407,7 +4407,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) tree t_one = build_one_cst (type); } (if (SCALAR_FLOAT_TYPE_P (type)) - (cond (le (abs @0) { t_cst; }) + (cond (lt (abs @0) { t_cst; }) (rdiv @0 (sqrts (plus (mult @0 @0) { t_one; }))) (copysigns { t_one; } @0)))))) @@ -4427,7 +4427,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) tree t_zero = build_zero_cst (type); } (if (SCALAR_FLOAT_TYPE_P (type)) - (cond (le (abs @0) { t_cst; }) + (cond (lt (abs @0) { t_cst; }) (rdiv { t_one; } (sqrts (plus (mult @0 @0) { t_one; }))) (copysigns { t_zero; } @0)))))) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1a5c867..cbcb1a9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-03-04 Wilco Dijkstra <wdijkstr@arm.com> + + PR tree-optimization/89437 + * gcc.dg/sinatan-1.c: Fix testcase. + 2019-03-04 Richard Biener <rguenther@suse.de> PR middle-end/89572 diff --git a/gcc/testsuite/gcc.dg/sinatan-1.c b/gcc/testsuite/gcc.dg/sinatan-1.c index 6a3995a..cfbb771 100644 --- a/gcc/testsuite/gcc.dg/sinatan-1.c +++ b/gcc/testsuite/gcc.dg/sinatan-1.c @@ -1,4 +1,4 @@ -/* { dg-do run } */ +/* { dg-do run { target c99_runtime } } */ /* { dg-options "-Ofast" } */ /* { dg-add-options ieee } */ @@ -62,7 +62,7 @@ main() /* Get first x such that 1 + x*x will overflow */ float fc = nextafterf (sqrtf (__FLT_MAX__ - 1), __FLT_MAX__); double c = nextafter (sqrt (__DBL_MAX__ - 1), __DBL_MAX__); - long double lc = nextafter (sqrtl (__LDBL_MAX__ - 1), __LDBL_MAX__); + long double lc = nextafterl (sqrtl (__LDBL_MAX__ - 1), __LDBL_MAX__); /* Force move from FPU to memory, otherwise comparison may fail due to possible more accurate registers (see 387) */ |