RFR: 8349637: Integer.numberOfLeadingZeros outputs incorrectly in certain cases [v3]
Paul Sandoz
psandoz at openjdk.org
Fri Feb 14 16:34:14 UTC 2025
On Thu, 13 Feb 2025 19:23:51 GMT, Paul Sandoz <psandoz at openjdk.org> wrote:
>> Jasmine Karthikeyan has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Improve explanation of logic
>
> Thank you for fixing this. More broadly we should double check the intrinsics of Long/Integer.numberOfLeading/Trailing/Zeros (we added in the integration of Integration of JEP 426: Vector API) and follow up with any necessary tests and/or fixes in subsequent PRs.
> @PaulSandoz @jatin-bhateja This should really have been caught by VectorAPI testing, but apparently not the whole range was covered.
Correct, there are tests that cover the integral vectors and masked variants, and there are various input data shapes generated but I don't think they generate the right values to provoke the issue. They do compare against the scalar method call (and i suspect C2 does not optimize given how results are compared - we could strengthen this by restricting inlining when asserting results).
https://github.com/openjdk/jdk/blob/master/test/jdk/jdk/incubator/vector/Int256VectorTests.java#L5967
https://github.com/openjdk/jdk/blob/master/test/jdk/jdk/incubator/vector/Byte256VectorTests.java#L5923
-------------
PR Comment: https://git.openjdk.org/jdk/pull/23579#issuecomment-2659778515
More information about the hotspot-compiler-dev
mailing list