RFR: 8313779: RISC-V: use andn / orn in the MD5 instrinsic

Antonios Printezis tonyp at openjdk.org
Fri Aug 4 13:17:34 UTC 2023


Small improvement of the MD5 intrinsic when the Zbb extension is available. Performance comparison (with thanks again to @robehn for this!):

before:


MessageDigests.digest                   md5        64     DEFAULT  avgt    6    1835.246 ±  252.071  ns/op
MessageDigests.digest                   md5     16384     DEFAULT  avgt    6  145386.522 ±  444.446  ns/op
MessageDigests.getAndDigest             md5        64     DEFAULT  avgt    6    2555.515 ±  639.491  ns/op
MessageDigests.getAndDigest             md5     16384     DEFAULT  avgt    6  149045.631 ± 6658.545  ns/op


after:


MessageDigests.digest                   md5        64     DEFAULT  avgt    6    1779.637 ±  207.869  ns/op
MessageDigests.digest                   md5     16384     DEFAULT  avgt    6  137147.179 ±  706.396  ns/op
MessageDigests.getAndDigest             md5        64     DEFAULT  avgt    6    2645.354 ± 1245.318  ns/op
MessageDigests.getAndDigest             md5     16384     DEFAULT  avgt    6  141306.966 ± 7000.576  ns/op


(only line 3 is not an improvement, but it has higher variation)

It seems to save around 5% of executed instructions.

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

Commit messages:
 - 8313779: RISC-V: use andn / orn in the MD5 instrinsic

Changes: https://git.openjdk.org/jdk/pull/15156/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=15156&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8313779
  Stats: 34 lines in 3 files changed: 26 ins; 3 del; 5 mod
  Patch: https://git.openjdk.org/jdk/pull/15156.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/15156/head:pull/15156

PR: https://git.openjdk.org/jdk/pull/15156


More information about the hotspot-dev mailing list