RFR: 8344304: [s390x] ubsan: negation of -2147483648 cannot be represented in type 'int' [v4]
Lutz Schmidt
lucy at openjdk.org
Tue Dec 3 10:41:40 UTC 2024
On Mon, 2 Dec 2024 23:57:32 GMT, Dean Long <dlong at openjdk.org> wrote:
>> Not sure of that actually. I didn't even know that there exists such helper method. Thanks for making me aware.
>>
>> I updated current solution in accordance with GCC compiler. So Z don't have a `shi` instruction which can handle 16-bit numbers, so GCC negates the number and adds it with `ahi` instruction. Then for number upto 32bits, `slfi` instruction is emitted for subtraction.
>>
>> @RealLucy do you have other thoughts on this ?
>
> I agree,
> ` __ z_afi(lreg, java_negate(c));`
> reads better.
Couldn't you use add2reg_32() for the subtraction as well?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22456#discussion_r1867465911
More information about the hotspot-compiler-dev
mailing list