RFR: 8265491: Math Signum optimization for x86 [v3]

Marcus G K Williams github.com+168222+mgkwill at openjdk.java.net
Wed Apr 21 17:38:03 UTC 2021


> 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.782 ? 0.019 ns/op
> Signum._2_overheadFloat avgt 5 3.309 ? 0.011 ns/op
> Signum._3_signumDoubleTest avgt 5 3.782 ? 0.017 ns/op
> Signum._4_overheadDouble avgt 5 3.310 ? 0.006 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:

 - Remove requires os.arch from TestSignumIntrinsic
   
   Signed-off-by: Marcus G K Williams <marcus.williams at intel.com>
 - Add predicate to signum intrinsics
   
   Signed-off-by: Marcus G K Williams <marcus.williams at intel.com>

-------------

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/3581/files
  - new: https://git.openjdk.java.net/jdk/pull/3581/files/99a2971d..a6d670be

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=3581&range=02
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=3581&range=01-02

  Stats: 3 lines in 2 files changed: 2 ins; 1 del; 0 mod
  Patch: https://git.openjdk.java.net/jdk/pull/3581.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/3581/head:pull/3581

PR: https://git.openjdk.java.net/jdk/pull/3581


More information about the hotspot-compiler-dev mailing list