[Bug rtl-optimization/14851] [4.0 Regression] suboptimal fp division with -ffast-math
uros at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Fri Sep 17 06:08:00 GMT 2004
------- Additional Comments From uros at gcc dot gnu dot org 2004-09-17 06:08 -------
This is caused by following code in expr.c, around line 7676:
--cut here--
case RDIV_EXPR:
/* Emit a/b as a*(1/b). Later we may manage CSE the reciprocal saving
expensive divide. If not, combine will rebuild the original
computation. */
if (flag_unsafe_math_optimizations && optimize && !optimize_size
&& TREE_CODE (type) == REAL_TYPE
&& !real_onep (TREE_OPERAND (exp, 0)))
return expand_expr (build2 (MULT_EXPR, type, TREE_OPERAND (exp, 0),
build2 (RDIV_EXPR, type,
build_real (type, dconst1),
TREE_OPERAND (exp, 1))),
target, tmode, modifier);
--cut here--
It is obvious, that in current 4.0, combine is ignoring this construct.
BTW: gcc-3.3 has quite weird behaviour with testcases like the one above, when
numerator is constant. When dividing integer-like numerators (for example
123532.0 / x), combine converts expression back to original one, and for real
numerators (4241.432 / x), no conversion occurs.
I will try to fix mainline.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Known to fail|4.0 |4.0.0
Last reconfirmed|2004-07-09 03:49:33 |2004-09-17 06:08:21
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14851
More information about the Gcc-bugs
mailing list