RFR: 8332268: C2: Add missing optimizations for UDivI/L and UModI/L and unify the shared logic with the signed nodes
Emanuel Peter
epeter at openjdk.org
Mon Nov 25 09:08:19 UTC 2024
On Wed, 13 Nov 2024 09:45:37 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
Nice improvements, some comments/ questions below about testing.
src/hotspot/share/opto/divnode.cpp line 518:
> 516:
> 517: if (is_power_of_2(l)) {
> 518: return make_urshift<TypeClass>(div->in(1), phase->intcon(log2i_graceful(l)));
Are we testing optimizations like these with random constants somewhere, and comparing it to the interpreter results?
test/hotspot/jtreg/compiler/c2/irTests/ModINodeIdealizationTests.java line 2:
> 1: /*
> 2: * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved.
Suggestion:
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
Check the others too. I don't think a new file requires old dates ;)
test/hotspot/jtreg/compiler/c2/irTests/ModLNodeIdealizationTests.java line 2:
> 1: /*
> 2: * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved.
Suggestion:
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
-------------
Changes requested by epeter (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/22061#pullrequestreview-2457735736
PR Review Comment: https://git.openjdk.org/jdk/pull/22061#discussion_r1856180636
PR Review Comment: https://git.openjdk.org/jdk/pull/22061#discussion_r1856174160
PR Review Comment: https://git.openjdk.org/jdk/pull/22061#discussion_r1856174977
More information about the hotspot-compiler-dev
mailing list