RFR: 8276151: AArch64: Incorrect result for double to int vector conversion [v2]

Ningsheng Jian njian at openjdk.java.net
Thu Nov 4 09:56:40 UTC 2021


> Current NEON vector double to integer conversion generates code to convert double to long first and then narrow to integer, which does not follow Java language spec [1], and will get incorrect results for double values larger than Integer.MAX_VALUE or less than Integer.MIN_VALUE. For those too large/small values, result should be the largest/smallest representable value of type int, but converting to long and then narrowing to int will get different results.
> 
> There's no direct double to int vector conversion NEON instruction, so we simply do it with scalar conversion.
> 
> Also update compiler/vectorapi test cases to cover some corner cases.
> 
> [1] https://docs.oracle.com/javase/specs/jls/se17/html/jls-5.html#jls-5.1.3

Ningsheng Jian has updated the pull request incrementally with one additional commit since the last revision:

  Address review comments from Andrew.

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/6247/files
  - new: https://git.openjdk.java.net/jdk/pull/6247/files/0950e686..46b60e2b

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=6247&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=6247&range=00-01

  Stats: 4 lines in 2 files changed: 2 ins; 0 del; 2 mod
  Patch: https://git.openjdk.java.net/jdk/pull/6247.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/6247/head:pull/6247

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


More information about the hotspot-compiler-dev mailing list