RFR: 8313779: RISC-V: use andn / orn in the MD5 instrinsic [v2]
Fei Yang
fyang at openjdk.org
Sun Aug 6 02:41:30 UTC 2023
On Fri, 4 Aug 2023 15:15:06 GMT, Antonios Printezis <tonyp at openjdk.org> wrote:
>> 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.
>
> Antonios Printezis has updated the pull request incrementally with one additional commit since the last revision:
>
> changes based on code review feedback
Looks good.
BTW: I noticed that two `li` are used in your previous PR to implement MD5 intrinsic:
./stubGenerator_riscv.cpp: __ li(rtmp2, t);
./stubGenerator_riscv.cpp: __ li(rmask32, MASK_32);
I think It should be more consistent if you use 'mv' instead as we did in other places when moving an immediate into register.
template<typename T, ENABLE_IF(std::is_integral<T>::value)>
inline void mv(Register Rd, T o) { li(Rd, (int64_t)o); }
-------------
Marked as reviewed by fyang (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/15156#pullrequestreview-1564049901
More information about the hotspot-dev
mailing list