RFR(S): 8210152: Optimize integer divisible by power-of-2 check
Pengfei Li
Pengfei.Li at arm.com
Wed Aug 29 10:21:12 UTC 2018
Hi,
Please help review this C2 compiler patch that optimize the integer divisible by 2^n (power-of-2) check.
In original integer divisible by 2^n check, C2 compiler generates conditional negation instructions before the zero check. But actually the conditional negation is redundant since the negation of a zero (non-zero) is also a zero (non-zero). This patch adds an ideal transformation that change the IR pattern "bool eq/ne (cmp (phi (X -X) 0))" into "bool eq/ne (cmp X 0)". With this optimization, the divisible by 2^n check can be done with only 1 or 2 machine instructions.
JBS: https://bugs.openjdk.java.net/browse/JDK-8210152
webrev: http://cr.openjdk.java.net/~zyao/8210152/webrev.00/
I've run jtreg full tests with this patch on an x86_64 and an aarch64 server respectively. No new failures were found.
--
Thanks,
Pengfei
More information about the hotspot-compiler-dev
mailing list