[aarch64-port-dev ] [16] RFR(S): 8251525: AARCH64: Faster Math.signum(fp)

Andrew Dinn adinn at redhat.com
Mon Aug 17 08:52:56 UTC 2020

On 13/08/2020 12:04, Dmitry Chuyko wrote:
> Please review a faster version of Math.signum() for AArch64.
> Two new intrinsics (double and float) are introduced in general code,
> with appropriate new nodes. New JTreg test is added to cover the
> intrinsic case (enabled only for aarch64).
> AArch64 implementation uses FACGT (compare abslute fp values) and BSL
> (fp bit selection) to avoid branches and moves to non-fp registers and
> back.
> Performance results show ~30% better time in the benchmark with a black
> hole [1] on Cortex. E.g. on random numbers 4.8 ns/op --> 3.5 ns/op,
> overhead is 2.9 ns/op.
> rfe: https://bugs.openjdk.java.net/browse/JDK-8251525
> webrev: http://cr.openjdk.java.net/~dchuyko/8251525/webrev.00/
> testing: jck, jtreg including new dedicated test
The arrays float_cases and double_cases in that dedicated test
(TestSignumIntrinsic) include some rather randomly picked float literals
with either exponent or a large exponent. They do not include a denormal
float literal (excluding the obvious corner cases
Float/Double.MIN_VALUE). At least one sample value from the denormal
range ought to be included even though (indeed, precisely because) it
ought to be of no consequence for the algorithm being used.


Andrew Dinn
Red Hat Distinguished Engineer
Red Hat UK Ltd
Registered in England and Wales under Company Registration No. 03798903
Directors: Michael Cunningham, Michael ("Mike") O'Neill

More information about the aarch64-port-dev mailing list