diff options
author | Roger Sayle <roger@eyesopen.com> | 2002-07-28 02:11:05 +0000 |
---|---|---|
committer | Roger Sayle <sayle@gcc.gnu.org> | 2002-07-28 02:11:05 +0000 |
commit | 52bfebf09121f90fb62f448ccb817ce9208d8f24 (patch) | |
tree | 811f8a9808cc8a4ff4fa003afa503d9d758bdcc8 /gcc/rtlanal.c | |
parent | e66f55b878b78b51895f907fd624b583732d7659 (diff) | |
download | gcc-52bfebf09121f90fb62f448ccb817ce9208d8f24.zip gcc-52bfebf09121f90fb62f448ccb817ce9208d8f24.tar.gz gcc-52bfebf09121f90fb62f448ccb817ce9208d8f24.tar.bz2 |
Makefile.in: rtlanal.o now depends upon real.h.
* 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.
From-SVN: r55804
Diffstat (limited to 'gcc/rtlanal.c')
-rw-r--r-- | gcc/rtlanal.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c index 35cc513..6d391ea 100644 --- a/gcc/rtlanal.c +++ b/gcc/rtlanal.c @@ -30,6 +30,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "tm_p.h" #include "flags.h" #include "basic-block.h" +#include "real.h" /* Forward declarations */ static int global_reg_mentioned_p_1 PARAMS ((rtx *, void *)); @@ -2369,6 +2370,8 @@ may_trap_p (x) case MOD: case UDIV: case UMOD: + if (HONOR_SNANS (GET_MODE (x))) + return 1; if (! CONSTANT_P (XEXP (x, 1)) || (GET_MODE_CLASS (GET_MODE (x)) == MODE_FLOAT && flag_trapping_math)) @@ -2396,12 +2399,22 @@ may_trap_p (x) when COMPARE is used, though many targets do make this distinction. For instance, sparc uses CCFPE for compares which generate exceptions and CCFP for compares which do not generate exceptions. */ - if (GET_MODE_CLASS (GET_MODE (x)) == MODE_FLOAT) + if (HONOR_NANS (GET_MODE (x))) return 1; /* But often the compare has some CC mode, so check operand modes as well. */ - if (GET_MODE_CLASS (GET_MODE (XEXP (x, 0))) == MODE_FLOAT - || GET_MODE_CLASS (GET_MODE (XEXP (x, 1))) == MODE_FLOAT) + if (HONOR_NANS (GET_MODE (XEXP (x, 0))) + || HONOR_NANS (GET_MODE (XEXP (x, 1)))) + return 1; + break; + + case EQ: + case NE: + if (HONOR_SNANS (GET_MODE (x))) + return 1; + /* Often comparison is CC mode, so check operand modes. */ + if (HONOR_SNANS (GET_MODE (XEXP (x, 0))) + || HONOR_SNANS (GET_MODE (XEXP (x, 1)))) return 1; break; |