RFR: 8265491: Math Signum optimization for x86 [v7]
Jie Fu
jiefu at openjdk.java.net
Sat Apr 24 00:11:28 UTC 2021
On Fri, 23 Apr 2021 17:24:53 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>
>
> Marcus G K Williams has updated the pull request incrementally with two additional commits since the last revision:
>
> - Update DamonFool
>
> Signed-off-by: Marcus G K Williams <marcus.williams at intel.com>
> - Refactor on suggestion of jatin-bhateja & theRealAph
>
> Signed-off-by: Marcus G K Williams <marcus.williams at intel.com>
test/hotspot/jtreg/compiler/intrinsics/math/TestSignumIntrinsic.java line 2:
> 1: /*
> 2: * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
This is incorrect since it's not a new file.
I suggest this kind of change
diff --git a/test/hotspot/jtreg/compiler/intrinsics/math/TestSignumIntrinsic.java b/test/hotspot/jtreg/compiler/intrinsics/math/TestSignumIntrinsic.java
index 86434d556bb..37aa511dcff 100644
--- a/test/hotspot/jtreg/compiler/intrinsics/math/TestSignumIntrinsic.java
+++ b/test/hotspot/jtreg/compiler/intrinsics/math/TestSignumIntrinsic.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, BELLSOFT. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
-------------
PR: https://git.openjdk.java.net/jdk/pull/3581
More information about the hotspot-dev
mailing list