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

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


On Mon, 3 Jul 2023 12:25:04 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> Quan Anh Mai has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 50 commits:
>> 
>>  - missing java_negate
>>  - Merge branch 'master' into unsignedDiv
>>  - whitespace
>>  - move asserts to use sites
>>  - windows complaints
>>  - compiler complaints
>>  - undefined internal linkage
>>  - add tests, special casing large shift
>>  - draft
>>  - Merge branch 'master' into unsignedDiv
>>  - ... and 40 more: https://git.openjdk.org/jdk/compare/5b147eb5...eb1f5dd9
>
> 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.

> src/hotspot/share/opto/divnode.cpp line 931:
> 
>> 929:   const Type* t = phase->type(in(2));
>> 930:   if(t == TypeInt::ONE) {       // Identity?
>> 931:     return nullptr;             // Skip it
> 
> Does `Value` handle this?

`x / 1 = x` so I don't think `Value` can handle it.

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

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


More information about the hotspot-compiler-dev mailing list