Integrated: 8288933: Improve the implementation of Double/Float.isInfinite
Quan Anh Mai
duke at openjdk.org
Fri Sep 9 17:04:34 UTC 2022
On Wed, 22 Jun 2022 12:43:53 GMT, Quan Anh Mai <duke at openjdk.org> wrote:
> Improve the implementation of `Double/Float.isInfinite` to reduce branching. Using `>` comparison with `MAX_VALUE` instead of `==` with `POSITIVE_INFINITY` improves code emission on x86 and produces similar code for arm. This is also the way gcc implements `std::isinf` on x86 and arm (clang uses the pattern `Math.abs(v) == POSITIVE_INFINITY` on arm).
>
> `test/micro/org/openjdk/bench/java/lang/FPComparison.java` has been added in #8525, the results are reshown here:
>
> Benchmark Mode Cnt Score Error Score Error Unit Ratio
> FPComparison.isInfiniteDouble avgt 5 1232.800 ± 31.677 621.185 ± 11.935 ns/op 1.98
> FPComparison.isInfiniteFloat avgt 5 1234.708 ± 70.239 623.566 ± 15.206 ns/op 1.98
>
> Thank you very much.
This pull request has now been integrated.
Changeset: a14c3a49
Author: Quan Anh Mai <anhmdq99 at gmail.com>
Committer: Joe Darcy <darcy at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/a14c3a493a98792a61de253920bb177a5c35fd8e
Stats: 2 lines in 2 files changed: 0 ins; 0 del; 2 mod
8288933: Improve the implementation of Double/Float.isInfinite
Reviewed-by: redestad, darcy
-------------
PR: https://git.openjdk.org/jdk/pull/9238
More information about the core-libs-dev
mailing list