On 04/20/2011 07:52 PM, Segher Boessenkool wrote:
The test and-1.c has wrong logic.
In the formula:
y & ~(y & -y)
The part (y & -y) is always a mask with one bit set, which corresponds
to the least significant "1" bit in y.
The final result is that bit, is set to zero (y & ~mask)
There is no boolean simplification possible, and the compiler always
produces
a nand instruction.
The formula is equal to y & (y-1) , maybe the testcase is testing that?
Segher
Ah, yes
A neg/nand/and should be optimized into a sub -1/and.
I will check why this is not happening.
Thanks
Edmar