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

Reply via email to