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] Fold x + x to x * 2


On Sat, 6 Nov 2004, Zdenek Dvorak wrote:

> during investigation of PR 17549 I noted that we do not fold x + x to x
> * 2.  We also do not fold x * c + x to x * (c + 1).  (For non-floats.
> For floats we do both, under some assumptions.)  In the case of PR
> 17549, the ivopts end up producing expressions of type x+x+...+x with as
> much as 8 operands (the expressions are then somehow folded in RTL
> optimizers, I think, so we do not end up producing these sums and it
> does not affect size of the final code, but still this behavior is quite
> weird).  This patch implements these transformations.

Do you avoid eliminating -ftravp traps in the process?  (E.g., x == 
230000000, c == -10, 32-bit signed integers, x * c overflows but x * (c + 
1) doesn't.)

-- 
Joseph S. Myers               http://www.srcf.ucam.org/~jsm28/gcc/
    jsm@polyomino.org.uk (personal mail)
    joseph@codesourcery.com (CodeSourcery mail)
    jsm28@gcc.gnu.org (Bugzilla assignments and CCs)


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