http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53087
--- Comment #9 from Paolo Bonzini <bonzini at gnu dot org> 2012-04-25 20:00:57
UTC ---
The handling of this code sequence in fold-const changed back and forth many
times, and this is likely the reason why GCC 4.1 produced straight-line code
while GCC 4.3 produced branchy code.
I think the best fix is to add support for expanding "x != 0" using the cntlzw
trick---either in the cstore expander or in emit_store_flag.
In fact, emit_store_flag already has code for a similar trick:
/* For EQ or NE, one way to do the comparison is to apply an operation
that converts the operand into a positive number if it is nonzero
or zero if it was originally zero. Then, for EQ, we subtract 1 and
for NE we negate. This puts the result in the sign bit. Then we
normalize with a shift, if needed.
Two operations that can do the above actions are ABS and FFS, so try
them. If that doesn't work, and MODE is smaller than a full word,
we can use zero-extension to the wider mode (an unsigned conversion)
as the operation. */
So another thing to do is to investigate why this doesn't work.