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
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
- relates to
-
JDK-8268883 C2: assert(false) failed: unscheduable graph
- Closed
-
JDK-8270307 C2: assert(false) failed: bad AD file after JDK-8267687
- Closed
-
JDK-8288204 GVN Crash: assert() failed: correct memory chain
- Resolved