Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8265491

Math Signum optimization for x86

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 17
    • 17
    • hotspot
    • b21
    • x86

      Math.Signum() currently uses two floating point compares and a copy sign operation which involves data movement to gpr and XMM.
      It can be optimized to use only 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._3_signumDoubleTest avgt 5 4.809 ? 0.043 ns/op
       
      Optimized:
      signum intrinsic patch
      Benchmark Mode Cnt Score Error Units
      Signum._1_signumFloatTest avgt 5 3.782 ? 0.019 ns/op
      Signum._3_signumDoubleTest avgt 5 3.782 ? 0.017 ns/op

            sviswanathan Sandhya Viswanathan
            sviswanathan Sandhya Viswanathan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: