RFR: 8278114: New addnode ideal optimization: converting "x + x" into "x << 1" [v3]
Zhiqiang Zang
duke at openjdk.java.net
Sat Dec 18 07:23:20 UTC 2021
On Sat, 18 Dec 2021 03:43:08 GMT, Claes Redestad <redestad at openjdk.org> wrote:
> No other code changes, just added in those two simplified benchmarks and commented out the existing ones. I did tweak the command line to print using `ns` (you can change the annotation to get the same result) and picked the smallest number of iterations that still gave stable results on my machine while trying things out: `-i 15 -wi 15 -tu ns`.
Is there special configuration you were using? I was not able to reproduce the similar results.
This is when I used 20 iterations.
Baseline:
Benchmark Mode Cnt Score Error Units
AddIdeal_XPlusX_LShiftC.testInt avgt 60 3.846 ? 0.164 ns/op
AddIdeal_XPlusX_LShiftC.testLong avgt 60 3.332 ? 0.008 ns/op
Patch:
Benchmark Mode Cnt Score Error Units
AddIdeal_XPlusX_LShiftC.testInt avgt 60 3.743 ? 0.245 ns/op
AddIdeal_XPlusX_LShiftC.testLong avgt 60 3.664 ? 0.224 ns/op
Then I tried 100 interations to reduce noise.
Baseline:
Benchmark Mode Cnt Score Error Units
AddIdeal_XPlusX_LShiftC.testInt avgt 300 3.566 ? 0.068 ns/op
AddIdeal_XPlusX_LShiftC.testLong avgt 300 3.310 ? 0.004 ns/op
Patch:
Benchmark Mode Cnt Score Error Units
AddIdeal_XPlusX_LShiftC.testInt avgt 300 3.724 ? 0.103 ns/op
AddIdeal_XPlusX_LShiftC.testLong avgt 300 3.605 ? 0.086 ns/op
I were not able to print assembly by `-prof perfasm` on my end because of some errors from `perf` which I do not have permission to configure, but I checked native coverage and it showed this transformation did happen when the microbenchmark was running.
-------------
PR: https://git.openjdk.java.net/jdk/pull/6675
More information about the hotspot-compiler-dev
mailing list