On Fri, 13 Nov 2026 08:03:23 GMT, Shawn Emery <[email protected]> wrote:

>> src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp line 9192:
>> 
>>> 9190:     }
>>> 9191: 
>>> 9192:     Register v     = a;
>> 
>> Is this not just a cut and paste of the same generated code for 
>> `carryReduce` implementation that we see in `generate_intpoly_mult_P384`.
>> 
>> If it is not then where (and why) do the two implementations differ?
>> 
>> If it is the same then we should really be generating this using an 
>> auxiliary method (`generate_carry_reduce_P384`).
>
> Re: testing; I've tested the intrinsics through benchmarks and the following 
> P-384 related test suites:
> sun/security/util/math/TestIntegerModuloP.java#IntegerPolynomialP384
> test/jdk/sun/security/ec/ECDHPrimitive.java
> test/jdk/sun/security/ec/SignatureKAT.java
> test/jdk/sun/security/ec/ECDSAPrimitive.java
> test/jdk/sun/security/ec/SignedObjectChain.java
> test/jdk/sun/security/ec/SignatureParameters.java
> test/jdk/sun/security/ec/TestEC.java
> test/jdk/com/sun/crypto/provider/Cipher/HPKE/Functions.java
> 
> Re: `carryReduce` code reuse; yes, they are the same.  I was still in the 
> nesting vs. performance mode, but nesting the helper function only reduces 
> performance by ~1%, which is negligible.  Done.

Sorry, the performance drop was from the add/sub-shift instruction utilization 
which had differed unnecessarily from the multiplication and squaring methods.  
Less instructions doesn't necessarily mean better performance as better 
scheduling could be performed with the separated shift instruction.  I've since 
reverted back to the separate shift instructions and have seen a 1.24% jump in 
performance from the original benchmarks.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/33618#discussion_r4570062401

Reply via email to