RFR: 8318158: RISC-V: implement roundD/roundF intrinsics
Olga Mikhaltsova
omikhaltcova at openjdk.org
Fri Oct 27 11:42:40 UTC 2023
Please, review this Implementation of the roundD/roundF intrinsics for RISC-V platform.
As shown below the output for RISC-V instructions and Java methods differs only for NaN argument.
RISC-V Java
(FCVT.W.S) (FCVT.L.D) (long round(double a)) (int round(float a))
Minimum valid input (after rounding) −2^31 −2^63 Long.MIN_VALUE Integer.MIN_VALUE
Maximum valid input (after rounding) 2^31 − 1 2^63 − 1 Long.MAX_VALUE Integer.MAX_VALUE
Output for out-of-range negative input −2^31 −2^63 Long.MIN_VALUE Integer.MIN_VALUE
Output for −∞ −2^31 −2^63 Long.MIN_VALUE Integer.MIN_VALUE
Output for out-of-range positive input 2^31 − 1 2^63 - 1 Long.MAX_VALUE Integer.MAX_VALUE
Output for +∞ 2^31 − 1 2^63 - 1 Long.MAX_VALUE Integer.MAX_VALUE
Output for NaN 2^31 − 1 2^63 - 1 0 0
The benchmark shows the following performance improvement:
**Before**
Benchmark (TESTSIZE) Mode Cnt Score Error Units
FpRoundingBenchmark.test_round_double 2048 thrpt 15 4.675 ± 0.259 ops/ms
FpRoundingBenchmark.test_round_float 2048 thrpt 15 4.549 ± 0.210 ops/ms
**After**
Benchmark (TESTSIZE) Mode Cnt Score Error Units
FpRoundingBenchmark.test_round_double 2048 thrpt 15 10.483 ± 0.681 ops/ms
FpRoundingBenchmark.test_round_float 2048 thrpt 15 10.475 ± 0.480 ops/ms
Testing: tier1 tests successfully passed on a RISC-V HiFive board with Linux.
-------------
Commit messages:
- 8318158: RISC-V: implement roundD/roundF intrinsics
Changes: https://git.openjdk.org/jdk/pull/16382/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=16382&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8318158
Stats: 31 lines in 3 files changed: 25 ins; 0 del; 6 mod
Patch: https://git.openjdk.org/jdk/pull/16382.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/16382/head:pull/16382
PR: https://git.openjdk.org/jdk/pull/16382
More information about the hotspot-dev
mailing list