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

Math Signum optimization for x86

    XMLWordPrintable

Details

    • Enhancement
    • Status: Resolved
    • P4
    • Resolution: Fixed
    • 17
    • 17
    • hotspot
    • b21
    • 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

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

              Dates

                Created:
                Updated:
                Resolved: