RFR: 8311847: Fix -Wconversion for assembler.hpp emit_int8,16 callers
Coleen Phillimore
coleenp at openjdk.org
Tue Jul 11 12:59:11 UTC 2023
On Tue, 11 Jul 2023 02:31:00 GMT, Dean Long <dlong at openjdk.org> wrote:
>> src/hotspot/cpu/aarch64/assembler_aarch64.hpp line 268:
>>
>>> 266: unsigned mask = checked_cast<unsigned>(right_n_bits(nbits));
>>> 267: uval &= mask;
>>> 268: f(checked_cast<unsigned>(uval), lsb + nbits - 1, lsb);
>>
>> Suggestion:
>>
>> f(uval, lsb + nbits - 1, lsb);
>
> See my comment below about not trusting checked_cast to do the right thing for int64_t --> unsigned.
This one seems to mask off the top half so the checked_cast<> will succeed, ie just change the type.
>> src/hotspot/share/asm/assembler.hpp line 305:
>>
>>> 303:
>>> 304:
>>> 305: public:
>>
>> I don't think we need this. See below.
>
> Nevermind, I tried my alternative idea below and it didn't work. For these particular cases where we only care about going to uint8_t, we could check is8bit(). Another trick I've seen is checking if (val >> width) is 0 or -1.
There is an is8bit() test that precedes these casts.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/14822#discussion_r1259682275
PR Review Comment: https://git.openjdk.org/jdk/pull/14822#discussion_r1259684184
More information about the hotspot-compiler-dev
mailing list