diff options
author | Richard Sandiford <rsandifo@redhat.com> | 2002-03-07 11:37:16 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2002-03-07 11:37:16 +0000 |
commit | 71925bc04f24a40ab8ac587e08609cf91299e293 (patch) | |
tree | 74f74ccd7ea753279bc20a10577c6a90a6a4ba38 /gcc/builtins.c | |
parent | 145d3bf292a6cfc66a6396285003765db9424a8f (diff) | |
download | gcc-71925bc04f24a40ab8ac587e08609cf91299e293.zip gcc-71925bc04f24a40ab8ac587e08609cf91299e293.tar.gz gcc-71925bc04f24a40ab8ac587e08609cf91299e293.tar.bz2 |
defaults.h (MODE_HAS_NANS, [...]): New.
* defaults.h (MODE_HAS_NANS, MODE_HAS_INFINITIES): New.
(MODE_HAS_SIGNED_ZEROS, MODE_HAS_SIGN_DEPENDENT_ROUNDING): New.
* flags.h (HONOR_NANS, HONOR_INFINITIES, HONOR_SIGNED_ZEROS): New.
(HONOR_SIGN_DEPENDENT_ROUNDING): New.
* builtins.c (expand_builtin_mathfn): Use HONOR_NANS.
* c-common.c (truthvalue_conversion): Reduce x - y != 0 to x != y
unless x and y could be infinite.
(expand_unordered_cmp): New, mostly split from expand_tree_builtin.
Check that the common type of both arguments is a real, even for
targets without unordered comparisons. Allow an integer argument
to be compared against a real.
(expand_tree_builtin): Use expand_unordered_cmp.
* combine.c (combine_simplify_rtx): Use the new HONOR_... macros.
* cse.c (fold_rtx): Likewise. Fix indentation.
* fold-const.c (fold_real_zero_addition_p): New.
(fold): Use it, and the new HONOR_... macros.
* ifcvt.c (noce_try_minmax): Use the new HONOR_... macros.
* jump.c (reversed_comparison_code_parts): After searching for
the true comparison mode, use HONOR_NANS to decide whether it
can be safely reversed.
(reverse_condition_maybe_unordered): Remove IEEE check.
* simplify-rtx.c (simplify_binary_operation): Use the new macros
to decide which simplifications are valid. Allow the following
simplifications for IEEE: (-a + b) to (b - a), (a + -b) to (a - b),
and (a - -b) to (a + b).
(simplify_relational_operation): Use HONOR_NANS.
* doc/tm.texi: Document the MODE_HAS_... macros.
From-SVN: r50401
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r-- | gcc/builtins.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c index e3adb05..c4aebd3 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -1470,6 +1470,7 @@ expand_builtin_mathfn (exp, target, subtarget) rtx op0, insns; tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0); tree arglist = TREE_OPERAND (exp, 1); + enum machine_mode argmode; if (!validate_arglist (arglist, REAL_TYPE, VOID_TYPE)) return 0; @@ -1518,8 +1519,8 @@ expand_builtin_mathfn (exp, target, subtarget) /* Compute into TARGET. Set TARGET to wherever the result comes back. */ - target = expand_unop (TYPE_MODE (TREE_TYPE (TREE_VALUE (arglist))), - builtin_optab, op0, target, 0); + argmode = TYPE_MODE (TREE_TYPE (TREE_VALUE (arglist))); + target = expand_unop (argmode, builtin_optab, op0, target, 0); /* If we were unable to expand via the builtin, stop the sequence (without outputting the insns) and return 0, causing @@ -1530,18 +1531,12 @@ expand_builtin_mathfn (exp, target, subtarget) return 0; } - /* If errno must be maintained and if we are not allowing unsafe - math optimizations, check the result. */ + /* If errno must be maintained, we must set it to EDOM for NaN results. */ - if (flag_errno_math && ! flag_unsafe_math_optimizations) + if (flag_errno_math && HONOR_NANS (argmode)) { rtx lab1; - /* Don't define the builtin FP instructions - if your machine is not IEEE. */ - if (TARGET_FLOAT_FORMAT != IEEE_FLOAT_FORMAT) - abort (); - lab1 = gen_label_rtx (); /* Test the result; if it is NaN, set errno=EDOM because |