RFR: 8370196: C2: Improve (U)MulHiLNode::MulHiValue [v7]
Hannes Greule
hgreule at openjdk.org
Mon Nov 24 09:53:10 UTC 2025
On Sat, 22 Nov 2025 14:48:17 GMT, Zihao Lin <duke at openjdk.org> wrote:
>> If nodes both are constant, support constant folding.
>
> Zihao Lin has updated the pull request incrementally with one additional commit since the last revision:
>
> Fix
> In addition, I take some time to add a range-based folding for MulHiLNode and UMulHiLNode. Please help to take a look, thank you folks!
@linzihao1999 I think if you want to expand beyond simple constant folding, then it's better to just do the full range calculation. That should be more or less like https://github.com/openjdk/jdk/blob/43af7b59765fa9820726de276bae9d1fcd2ba3ca/src/hotspot/share/opto/mulnode.cpp#L402-L407
just with the `multiply_high_*` instead.
This way, you don't need to check for ZERO, or for constants, or check for overflows.
src/hotspot/share/opto/mulnode.cpp line 25:
> 23: */
> 24:
> 25: #include "jni_md.h"
Please check which of the changed includes are actually needed.
src/hotspot/share/opto/type.cpp line 1922:
> 1920:
> 1921: const TypeLong* TypeLong::make_unsigned(julong ucon) {
> 1922: jlong con = ucon;
This is the same problem of implementation-definedness again, that's why I suggest to just use the full signed range and let canonicalization deal with the rest.
-------------
PR Review: https://git.openjdk.org/jdk/pull/28097#pullrequestreview-3499356584
PR Review Comment: https://git.openjdk.org/jdk/pull/28097#discussion_r2555474014
PR Review Comment: https://git.openjdk.org/jdk/pull/28097#discussion_r2555479623
More information about the hotspot-compiler-dev
mailing list