On Wed, 9 Sep 2026 15:04:46 GMT, Quan Anh Mai <[email protected]> wrote:

>> src/hotspot/share/opto/divnode.cpp line 102:
>> 
>>> 100: // such that division(x / d) = floor(x * c / 2**s) + (x < 0 ? 1 : 0) 
>>> for every integer x in
>>> 101: // the input range. The functions in this file try to derive from the 
>>> formula in real
>>> 102: // arithmetic to arrive at a formula in int/long arithmetic. More 
>>> details can be found in
>> 
>> When you say "real arithmetic", you mean "arithmetic on mathematical 
>> integers", not "arithmetic on real numbers" (as in \mathbb{R}), right?
>
> Well, not really, the division operation is not defined on the ring of 
> integers, so this must be arithmetic on real numbers.

Fair enough.

>> src/hotspot/share/opto/divnode.cpp line 120:
>> 
>>> 118:   juint max_pos = dti->_hi > 0 ? juint(dti->_hi) : 0;
>>> 119:   if (min_neg < d && max_pos < d) {
>>> 120:     return new ConINode(TypeInt::ZERO);
>> 
>> I suggest `phase->zerocon(T_INT)` or `phase->intcon(0)`.
>
> That can't be, `Ideal` must return a new node.

UUUUUURGH, riiiight... Not sure it's a very good constraint tbh...

>> src/hotspot/share/opto/divnode.cpp line 899:
>> 
>>> 897:   }
>>> 898: 
>>> 899:   // Otherwise we give up all hope
>> 
>>> Lasciate ogne speranza, voi ch'intrate
>> 
>> But doesn't that apply to about 90% of C2?
>> 
>> (and is it on purpose you kept the comment here but not in the `I` version? 
>> Not sure it is very useful, but it doesn't hurt to remind that's just the 
>> ultimate fallback)
>
> Removed it.

:(

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

PR Review Comment: https://git.openjdk.org/jdk/pull/31033#discussion_r3970018482
PR Review Comment: https://git.openjdk.org/jdk/pull/31033#discussion_r3970040796
PR Review Comment: https://git.openjdk.org/jdk/pull/31033#discussion_r3970023029

Reply via email to