BitScanForwardNode: LongBits test failure
aph at redhat.com
Wed Nov 30 19:03:55 UTC 2016
I have test failure which baffles me. BitScanForwardNode has a comment at
* Determines the index of the least significant "1" bit. Note that the result is undefined if the
* input is zero.
But BitScanForwardNode.tryFold sometimes is called with the constant zero.
What seems to happen is that tryFold() fails, so foldStamp() is
called, again with the constant zero. Some rather tortured logic is
executed and the result is that the stamp becomes -1 ... -1, so the
constant -1 is substituted; this is wrong for
A fix is obvious: correct tryFold() so that it works for 0. But I
don't understand how Long.numberOfTrailingZeros(0) works on other
processors; yet presumably this test (LongBits) does pass there.
More information about the graal-dev