RFR: 8319184: RISC-V: improve MD5 intrinsic

Antonios Printezis tonyp at openjdk.org
Wed Nov 1 15:13:34 UTC 2023


On Wed, 1 Nov 2023 15:05:09 GMT, Antonios Printezis <tonyp at openjdk.org> wrote:

> Tweaks to the RISC-V MD5 intrinsic.
> 
> * do the loads from the buffer more incrementally instead of all in one go
> * don't mask off the top 32 bits of a register before an addw instruction, as addw will ignore them anyway
> * remove the rmask32 register, as the mask is not needed any more (only at the start / end and it's 
> * cleanup some of the register usage

Performance testing on my VisionFive 2 shows a mild improvement, usually between 1.5%-2%. Here are the jmicro results:

before (with +UseZbb):


Benchmark                    (digesterName)  (length)  (provider)  Mode  Cnt       Score    Error  Units
MessageDigests.digest                   md5        64     DEFAULT  avgt  300    1687.068 ?  2.670  ns/op
MessageDigests.digest                   md5     16384     DEFAULT  avgt  300  136355.127 ? 16.621  ns/op
MessageDigests.getAndDigest             md5        64     DEFAULT  avgt  300    2402.758 ?  3.744  ns/op
MessageDigests.getAndDigest             md5     16384     DEFAULT  avgt  300  138048.866 ? 24.224  ns/op


after (with +UseZbb):


Benchmark                    (digesterName)  (length)  (provider)  Mode  Cnt       Score    Error  Units
MessageDigests.digest                   md5        64     DEFAULT  avgt  300    1678.336 ?  1.056  ns/op
MessageDigests.digest                   md5     16384     DEFAULT  avgt  300  134529.688 ? 14.527  ns/op
MessageDigests.getAndDigest             md5        64     DEFAULT  avgt  300    2384.615 ?  4.325  ns/op
MessageDigests.getAndDigest             md5     16384     DEFAULT  avgt  300  136159.783 ? 23.986  ns/op

Correctness testing:


test/jdk/java/security/MessageDigest
test/hotspot/jtreg/compiler/intrinsics/sha/sanity


on both a VisionFive 2 and qemu, with both -UseZbb and +UseZbb.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/16453#issuecomment-1789122575
PR Comment: https://git.openjdk.org/jdk/pull/16453#issuecomment-1789124436


More information about the hotspot-compiler-dev mailing list