RFR: 8345322: RISC-V: Add concurrent gtests for cmpxchg variants [v2]
Robbin Ehn
rehn at openjdk.org
Tue Dec 10 13:28:57 UTC 2024
On Tue, 10 Dec 2024 10:08:40 GMT, Fei Yang <fyang at openjdk.org> wrote:
>> The truncation is well defined, it's just signess overflow that is not spec.
>> As TESTSIZE may be 64 bits and we don't simply increase by one that check itself will overflow.
>>
>> Note that even if compiler do something else than wrap around, it would do the same in both cases so it should produce the same result.
>>
>> Also note that this cast is no worse than doing (signed char)0xff.
>>
>> Anyhow I tested trying to add max and min, the code just becomes very ugly and complicated.
>
>> The truncation is well defined, it's just signess overflow that is not spec. As TESTSIZE may be 64 bits and we don't simply increase by one that check itself will overflow.
>
> Ah, I was considering TESTSIZE int8_t or int16_t.
>
>> Note that even if compiler do something else than wrap around, it would do the same in both cases so it should produce the same result.
>
> That makes sense to me. Thanks.
>
>> Also note that this cast is no worse than doing (signed char)0xff.
>>
>> Anyhow I tested trying to add max and min, the code just becomes very ugly and complicated.
>
> All right then. Could you please add some code comment about what we are doing here to help understand?
I tried to fix it, let me know.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22574#discussion_r1878091425
More information about the hotspot-dev
mailing list