RFR: 8332268: C2: Add missing optimizations for UDivI/L and UModI/L and unify the shared logic with the signed nodes [v21]
Christian Hagedorn
chagedorn at openjdk.org
Wed Dec 11 12:06:02 UTC 2024
On Tue, 10 Dec 2024 15:00:21 GMT, theoweidmannoracle <duke at openjdk.org> wrote:
>> This PR introduces
>> - several new optimizations to unsigned division and modulo
>> - x % 1, x % x, x % 2^k
>> - x / 1, x / x, x / 2^k
>> - does not implement the Granlund and Montgomery algorithm, which has been implemented for signed modulo division in the past. It is unclear if a lot is to be gained by implementing this.
>> - tests to test existing optimizations for signed division and modulo
>> - does not test the Granlund and Montgomery algorithm directly
>
> theoweidmannoracle has updated the pull request incrementally with two additional commits since the last revision:
>
> - Merge branch 'unsigned-div-opts' of https://github.com/theoweidmannoracle/jdk into unsigned-div-opts
> - Rename variables
Marked as reviewed by chagedorn (Reviewer).
src/hotspot/share/opto/divnode.cpp line 1200:
> 1198: Unsigned au = static_cast<Unsigned>(type_dividend->get_con());
> 1199: Unsigned bu = static_cast<Unsigned>(type_divisor->get_con());
> 1200: return TypeClass::make(static_cast<Signed>(au % bu));
Thanks for the updates, one last nit:
Suggestion:
Unsigned dividend = static_cast<Unsigned>(type_dividend->get_con());
Unsigned divisor = static_cast<Unsigned>(type_divisor->get_con());
return TypeClass::make(static_cast<Signed>(dividend % divisor));
-------------
PR Review: https://git.openjdk.org/jdk/pull/22061#pullrequestreview-2492679451
PR Review Comment: https://git.openjdk.org/jdk/pull/22061#discussion_r1878299973
More information about the hotspot-compiler-dev
mailing list