RFR: 8302976: C2 intrinsification of Float.floatToFloat16 and Float.float16ToFloat yields different result than the interpreter
Vladimir Kozlov
kvn at openjdk.org
Mon Mar 6 16:09:13 UTC 2023
Implemented `Float.floatToFloat16` and `Float.float16ToFloat` intrinsics in Interpreter and C1 compiler to produce the same results as C2 intrinsics on x64, Aarch64 and RISC-V - all platforms where C2 intrinsics for these Java methods were implemented originally.
Replaced `SharedRuntime::f2hf()` and `hf2f()` C runtime functions with calls to runtime stubs which use the same HW instructions as C2 intrinsics. Only for 64-bit x64 because 32-bit x86 stub does not work: result is passed through FPU register and NaN values become different from C2 intrinsic. This runtime stub is only used to calculate constant values during C2 compilation and can be skipped.
I added new tests based on Tobias's `TestAll.java` And copied `jdk/lang/Float/Binary16Conversion*.java` tests to run them with `-Xcomp` to make sure code is compiled by C1 or C2. I modified `Binary16ConversionNaN.java` to compare results from Interpreter, C1 and C2.
Tested tier1-5, Xcomp, stress
-------------
Commit messages:
- Remove ConvF2HFNode::Identity(). Updated tests
- Copyright year update
- Check float16 instructions support on platforms for C1
- Update Copyright year. Add missing UnlockDiagnosticVMOptions flag in new test
- Implement Aarch64 and RiscV parts, remove 32-bit x86 runtime stub
- Merge branch 'master' into 8302976
- 8302976: C2 intrinsification of Float.floatToFloat16 and Float.float16ToFloat yields different result than the interpreter
Changes: https://git.openjdk.org/jdk/pull/12869/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=12869&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8302976
Stats: 1432 lines in 48 files changed: 1284 ins; 97 del; 51 mod
Patch: https://git.openjdk.org/jdk/pull/12869.diff
Fetch: git fetch https://git.openjdk.org/jdk pull/12869/head:pull/12869
PR: https://git.openjdk.org/jdk/pull/12869
More information about the hotspot-compiler-dev
mailing list