Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8241874

PPC64: Improve performance of Long.reverseBytes() and Integer.reverseBytes() on Power9

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 15
    • 15
    • hotspot
    • b20
    • ppc
    • linux

      In the Power9 instruction set, there are several instructions available for doing byte reversal within a
      VSX register. xxbrd can be used for reversing bytes in a 64-bit Long, and xxbrw can be used to reverse bytes in a 32-bit Integer.

      There is also an instruction for reversing 16-bit short types, but the cost overhead of using a VSX operation for this is prohibitive compared with the existing instruction sequence.

      These two instructions can be used to perform the byte reversal by moving the contents of the source general purpose register to a vector register, performing the reversal, and moving the vector register to the destination general purpose register.

      A simple benchmark shows an overall minimum of 38% performance improvement for Long.reverseBytes() and a 15% improvement for Integer.reverseBytes().

            mhorie Michihiro Horie
            gromero Gustavo Romero
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: