RFR: 8260501: [Vector API] Improve register usage for shift operations on x86

Vladimir Ivanov vlivanov at openjdk.java.net
Wed Jan 27 21:45:39 UTC 2021


On Wed, 27 Jan 2021 11:52:54 GMT, Jie Fu <jiefu at openjdk.org> wrote:

> Hi all,
> 
> I found the register usage is less optimized for some shift operations.
> For example, vshiftL_imm [1]/vshiftI_imm require dst != src.
> But it's actually fine for the register allocator to assign dst == src.
> 
> Also, vshiftL [2]/vshiftI/vshiftS require dst != src.
> But it's actually required for UseAVX==0 only.
> For the most common cases (UseAVX > 0), it's fine to assign dst == src.
> 
> The fix splits vshiftS/vshiftI/vshiftL into UseAVX > 0 and UseAVX == 0 cases.
> And just removes the unreasonable requirement for vshiftI_imm and vshiftL_imm. 
> 
> Testing:
>   - jdk/incubator/vector/ on x64 with UseAVX=3/2/1/0, no regression
> 
> Thanks.
> Best regards,
> Jie
> 
> [1] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/x86/x86.ad#L6058
> [2] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/x86/x86.ad#L6037

IIRC AD instructions for variable shifts were deliberately merged to reduce static footprint of the JVM on x86 (JVM library size). IMO it's preferable to leave them as they are.

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

PR: https://git.openjdk.java.net/jdk/pull/2257


More information about the hotspot-compiler-dev mailing list