RFR: 8374489: Template Library: need to tag Float16.float16ToRawShortBits as having non-deterministic result because of multiple NaN bit patterns
Emanuel Peter
epeter at openjdk.org
Mon Jan 5 12:38:27 UTC 2026
In [JDK-8370922](https://bugs.openjdk.org/browse/JDK-8370922), I added Float16 support to the Template Library. I missed to tag Float16.float16ToRawShortBits as having non-deterministic result.
We need to do that, just like for float and double equivalents:
Arithmetic operations (e.g. add, mul, fma, ...) are allowed to pick either input if it gets two NaNs of different bit patterns.
That way, those operations can generate different NaN bit patterns depending on if we use interpreter/C1/C2.
If we now convert to raw bits, we get different bits, and would wrongly conclude that we get a wrong result.
Since this is a test-bug, I have no regression test. But I verified it manually, that with the same seed (for the ExpressionFuzzer) that fails before this change, we now succeed after the change.
-------------
Commit messages:
- JDK-8374489
Changes: https://git.openjdk.org/jdk/pull/29033/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=29033&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8374489
Stats: 5 lines in 1 file changed: 2 ins; 1 del; 2 mod
Patch: https://git.openjdk.org/jdk/pull/29033.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/29033/head:pull/29033
PR: https://git.openjdk.org/jdk/pull/29033
More information about the hotspot-compiler-dev
mailing list