This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patch gcc-4.0 should not apply mathematical associative rules for addition or multiplication



On Oct 5, 2004, at 3:52 PM, Geoffrey Keating wrote:


Fariborz Jahanian <fjahanian@apple.com> writes:

OK for fsf mainline?

No, not OK.


- thanks, fariborz (fjahanian@apple.com)

ChangeLog:

2004-10-05 Fariborz Jahanian <fjahanian@apple.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
        expressions.


+   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 alternatives?

Why is this not right flag, it is used other places which we do the same thing.

+            && (code == MULT_EXPR || code == PLUS_EXPR)
+            && FLOAT_TYPE_P (TREE_TYPE (exp)));

This function appears to disallow folding


(x * 2.0) * 2.0

into

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.

-- Pinski


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]