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] |
I had put the fast math check for the sake of being consistent with the PR description.
Do we really need all "fast math" flags set to enable this opt? E.g. surely we don't care about !flag_signed_zeros since you disable the code when "c" is zero. Perhaps other sub-bits of "fast math" can also be ignored for this purpose.
Yes, I have tried a number of other permutations with good results.E.g. try testing various different permutations of changing CMP or OP.
Yes, I tried this too and you are right the expressions are canonicalized by this point so this works anyways.Or how about (a OP c) CMP (c OP b) when OP is commutative?
Thanks, Pranav
Pranav Bhandarkar GNU Tools Celunite, Inc. (www.celunite.com) +91-98220 82881
On Sun, 7 Oct 2007, Pranav Bhandarkar wrote:
Hi, Could somebody please review this patch which is a proposed fix for PR 31098.
2007-10-07 Pranav Bhandarkar <pranav.bhandarkar@celunite.com>
* fold-const.c (fold_comparison): fold (a OP c) CMP (b OP c) -> a
CMP b, iff c is not zero
* testsuite/pr31098.c: New
+ /* (a OP c) CMP (b OP c) -> a CMP b, iff c is not zero */
+ if (fast_math_flags_set_p () && (TREE_CODE (arg0) == TREE_CODE (arg1))
Do we really need all "fast math" flags set to enable this opt? E.g. surely we don't care about !flag_signed_zeros since you disable the code when "c" is zero. Perhaps other sub-bits of "fast math" can also be ignored for this purpose.
Also I would suggest a few more testcases (not necessarily more test files, you can put them all in the same file). E.g. try testing various different permutations of changing CMP or OP. Or how about (a OP c) CMP (c OP b) when OP is commutative? I believe the exprs are canonicalized at this point so adding a testcase for one side reversed should just work.
Thanks, --Kaveh -- Kaveh R. Ghazi ghazi@caip.rutgers.edu
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |