RFR: 8203352: Improve java implementation of Integer/Long.numberOfLeadingZeros
Claes Redestad
claes.redestad at oracle.com
Fri May 18 10:51:45 UTC 2018
Hi,
while there are C2 intrinsics on most platforms providing access to
specialized hardware instructions, e.g., lzcnt on Intel, optimizing the
java implementations of Integer/Long.numberOfLeadingZeros can still be
worthwhile, especially if it also helps C1 and implicitly
startup/warmup. This implementation wins slightly (5-25%) over the
baseline in all tested optimization modes (-Xint,
-XX:TieredStopAtLevel=1-3), as well as on C2 if the intrinsics are disabled.
Webrev: http://cr.openjdk.java.net/~redestad/8203352/open.00/
Bug: https://bugs.openjdk.java.net/browse/JDK-8203352
Correctness is checked by existing tests, mainly
test/jdk/java/lang/Integer|Long/BitTwiddle.java
/Claes
More information about the core-libs-dev
mailing list