RFR: 8282764: AArch64: compiler/vectorapi/reshape/TestVectorCastNeon.java failed with incorrect result

Ningsheng Jian njian at openjdk.java.net
Thu Mar 17 04:40:10 UTC 2022


Vector API long to float conversion operation on NEON converts vector of 2 longs to 2 floats. In current implementation, we convert 2 longs to 2 doubles first and then converts 2 doubles to 2 floats. However, this two-steps conversion may have two roundings, while the expected behavior, conversion from long to float directly, has only one rounding. This will result in inconsistent result. E.g. for the failure test case:


jshell> long l = 0x561a524000000001L;
l ==> 6204361871487664129

jshell> float l2f = (float)l;
l2f ==> 6.2043621E18

jshell> float l2d2f = (float)((double)l);
l2d2f ==> 6.2043616E18


Since we don't have NEON instruction to support vector long to float conversion, we fix the codegen by doing it in scalar operation one element by one element.

TEST: vector api jtreg tests passed.

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

Commit messages:
 - 8282764: AArch64: compiler/vectorapi/reshape/TestVectorCastNeon.java failed with incorrect result

Changes: https://git.openjdk.java.net/jdk/pull/7850/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=7850&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8282764
  Stats: 49 lines in 12 files changed: 24 ins; 0 del; 25 mod
  Patch: https://git.openjdk.java.net/jdk/pull/7850.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/7850/head:pull/7850

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


More information about the hotspot-compiler-dev mailing list