Integrated: 8365911: AArch64: Fix encoding error in sve_cpy for negative floats

erifan duke at openjdk.org
Tue Sep 9 07:02:32 UTC 2025


On Wed, 27 Aug 2025 01:34:25 GMT, erifan <duke at openjdk.org> wrote:

> The sve_cpy instruction is not correctly implemented for negative floating-point values. The issues include:
> 
> 1. When a negative floating-point number (e.g. `-1.0`) is passed, the `checked_cast<int8_t>(pack(d))` check fails. For example, assume `d = -1.0`:
> - `pack(-1.0)` returns an unsigned int with the 7th bit set, i.e., `0xf0`.
> - `checked_cast<int8_t>(0xf0)` casts `0xf0` to an int8_t value, which is `-16`.
> - Casting this int8_t `-16` back to unsigned int results in `0xfffffff0`.
> - The check compares `0xf0` to `0xfffffff0`, which obviously fails.
> 
> 2. Additionally, the encoding of the negative floating-point number is incorrect:
> - The imm8 field can fall outside the valid range of **[-128, 127]**.
> - Bit **13** should be encoded as **0** for floating-point numbers.
> 
> This PR fixes these issues and renames floating-point `sve_cpy` as `sve_fcpy`.
> 
> Some test cases are added to aarch64-asmtest.py, and all tests passed.

This pull request has now been integrated.

Changeset: 680bf758
Author:    erifan <erfang at nvidia.com>
Committer: Emanuel Peter <epeter at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/680bf758980452511ea72224066358e5fd38f060
Stats:     136 lines in 3 files changed: 9 ins; 0 del; 127 mod

8365911: AArch64: Fix encoding error in sve_cpy for negative floats

Reviewed-by: aph, epeter

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

PR: https://git.openjdk.org/jdk/pull/26951


More information about the hotspot-compiler-dev mailing list