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

Math Signum optimization for x86

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 17
    • Fix Version/s: 17
    • Component/s: hotspot
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b21
    • CPU:
      x86

      Description

      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

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: