This is the mail archive of the
mailing list for the GCC project.
Re: Patch gcc-4.0 should not apply mathematical associative rules for addition or multiplication
- From: Andrew Pinski <pinskia at physics dot uc dot edu>
- To: Geoffrey Keating <geoffk at geoffk dot org>
- Cc: gcc-patches at gcc dot gnu dot org, Fariborz Jahanian <fjahanian at apple dot com>
- Date: Tue, 5 Oct 2004 16:02:33 -0400
- Subject: Re: Patch gcc-4.0 should not apply mathematical associative rules for addition or multiplication
- References: <2B2F21A1-16FF-11D9-957B-000A95BA54A6@apple.com> <firstname.lastname@example.org>
On Oct 5, 2004, at 3:52 PM, Geoffrey Keating wrote:
Fariborz Jahanian <email@example.com> writes:
OK for fsf mainline?
No, not OK.
- thanks, fariborz (firstname.lastname@example.org)
2004-10-05 Fariborz Jahanian <email@example.com>
* tree-ssa-dom.c (associative_fp_binop): New function.
(simplify_rhs_and_lookup_avail_expr): Disallow associativity
and constant folding of floating point MULT_EXPR/PLUS_EXPR
+ enum tree_code code = TREE_CODE (exp);
+ return !(!flag_unsafe_math_optimizations
This flag is not clearly the right one. Why did you pick it from the
Why is this not right flag, it is used other places which we do the same
+ && (code == MULT_EXPR || code == PLUS_EXPR)
+ && FLOAT_TYPE_P (TREE_TYPE (exp)));
This function appears to disallow folding
(x * 2.0) * 2.0
x * 4.0
which seems to me to be valid.
Also this is a valid transformation only if the constants will generate
a power of 2.