RFR: 8336245: AArch64: remove extra register copy when converting from long to pointer
Andrew Dinn
adinn at openjdk.org
Thu Jul 25 10:50:31 UTC 2024
On Thu, 25 Jul 2024 09:53:45 GMT, Andrew Haley <aph at openjdk.org> wrote:
>> src/hotspot/cpu/aarch64/aarch64.ad line 4235:
>>
>>> 4233: operand immLOffset()
>>> 4234: %{
>>> 4235: predicate(n->get_long() >= -256 && n->get_long() <= 65520);
>>
>> Why is this using hard wired constants rather than using Address::offset_ok_for_immed?
>>
>> Also, why is the constant value 65520?
>
> I think `Address::offset_ok_for_immed` is too restrictive: we want a predicate that is the superset of all possible address offsets.
>
>
> jshell> ((1<<12)-1) <<4
> $3 ==> 65520
Yes, I realise that this is 16 less than 65536. However, there are two things I don't follow.
In the original code immLoffset was only used to define indOffLN i.e. a long offset used with a narrow pointer. The use of Address::offset_ok_for_immed(n->get_long(), 0) in the predicate limited narrow pointer offsets to -256 <= offset <= (2^12 - 1). With this change the top end of the range is now (2^12 - 1) << 4. I am wondering why that is appropriate?
The change allows immLOffset to be used in the definition of indOffX2P. I am not clear why indOffX2P is not just defined using the existing operand immLoffset16 which has as its predicate Address::offset_ok_for_immed(n->get_long(), 4). The only difference I can see is that the alternative predicate used here will accept a positive offset that is not 16 byte aligned. Is that the intention of the redefinition? Again, why is that appropriate?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20157#discussion_r1691242965
More information about the hotspot-dev
mailing list