Integrated: 8276151: AArch64: Incorrect result for double to int vector conversion

Ningsheng Jian njian at openjdk.java.net
Fri Nov 5 07:49:16 UTC 2021


On Thu, 4 Nov 2021 07:19:55 GMT, Ningsheng Jian <njian at openjdk.org> wrote:

> 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

This pull request has now been integrated.

Changeset: 96c396b7
Author:    Ningsheng Jian <njian at openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/96c396b701e290fc3e1124b1c862b41e02e9c1d9
Stats:     171 lines in 4 files changed: 141 ins; 1 del; 29 mod

8276151: AArch64: Incorrect result for double to int vector conversion

Reviewed-by: aph, psandoz

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

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


More information about the hotspot-compiler-dev mailing list