-
Bug
-
Resolution: Fixed
-
P2
-
16, 17
-
b13
-
aarch64
-
generic
-
Verified
In vectorAPI, when right-shifting a vector with a shift equals to the element width, the shift is zero in fact, see src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorOperators.java:
/** Produce {@code a>>>(n&(ESIZE*8-1))}. Integral only. */
public static final /*bitwise*/ Binary LSHR = binary("LSHR", ">>>", VectorSupport.VECTOR_OP_URSHIFT, VO_SHIFT);
For the JAVA code below on aarch64, assembler call `__ ushr(dst, __ T8B, src, 0)` to generate the instruction.
While the instruction is actually encoed into `ushr dst.4H, src.4H, 16` in fact, which produces wrong results.
ByteVector vba = ByteVector.fromArray(byte64SPECIES, bytesA, 8 * i);
vbb.lanewise(VectorOperators.ASHR, 8).intoArray(arrBytes, 8 * i);
According to local tests for this case, JDK gives wrong results for byte/short and crashes with SIGILL for integer/long.
The legal right shift amount should be in the range 1 to the element width in bits on aarch64:
https://developer.arm.com/documentation/dui0801/f/A64-SIMD-Vector-Instructions/USHR--vector-?lang=en
/** Produce {@code a>>>(n&(ESIZE*8-1))}. Integral only. */
public static final /*bitwise*/ Binary LSHR = binary("LSHR", ">>>", VectorSupport.VECTOR_OP_URSHIFT, VO_SHIFT);
For the JAVA code below on aarch64, assembler call `__ ushr(dst, __ T8B, src, 0)` to generate the instruction.
While the instruction is actually encoed into `ushr dst.4H, src.4H, 16` in fact, which produces wrong results.
ByteVector vba = ByteVector.fromArray(byte64SPECIES, bytesA, 8 * i);
vbb.lanewise(VectorOperators.ASHR, 8).intoArray(arrBytes, 8 * i);
According to local tests for this case, JDK gives wrong results for byte/short and crashes with SIGILL for integer/long.
The legal right shift amount should be in the range 1 to the element width in bits on aarch64:
https://developer.arm.com/documentation/dui0801/f/A64-SIMD-Vector-Instructions/USHR--vector-?lang=en
- relates to
-
JDK-8263017 Read barriers are missing in nmethod printing code
-
- Resolved
-