Test case:
public static void shiftL(int[] a, int b, int[] c) {
for (int i = 0; i < a.length; i++) {
c[i] = (int)(a[i] << b);
}
}
public static void aShiftR(int[] a, int b, int[] c) {
for (int i = 0; i < a.length; i++) {
c[i] = (int)(a[i] >> b);
}
}
public static void shiftR(int[] a, int b, int[] c) {
for (int i = 0; i < a.length; i++) {
c[i] = (int)(a[i] >>> b);
}
}
Java option:
-XX:MaxVectorSize=8
error log:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x0000ffffae170980, pid=30399, tid=30410
#
# JRE version: OpenJDK Runtime Environment (12.0) (fastdebug build 12-internal+0-adhoc.yanzha01.jdksrc)
# Java VM: OpenJDK 64-Bit Server VM (fastdebug 12-internal+0-adhoc.yanzha01.jdksrc, compiled mode, sharing, compressed oops, g1 gc, linux-aarch64)
# Problematic frame:
# V [libjvm.so+0x2fd980] MachNode::ideal_reg() const+0x38
#
# Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport %p %s %c %d %P" (or dumping to /home/yanzha01/jdk/test/samples/java/vectorization/core.30399)
#
# An error report file with more information is saved as:
# /home/yanzha01/jdk/test/samples/java/vectorization/hs_err_pid30399.log
#
# Compiler replay data is saved as:
# /home/yanzha01/jdk/test/samples/java/vectorization/replay_pid30399.log
#
# If you would like to submit a bug report, please visit:
# http://bugreport.java.com/bugreport/crash.jsp
#
Root cause:
Current vshiftcntL/R instructions didn't support 64-bit vector.