RFR: 8291550: RISC-V: jdk uses misaligned memory access when AvoidUnalignedAccess enabled [v5]

Vladimir Kempik vkempik at openjdk.org
Thu May 4 05:55:18 UTC 2023


On Thu, 4 May 2023 03:28:31 GMT, Fei Yang <fyang at openjdk.org> wrote:

>> Vladimir Kempik has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   simpify branching in branch opcodes
>
> src/hotspot/cpu/riscv/templateTable_riscv.cpp line 292:
> 
>> 290:   }
>> 291:   __ revb_w_w(x10, x10);
>> 292:   __ sraiw(x10, x10, 16);
> 
> I think we can further simplify this sequence (L283-L292) into something like:
> 
> if (AvoidUnalignedAccesses) {
>   __ load_signed_byte(x10, at_bcp(1));
>   __ load_unsigned_byte(t1, at_bcp(2));
>   __ slli(x10, x10, 8);
>   __ add(x10, x10, t1);
> } else {
>   __ load_unsigned_short(x10, at_bcp(1));
>   __ revb_h_h(x10, x10); // reverse bytes in half-word and sign-extend
> }

why have you replaced revb_w_w with revb_h_h ?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13645#discussion_r1184568250


More information about the hotspot-dev mailing list