RFR: 8332268: C2: Add missing optimizations for UDivI/L and UModI/L and unify the shared logic with the signed nodes [v17]
Christian Hagedorn
chagedorn at openjdk.org
Mon Dec 9 08:06:41 UTC 2024
On Mon, 2 Dec 2024 16:38:03 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:
>
> - Update UDivINodeIdealizationTests.java
> - Remove more magic numbers
Hi Theo, I've just realized that this PR now misses to block rewiring `UDiv/ModI/L` when removing dominating checks. This should be added here:
https://github.com/openjdk/jdk/blob/69e664de14d1f9d66447937d494da8bf971ac5fe/src/hotspot/share/opto/phaseX.cpp#L1731-L1749
The original report assumed that this was already possible with mainline. But only with adding the missing optimizations for the unsigned versions with this PR, we should now be able to trigger the same SIGFPE failures as tested here for the signed divisions/modulos:
test/hotspot/jtreg/compiler/splitif/TestSplitDivisionThroughPhi.java
You should add unsigned variants for the same tests to verify the fix.
Thanks,
Christian
-------------
Changes requested by chagedorn (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/22061#pullrequestreview-2488034728
More information about the hotspot-compiler-dev
mailing list