RFR: 8282365: Optimize divideUnsigned and remainderUnsigned for constants [v16]

Quan Anh Mai qamai at openjdk.org
Wed Jul 12 16:20:36 UTC 2023


On Wed, 12 Jul 2023 16:15:17 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:

>> src/hotspot/share/opto/divnode.cpp line 462:
>> 
>>> 460:       }
>>> 461: 
>>> 462:       // Just do the minimum for now
>> 
>> Minimum of what? Not sure what you mean
>
> I mean we can do better, we are trying to prove that the multiplication does not overflow a u128, since the constant is a u65 if the dividend is a u63 then the inequality holds, we can have a more strict bound since the constant is known already.

I will add more clarification to this in the comment, basically the operation is `x * (M1 + 2**64) / 2**s = ((x * M1) / 2**64 + 1) / 2**(s - 64)`.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/9947#discussion_r1261420568


More information about the hotspot-compiler-dev mailing list