RFR[S]:8241874 [PPC64] Improve performance of Long.reverseBytes() and Integer.reverseBytes() on Power9

Corey Ashford cjashfor at linux.ibm.com
Mon Mar 30 22:49:50 UTC 2020


Hello,

This is my first OpenJDK patch for review.  It increases the performance 
of byte reversal for Integer.reverseBytes() and Long.reverseBytes() on 
Power9 via its VSX xxbrw and xxbrd vector instructions.

https://bugs.openjdk.java.net/browse/JDK-8241874
http://cr.openjdk.java.net/~gromero/8241874/v1/

I have tested on Power9 and see a 38%+ performance improvement on 
Long.reverseBytes() and 15%+ on Integer.reverseBytes().  (I add the + 
because the benchmark code has a fair amount of fixed overhead). 
Testing on Power8 reveals no regressions.

I believe the patch itself is pretty self-explanatory.  It adds 
definitions for four instructions that are needed to get the data in and 
out of the vector registers, and to perform the reversal operation, and 
it adds the instructs to use them.  Also VM_Version::initialize() 
autodetects that the instructions are available, and warns for trying to 
set the UseVectorByteReverseInstructionsPPC64 flag on earlier Power 
processors that don't possess these PowerISA 3.0 instructions.

Thanks to Michihiro Horie, Jose Ricardo Ziviani, and Gustav Romero for 
their help!

Please review this patch.

Thanks for your consideration,

Corey Ashford


More information about the hotspot-compiler-dev mailing list