RFR: 8344304: [s390x] ubsan: negation of -2147483648 cannot be represented in type 'int' [v2]

Amit Kumar amitkumar at openjdk.org
Tue Dec 3 06:59:40 UTC 2024


On Mon, 2 Dec 2024 23:54:34 GMT, Dean Long <dlong at openjdk.org> wrote:

>> Amit Kumar has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   cover lir_add as well
>
> src/hotspot/cpu/s390/c1_LIRAssembler_s390.cpp line 1540:
> 
>> 1538:                       } else {
>> 1539:                         __ z_afi(lreg, c);
>> 1540:                       }
> 
> It seems like it would be better to have code like this in a helper function, instead of making every call site repeat the pattern.  Can you use add2reg() here?

add2reg will emit `z_aghi` instruction which is for 64 bit (register) <- 16 bit (immediate). `z_ahi` and `z_afi` are both 
32 bit (register) < - 16 bit (immediate), 32 bit (register) <- 32 bit (immediate). So I guess these are better here. Though we can move the logic to new method add2reg_32() method which will do the check and emit correct instruction.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22456#discussion_r1867147830


More information about the hotspot-compiler-dev mailing list