RFR: 8349637: Integer.numberOfLeadingZeros outputs incorrectly in certain cases

Jasmine Karthikeyan jkarthikeyan at openjdk.org
Wed Feb 12 16:18:14 UTC 2025


On Wed, 12 Feb 2025 11:36:42 GMT, Jatin Bhateja <jbhateja at openjdk.org> wrote:

>> test/hotspot/jtreg/compiler/vectorization/TestNumberOfContinuousZeros.java line 45:
>> 
>>> 43: 
>>> 44: public class TestNumberOfContinuousZeros {
>>> 45:     private static final int[] SPECIAL = { 0x01FFFFFF, 0x03FFFFFE, 0x07FFFFFC, 0x0FFFFFF8, 0x1FFFFFF0, 0x3FFFFFE0 };
>> 
>> Can you also check for 0xFFFFFFFF, even though we have special handling for -ve signed numbers not affected by this patch.
>
> Can you kindly write an exhaustive functional correctness test that covers entier positive integral value range. Idea here is to test all the cases where unintended exponent increment can lead to incorrect results.

I wrote this exhaustive test while I was working on the patch: https://gist.github.com/jaskarth/6b05352c3007a2650bf084fcb4c50c13

I've also updated the array to include 0xFFFFFFFF.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/23579#discussion_r1952985631


More information about the hotspot-compiler-dev mailing list