summaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorsayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2002-07-28 02:11:05 +0000
committersayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2002-07-28 02:11:05 +0000
commit0a8176f36ec372a4571f006c8262b5aa8a29b65c (patch)
tree811f8a9808cc8a4ff4fa003afa503d9d758bdcc8 /gcc/fold-const.c
parent525ef9f93fe5003b747daddb0962d8847332123c (diff)
downloadgcc-0a8176f36ec372a4571f006c8262b5aa8a29b65c.tar.gz
* Makefile.in: rtlanal.o now depends upon real.h.
* flags.h [flag_signaling_nans]: New flag. [HONOR_SNANS]: New macro. * toplev.c [flag_signaling_nans]: Initialize to false. (f_options): Add processing for "-fsignaling-nans". (set_fast_math_flags): Clear flag_signaling_nans with -ffast-math. (process_options): flag_signaling_nans implies flag_trapping_math. * c-common.c (cb_register_builtins): Define __SUPPORT_SNAN__ when -fsignaling-nans. First step to implementing WG14's N965. * fold-const.c (fold) [MULT_EXPR]: Conditionalize transforming 1.0 * x into x, and -1.0 * x into -x on !HONOR_SNANS. [RDIV_EXPR]: Conditionalize x/1.0 into x on !HONOR_SNANS. * simplify-rtx.c (simplify_relational_operation): Conditionalize transforming abs(x) < 0.0 into false on !HONOR_SNANS. * rtlanal.c: #include real.c for TARGET_FLOAT_FORMAT definitions required by HONOR_SNANS. (may_trap_p): Floating point DIV, MOD, UDIV, UMOD, GE, GT, LE, LT and COMPARE may always trap with -fsignaling_nans. EQ and NE only trap for flag_signaling_nans not flag_trapping_math (i.e. HONOR_SNANS but not HONOR_NANS). * doc/invoke.texi: Document new -fsignaling-nans compiler option. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@55804 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 3dafe0afb31..49c53cc0857 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -5476,16 +5476,13 @@ fold (expr)
&& !HONOR_SIGNED_ZEROS (TYPE_MODE (TREE_TYPE (arg0)))
&& real_zerop (arg1))
return omit_one_operand (type, arg1, arg0);
- /* In IEEE floating point, x*1 is not equivalent to x for snans.
- However, ANSI says we can drop signals,
- so we can do this anyway. */
- if (real_onep (arg1))
+ /* In IEEE floating point, x*1 is not equivalent to x for snans. */
+ if (!HONOR_SNANS (TYPE_MODE (TREE_TYPE (arg0)))
+ && real_onep (arg1))
return non_lvalue (convert (type, arg0));
- /* Transform x * -1.0 into -x. This should be safe for NaNs,
- signed zeros and signed infinities, but is currently
- restricted to "unsafe math optimizations" just in case. */
- if (flag_unsafe_math_optimizations
+ /* Transform x * -1.0 into -x. */
+ if (!HONOR_SNANS (TYPE_MODE (TREE_TYPE (arg0)))
&& real_minus_onep (arg1))
return fold (build1 (NEGATE_EXPR, type, arg0));
@@ -5620,9 +5617,9 @@ fold (expr)
return fold (build (RDIV_EXPR, type, TREE_OPERAND (arg0, 0),
TREE_OPERAND (arg1, 0)));
- /* In IEEE floating point, x/1 is not equivalent to x for snans.
- However, ANSI says we can drop signals, so we can do this anyway. */
- if (real_onep (arg1))
+ /* In IEEE floating point, x/1 is not equivalent to x for snans. */
+ if (!HONOR_SNANS (TYPE_MODE (TREE_TYPE (arg0)))
+ && real_onep (arg1))
return non_lvalue (convert (type, arg0));
/* If ARG1 is a constant, we can convert this to a multiply by the