JDK-8267687 : ModXNode::Ideal optimization is better than Parse::do_irem
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 17
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2021-05-25
  • Updated: 2022-07-27
  • Resolved: 2021-06-04
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 17
17 b26Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
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
Comments
Changeset: 4e6748c5 Author: Yi Yang <yyang@openjdk.org> Date: 2021-06-04 23:29:35 +0000 URL: https://git.openjdk.java.net/jdk/commit/4e6748c543fae89b5f5f42bb0345b4b4f97d817a
04-06-2021