On Thu, 3 Sep 2026 06:40:00 GMT, Dean Long <[email protected]> wrote:

>> src/hotspot/share/opto/macro.cpp line 3197:
>> 
>>> 3195:     Node* overflow_cmp = _igvn.transform(new CmpULNode(is_add ? 
>>> new_lo : addsub->lo1(), addsub->lo2()));
>>> 3196:     Node* overflow_bol = _igvn.transform(new BoolNode(overflow_cmp, 
>>> BoolTest::lt));
>>> 3197:     Node* overflow_int = _igvn.transform(new CMoveLNode(overflow_bol, 
>>> _igvn.longcon(0), _igvn.longcon(1), TypeLong::LONG));
>> 
>> Isn't cmove the best choice only when the condition is unpredictable?  
>> Overflow should be rare, so a predicted branch seems better.
>
> On second thought, if the values are sufficiently large, and not just 128-bit 
> versions of 32- and 64-bit numbers, then I guess overflow could be 
> unpredictable.  But maybe we shouldn't assume that but instead let profiling 
> decide.

That's true, but this is only the fall back implementation, so correctness and 
ease of implementation are more important. We will implement back-end support 
for these nodes later.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/31008#discussion_r3921933059

Reply via email to