public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-10168] middle-end/103193 - avoid canonicalizing <= and >= to == for floats
@ 2022-07-22 11:21 Richard Biener
0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2022-07-22 11:21 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:e2b97d6883a72b0c51dd0455acea43e21b5537d9
commit r11-10168-ge2b97d6883a72b0c51dd0455acea43e21b5537d9
Author: Richard Biener <rguenther@suse.de>
Date: Mon Nov 15 12:13:40 2021 +0100
middle-end/103193 - avoid canonicalizing <= and >= to == for floats
This avoids doing aforementioned canoncalization when -ftrapping-math
is in effect and we honor NaNs.
2021-11-15 Richard Biener <rguenther@suse.de>
PR middle-end/103193
* match.pd: Avoid canonicalizing (le/ge @0 @0) to (eq @0 @0)
with NaNs and -ftrapping-math.
(cherry picked from commit d9ca2ca381e44a332703155d07b50b84aa21f80d)
Diff:
---
gcc/match.pd | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/gcc/match.pd b/gcc/match.pd
index e89601c0c14..8126f90ee75 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -4114,7 +4114,10 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
(if (! FLOAT_TYPE_P (TREE_TYPE (@0))
|| ! HONOR_NANS (@0))
{ constant_boolean_node (true, type); }
- (if (cmp != EQ_EXPR)
+ (if (cmp != EQ_EXPR
+ /* With -ftrapping-math conversion to EQ loses an exception. */
+ && (! FLOAT_TYPE_P (TREE_TYPE (@0))
+ || ! flag_trapping_math))
(eq @0 @0)))))
(for cmp (ne gt lt)
(simplify
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-07-22 11:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-22 11:21 [gcc r11-10168] middle-end/103193 - avoid canonicalizing <= and >= to == for floats Richard Biener
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).