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

Zihao Lin duke at openjdk.org
Sat Nov 22 15:09:51 UTC 2025


On Tue, 18 Nov 2025 15:32:54 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

> Would it be an idea to still have a `MulHiValue`, and then pass it in a `signed/unsigned` flag? That way we could avoid some code duplication. Because the only difference seems to be `multiply_high_signed` vs `multiply_high_unsigned`, right?

It’s a good idea. But when i try to remove some duplicate code here, it's always have to check signed flag. like

if (signed-flag) {
...
} else {
...
}

The duplicate code only is

  if (t1 == Type::TOP || t2 == Type::TOP) {
    return Type::TOP;
  }

  if (t1 == TypeLong::ZERO || t2 == TypeLong::ZERO) {
    return TypeLong::ZERO;
  }

 So shared a helper will not to reduce the code complexity, for now I’d prefer to keep the two implementations separate.

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

PR Comment: https://git.openjdk.org/jdk/pull/28097#issuecomment-3566785777


More information about the hotspot-compiler-dev mailing list