Integrated: 8265491: Math Signum optimization for x86
Marcus G K Williams
github.com+168222+mgkwill at openjdk.java.net
Mon May 3 16:31:00 UTC 2021
On Mon, 19 Apr 2021 23:00:47 GMT, Marcus G K Williams <github.com+168222+mgkwill at openjdk.org> wrote:
> x86 Math.Signum() uses two floating point compares and a copy sign operation involving data movement to gpr and XMM.
>
> We can optimize to one floating point compare and sign computation in XMM. We observe ~25% performance improvement with this optimization.
>
> Base:
>
> Benchmark Mode Cnt Score Error Units
> Signum._1_signumFloatTest avgt 5 4.660 ? 0.040 ns/op
> Signum._2_overheadFloat avgt 5 3.314 ? 0.023 ns/op
> Signum._3_signumDoubleTest avgt 5 4.809 ? 0.043 ns/op
> Signum._4_overheadDouble avgt 5 3.313 ? 0.015 ns/op
>
>
> Optimized:
> signum intrinsic patch
>
> Benchmark Mode Cnt Score Error Units
> Signum._1_signumFloatTest avgt 5 3.769 ? 0.015 ns/op
> Signum._2_overheadFloat avgt 5 3.312 ? 0.025 ns/op
> Signum._3_signumDoubleTest avgt 5 3.765 ? 0.005 ns/op
> Signum._4_overheadDouble avgt 5 3.309 ? 0.010 ns/op
>
>
> Signed-off-by: Marcus G K Williams <marcus.williams at intel.com>
This pull request has now been integrated.
Changeset: ff65920c
Author: Marcus G K Williams <marcus.williams at intel.com>
Committer: Sandhya Viswanathan <sviswanathan at openjdk.org>
URL: https://git.openjdk.java.net/jdk/commit/ff65920cd17e7e862b182524e2151784e26a079c
Stats: 218 lines in 7 files changed: 212 ins; 1 del; 5 mod
8265491: Math Signum optimization for x86
Reviewed-by: jiefu, jbhateja, neliasso
-------------
PR: https://git.openjdk.java.net/jdk/pull/3581
More information about the hotspot-compiler-dev
mailing list