RFR: JDK-8216437 : PPC64: Add intrinsic for GHASH algorithm
Amit Kumar
amitkumar at openjdk.org
Mon Dec 23 05:41:36 UTC 2024
On Thu, 18 Jul 2024 14:31:57 GMT, Suchismith Roy <sroy at openjdk.org> wrote:
> JBS Issue : [JDK-8216437](https://bugs.openjdk.org/browse/JDK-8216437)
>
> Currently acceleration code for GHASH is missing for PPC64.
>
> The current implementation utlilises SIMD instructions on Power and uses Karatsuba multiplication for obtaining the final result.
src/hotspot/cpu/ppc/stubGenerator_ppc.cpp line 692:
> 690: // Load the vector from memory into vConstC2
> 691: __ vxor(vConstC2, vConstC2, vConstC2);
> 692: __ mtvrd(vConstC2, temp1);
is that `vxor` instruction really necessary? `mtvrd` will do overwrite any way. So why do we want to be sure that there is 0 in `vConstC2` ?
src/hotspot/cpu/ppc/stubGenerator_ppc.cpp line 711:
> 709: __ vsldoi(vLowerH, vZero, vSwappedH, 8); // H.L
> 710: __ vsldoi(vHigherH, vSwappedH, vZero, 8); // H.H
> 711: __ vxor(vTmp1, vTmp1, vTmp1);
I see this `vTmp1` is being used in the loop and `vpmsumd` (line 741) should overwrite whatever it is containing. So was this xor necessary ?
src/hotspot/cpu/ppc/stubGenerator_ppc.cpp line 712:
> 710: __ vsldoi(vHigherH, vSwappedH, vZero, 8); // H.H
> 711: __ vxor(vTmp1, vTmp1, vTmp1);
> 712: __ vxor(vZero, vZero, vZero);
we are doing same xor operation on `vZero` at 721 in the loop, before that It is not being used. So can we get rid of this xor-instruction as well ?
src/hotspot/cpu/ppc/stubGenerator_ppc.cpp line 714:
> 712: __ vxor(vZero, vZero, vZero);
> 713: __ mtctr(blocks);
> 714: __ li(temp1, 0);
I find this load redundant as well. We are loading 0 again at line 722 in the loop.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20235#discussion_r1895264074
PR Review Comment: https://git.openjdk.org/jdk/pull/20235#discussion_r1895268663
PR Review Comment: https://git.openjdk.org/jdk/pull/20235#discussion_r1895271706
PR Review Comment: https://git.openjdk.org/jdk/pull/20235#discussion_r1895270802
More information about the hotspot-dev
mailing list