diff options
author | sayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-01-21 17:54:26 +0000 |
---|---|---|
committer | sayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-01-21 17:54:26 +0000 |
commit | a47b9d7927305dd956767900ce235bffc4e9310d (patch) | |
tree | 87965b49d99f08cdf39d5e6360e95fccbda397a3 /gcc/real.c | |
parent | 3d6475e0ba3a4748eb325a8d13f513cfd0adc77c (diff) | |
download | gcc-a47b9d7927305dd956767900ce235bffc4e9310d.tar.gz |
PR rtl-optimization/576
* real.c (real_arithmetic): Change return type from void to bool
to return an indication that the result may be inexact.
* real.h (real_arithmeric): Update prototype.
* fold-const.c (const_binop): Don't constant fold floating
point expressions when the user specifies -frounding-math and
the result may depend upon the run-time rounding mode.
(fold_convert_const_real_from_real): Clean-up.
(fold_initializer): Ignore flag_rounding_math for initializers.
* simplify-rtx.c (simplify_binary_operation): Likewise, don't
constant fold FP operations with flag_rounding_math if the
result may depend upon the run-time rounding mode.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@94020 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/real.c')
-rw-r--r-- | gcc/real.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/gcc/real.c b/gcc/real.c index 5871d1e037c..a748b87b33a 100644 --- a/gcc/real.c +++ b/gcc/real.c @@ -972,9 +972,10 @@ do_fix_trunc (REAL_VALUE_TYPE *r, const REAL_VALUE_TYPE *a) } /* Perform the binary or unary operation described by CODE. - For a unary operation, leave OP1 NULL. */ + For a unary operation, leave OP1 NULL. This function returns + true if the result may be inexact due to loss of precision. */ -void +bool real_arithmetic (REAL_VALUE_TYPE *r, int icode, const REAL_VALUE_TYPE *op0, const REAL_VALUE_TYPE *op1) { @@ -983,20 +984,16 @@ real_arithmetic (REAL_VALUE_TYPE *r, int icode, const REAL_VALUE_TYPE *op0, switch (code) { case PLUS_EXPR: - do_add (r, op0, op1, 0); - break; + return do_add (r, op0, op1, 0); case MINUS_EXPR: - do_add (r, op0, op1, 1); - break; + return do_add (r, op0, op1, 1); case MULT_EXPR: - do_multiply (r, op0, op1); - break; + return do_multiply (r, op0, op1); case RDIV_EXPR: - do_divide (r, op0, op1); - break; + return do_divide (r, op0, op1); case MIN_EXPR: if (op1->cl == rvc_nan) @@ -1033,6 +1030,7 @@ real_arithmetic (REAL_VALUE_TYPE *r, int icode, const REAL_VALUE_TYPE *op0, default: gcc_unreachable (); } + return false; } /* Legacy. Similar, but return the result directly. */ |