From: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Cc: nd <nd@arm.com>
Subject: [PATCH] Fix PR89437
Date: Thu, 21 Feb 2019 16:28:00 -0000 [thread overview]
Message-ID: <DB5PR08MB10306D92C15624041D357C5E837E0@DB5PR08MB1030.eurprd08.prod.outlook.com> (raw)
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.
OK for commit?
ChangeLog:
2019-02-21 Wilco Dijkstra <wdijkstr@arm.com>
gcc/
* match.pd: Use lt in sin(atan(x)) and cos(atan(x)) simplifications.
testsuite/
* gcc.dg/sinatan-1.c: Fix testcase.
--
diff --git a/gcc/match.pd b/gcc/match.pd
index bccf4df05a2f94785446719b3097b3f912fafe96..c9af2e59441c4fe19e88d94c9d138ae35dfe673f 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/gcc.dg/sinatan-1.c b/gcc/testsuite/gcc.dg/sinatan-1.c
index 6a3995ae07949a423e416592276171b6e6f8c816..cfbb771a018d3175c680dce88e0121e469716edc 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) */
next reply other threads:[~2019-02-21 15:56 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-21 16:28 Wilco Dijkstra [this message]
2019-02-21 17:06 ` Richard Biener
2019-02-21 17:43 ` Wilco Dijkstra
2019-02-22 9:58 ` Richard Biener
2019-03-04 13:39 ` Wilco Dijkstra
2019-03-04 13:51 ` Richard Biener
2019-02-21 17:34 ` Giuliano Belinassi
2019-02-21 22:35 ` Jeff Law
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DB5PR08MB10306D92C15624041D357C5E837E0@DB5PR08MB1030.eurprd08.prod.outlook.com \
--to=wilco.dijkstra@arm.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=nd@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).