Tests for lzcnt
Trevor Watson
trevor.d.watson at oracle.com
Tue Nov 1 17:16:09 UTC 2016
I'm working on https://bugs.openjdk.java.net/browse/JDK-8162865, which
implements the inlining of LZCNT instructions on SPARC platforms which
support it.
I have the code implemented and have written a test-case that validates
the values returned by Long.countLeadingZeros() and
Integer.countLeadingZeros().
Looking through the hotspot tests, I see there is some testing of lzcnt
in compiler/intrinsics/bmi. I've adapted TestLzcntI.java and
TestLzcntL.java to check for the relevant SPARC feature as well as the
x86/x64 feature. These tests work fine, but only validate that C2
generates the same results as interpreted code for a selection of random
values. Whilst that is perfectly valid, I'd like to also be able to
verify that the inlined code for the lz count for each power of 2 in an
Integer and Long produces correct values (per my standalone test).
Would the "bmi" directory be the appropriate place to add a new test
like this or even hold a test which supports both x86/x64 and SPARC
given that "bmi" appears to refer to some kind of x86/x64 cpu feature
set? Or am I reading too much into "bmi" and its just used here as a
generic name?
I hope that made sense.
Thanks,
Trevor
More information about the hotspot-dev
mailing list