FW: RFR: 8263058: Optimize vector shift with zero shift count

Eric Liu eric.c.liu at arm.com
Wed Mar 10 11:30:55 UTC 2021



-----Original Message-----
From: hotspot-dev <hotspot-dev-retn at openjdk.java.net> On Behalf Of Eric Liu
Sent: Wednesday, March 10, 2021 6:50 PM
To: hotspot-dev at openjdk.java.net
Subject: RFR: 8263058: Optimize vector shift with zero shift count

Like scalar shift, vector shift could do nothing when shift count is zero.

This patch implements the 'Identity' method for all kinds of vector shift nodes to optimize out 'ShiftVCntNode 0', which is typically a redundant 'mov' in final generated code like below:

        add     x17, x12, x14
        ldr     q16, [x17, #16]
        mov     v16.16b, v16.16b
        add     x14, x13, x14
        str     q16, [x14, #16]

With this patch, the code above could be optimized as below:

        add     x17, x12, x14
        ldr     q16, [x17, #16]
        add     x14, x13, x14
        str     q16, [x14, #16]

[TESTS]
compiler/vectorapi/TestVectorShiftImm.java, jdk/incubator/vector,
hotspot::tier1 passed without new failure.

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

Commit messages:
 - 8263058: Optimize vector shift with zero shift count

Changes: https://git.openjdk.java.net/jdk/pull/2911/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=2911&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8263058
  Stats: 73 lines in 4 files changed: 21 ins; 26 del; 26 mod
  Patch: https://git.openjdk.java.net/jdk/pull/2911.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/2911/head:pull/2911

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


More information about the hotspot-compiler-dev mailing list