RFR: 8254872: Optimize Rotate on AArch64

Eric Liu github.com+10482586+erik1iu at openjdk.java.net
Fri Nov 13 10:39:03 UTC 2020


This patch is a supplement for
https://bugs.openjdk.java.net/browse/JDK-8248830.

With the implementation of rotate node in IR, this patch:

1. canonicalizes RotateLeft into RotateRight when shift is a constant,
   so that GVN could identify the pre-existing node better.
2. implements scalar rotate match rules and removes the original
   combinations of Or and Shifts on AArch64.

This patch doesn't implement vector rotate due to the lack of
corresponding vector instructions on AArch64.

Test case below is an explanation for this patch.

        public static int test(int i) {
            int a =  (i >>> 29) | (i << -29);
            int b = i << 3;
            int c = i >>> -3;
            int d = b | c;
            return a ^ d;
        }

Before:

        lsl     w12, w1, #3
        lsr     w10, w1, #29
        add     w11, w10, w12
        orr     w12, w12, w10
        eor     w0, w11, w12

After:

        ror     w10, w1, #29
        eor     w0, w10, w10

Tested jtreg TestRotate.java, hotspot::hotspot_all_no_apps,
jdk::jdk_core, langtools::tier1.

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

Commit messages:
 - 8254872: Optimize Rotate on AArch64

Changes: https://git.openjdk.java.net/jdk/pull/1199/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=1199&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8254872
  Stats: 199 lines in 4 files changed: 29 ins; 119 del; 51 mod
  Patch: https://git.openjdk.java.net/jdk/pull/1199.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/1199/head:pull/1199

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


More information about the hotspot-compiler-dev mailing list