RFR: 8374489: Template Library: need to tag Float16.float16ToRawShortBits as having non-deterministic result because of multiple NaN bit patterns
Christian Hagedorn
chagedorn at openjdk.org
Mon Jan 5 13:54:19 UTC 2026
On Mon, 5 Jan 2026 11:55:01 GMT, Emanuel Peter <epeter at openjdk.org> wrote:
> 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.
Looks good and trivial!
-------------
Marked as reviewed by chagedorn (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/29033#pullrequestreview-3626921086
More information about the hotspot-compiler-dev
mailing list