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

ModXNode::Ideal optimization is better than Parse::do_irem

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 17
    • 17
    • hotspot
    • b26

      For x%y, both Parse::do_irem and ModXNode::ideal are optimized for case that divisor y is 2^n constant value. It turns out that ModXNode::Ideal optimization is better than Parse::do_irem in microbenchmark:

      x64
      ------------
      ModXNode::Ideal opt:
      Benchmark Mode Cnt Score Error Units
      ModPowerOf2.testNegativePowerOf2 avgt 25 8746.608 ± 139.777 ns/op
      ModPowerOf2.testPositivePowerOf2 avgt 25 8735.545 ± 86.145 ns/op

      Parse::do_irem opt:
      Benchmark Mode Cnt Score Error Units
      ModPowerOf2.testNegativePowerOf2 avgt 25 8693.797 ± 7.844 ns/op
      ModPowerOf2.testPositivePowerOf2 avgt 25 6618.652 ± 1.739 ns/op

      AArch64
      ------------
      ModXNode::Ideal opt:
      Benchmark Mode Cnt Score Error Units
      ModPowerOf2.testNegativePowerOf2 avgt 25 6758.299 ± 4.452 ns/op
      ModPowerOf2.testPositivePowerOf2 avgt 25 6759.533 ± 2.791 ns/op

      Parse::do_irem opt:
      Benchmark Mode Cnt Score Error Units
      ModPowerOf2.testNegativePowerOf2 avgt 25 6757.868 ± 4.044 ns/op
      ModPowerOf2.testPositivePowerOf2 avgt 25 6546.034 ± 0.794 ns/op

        1. assembly_ideal_opt_aarch64.log
          1 kB
        2. assembly_ideal_opt.log
          2 kB
        3. assembly_parse_opt_aarch64.log
          2 kB
        4. assembly_parse_opt.log
          2 kB
        5. bench_aarch64.log
          13 kB
        6. bench.log
          13 kB

            yyang Yi Yang
            yyang Yi Yang
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: