RFR: 8370196: C2: Improve (U)MulHiLNode::MulHiValue [v5]

Zihao Lin duke at openjdk.org
Thu Nov 20 16:44:09 UTC 2025


On Tue, 18 Nov 2025 15:40:50 GMT, Hannes Greule <hgreule at openjdk.org> wrote:

>> Zihao Lin has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Apply suggestion from @eme64
>>   
>>   Co-authored-by: Emanuel Peter <emanuel.peter at oracle.com>
>
> src/hotspot/share/opto/mulnode.cpp line 641:
> 
>> 639:   // Both are constant, directly computed the result
>> 640:   if (longType1->is_con() && longType2->is_con()) {
>> 641:     jlong highResult = multiply_high_unsigned(longType1->get_con(), longType2->get_con());
> 
> We are going from an unsigned value to a signed here, I think this is implementation-defined? Maybe it's better to use julong and `TypeLong::make_or_top(TypeIntPrototype<jlong, julong>{{min_jlong, max_jlong}, {highResult, highResult}, {0, 0}})`?
> 
> (It might also make sense to have a helper function like `TypeLong::make_unsigned` for that, but I'll let others comment on whether that should be done separately)

I think TypeLong::make is doing the work your mentioned, do we need another function to do it?


const TypeLong* TypeLong::make(jlong con) {
  julong ucon = con;
  return (new TypeLong(TypeIntPrototype<jlong, julong>{{con, con}, {ucon, ucon}, {~ucon, ucon}},
                       WidenMin, false))->hashcons()->is_long();
}

> test/hotspot/jtreg/compiler/lib/ir_framework/IRNode.java line 1533:
> 
>> 1531:     public static final String MUL_HI_L = PREFIX + "MUL_HI_L" + POSTFIX;
>> 1532:     static {
>> 1533:         superWordNodes(MUL_HI_L, "MulHiL");
> 
> This looks wrong, and I think it might make more sense to move these definitions closer to MUL_L.

You are right, I will use beforeMatchingNameRegex to instead of superWordNodes.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28097#discussion_r2546804962
PR Review Comment: https://git.openjdk.org/jdk/pull/28097#discussion_r2546811683


More information about the hotspot-compiler-dev mailing list