On 10/10/13 04:10, Jakub Jelinek wrote:
On Thu, Oct 10, 2013 at 05:25:01PM +0800, Zhenqiang Chen wrote:
Note I've been suggesting the bits I'm referring to in fold-const.c move
out
into the tree-ssa optimizers.  If they fit well into tree-ssa-reassoc.c
I'd look
favorably upon a patch which moved them.

The code is similar with the code (in tree-ssa-reassoc.c) for
      Optimize X == CST1 || X == CST2
      if popcount (CST1 ^ CST2) == 1 into
      (X & ~(CST1 ^ CST2)) == (CST1 & ~(CST1 ^ CST2))

Yeah.  Though, that is one operation cheaper than this, the above
is replacing two comparisons with constants plus one || with
one arithmetic operation (with constant) plus one comparison of constant,
I think that should be always a win (ok, it is one arithmetic operation
more expensive if X == CST1 all the time, but otherwise it is likely
cheaper).  While in your case it is two arithmetic operations plus
comparison with constant, so perhaps for very cheap BRANCH_COST it might
not be beneficial.
Wow, I had no idea we had that kind of transformation in tree-reassoc already.

Jeff

Reply via email to