On Wed, 2 Sep 2026 09:11:51 GMT, Quan Anh Mai <[email protected]> wrote:

>> Hi,
>> 
>> This PR implements addition and subtraction of 128-bit integers in C2. This 
>> may have numerous applications:
>> 
>> - It helps intrinsification of operations on 128-bit integers when we have 
>> one.
>> - It allows computation that may be incorrect at `long` due to overflow, 
>> such as loop predication of long range checks.
>> 
>> By implementing this separately, we don't need to worry about finalizing a 
>> public API, and we can have a better testing coverage.
>> 
>> Testing:
>> 
>> - [x] tier1-4,hs-comp-stress
>> 
>> Please take a look and leave your review, thanks a lot.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Quan Anh Mai has updated the pull request with a new target base due to a 
> merge or a rebase. The pull request now contains six commits:
> 
>  - Merge branch 'master' into int128
>  - C++17
>  - Merge branch 'master' into int128
>  - Merge branch 'master' into int128
>  - whitespace
>  - Implement Int128T addsub

src/hotspot/share/opto/macro.cpp line 3195:

> 3193: 
> 3194:   if (Node* hi = addsub->result_hi_or_null(); hi != nullptr) {
> 3195:     Node* overflow_cmp = _igvn.transform(new CmpULNode(is_add ? new_lo 
> : addsub->lo1(), addsub->lo2()));

Some pseudo-code would help here.

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.

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

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

Reply via email to