RFR: 8276151: AArch64: Incorrect result for double to int vector conversion [v2]
Paul Sandoz
psandoz at openjdk.java.net
Thu Nov 4 16:50:13 UTC 2021
On Thu, 4 Nov 2021 09:56:40 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
>
> Ningsheng Jian has updated the pull request incrementally with one additional commit since the last revision:
>
> Address review comments from Andrew.
Java changes look good.
What are your thoughts about applying the changes to all `VectorCastShape*Test.java`? Since I presume this could also impact ARM SVE and other architectures.
The duplication could be removed by placing the repeated code in a super class. This could be a follow on update if needed after integration of https://github.com/openjdk/jdk/pull/5873.
-------------
Marked as reviewed by psandoz (Reviewer).
PR: https://git.openjdk.java.net/jdk/pull/6247
More information about the hotspot-compiler-dev
mailing list