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

Questionable if-conversion involving SETNE

    Details

    • Type: Enhancement
    • Status: Open
    • Priority: P5
    • Resolution: Unresolved
    • Affects Version/s: 9, 10
    • Fix Version/s: tbd
    • Component/s: hotspot
    • Labels:

      Description

      Originally found here:
      http://stackoverflow.com/a/24899011/2613885

      The benchmark from http://cr.openjdk.java.net/~shade/8051725/ yields:

      o.o.IfSetneBench.test0 2.286 0.011 ns/op
      o.o.IfSetneBench.test1 1.010 0.003 ns/op
      o.o.IfSetneBench.test1neg 1.010 0.003 ns/op
      o.o.IfSetneBench.test42 1.011 0.005 ns/op
      o.o.IfSetneBench.test42neg 1.008 0.002 ns/op

      Notice test0 is slower than any other variant. This is because it indeed uses the weird SETNE optimization:
       http://cr.openjdk.java.net/~shade/8051725/test0.perfasm

      ...while other tests are doing the plain cmp:
       http://cr.openjdk.java.net/~shade/8051725/test1.perfasm

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              shade Aleksey Shipilev
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated: