On Thu, 26 Nov 2026 10:10:41 GMT, Andrew Dinn <[email protected]> wrote:

>> Shawn Emery has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   Update based on comment from @adinn
>
> src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp line 9173:
> 
>> 9171:       for (int j = i + 1; j < LIMBS_P384; j++) {
>> 9172:         __ ldr(a, Address(aLimbs, j * 8));
>> 9173:         __ smulh(high, a, aArg);
> 
> Hmm. I was expecting this generation sequence also to be encapsulated in a 
> call to `mulhl_P384`. However, I overlooked the small detail that in this 
> case the accumulation into `(c[i], c[i+1])` requires a left shift by 1.
> 
> It would be clearer to any maintainer if you emphasised the continuity of 
> this case with the others. You can achieve that by tweaking `mulhl_P384` to 
> accept an extra, optional shift argument, allowing you to call it to cater 
> for this case as well as the previous ones.
> 
> i.e. modify the implementation of mulhl_P384 to:
> 
> 
>   // output a * b as 2*55 bit products in (high, low) and
>   // accumulate (high << shift, low << shift) into (c[i], c[i+1])
>   void mulhl_P384(Register a, Register b, Register high, Register low, 
> Register c[], int i, int shift = 0) {
>     __ smulh(high, a, b);
>     __ mul(low, a, b);
>     __ extr(high, high, low, BPL_P384);
>     __ andr(low, low,  MASK_P384);
>     __ add(c[i], c[i], low, Assembler::LSL, shift);
>     __ add(c[i + 1], c[i + 1], high, Assembler::LSL, shift);
>   }
> 
> 
> and then at this point replace the generation sequence with
> 
> 
>         mulhl_P384(a, aArg, high, low, c, i+j, 1);
> 
> 
> Note that `shift` defaults to `0` so the existing calls to `mulhl_P384` will 
> still generate the desired result.

Done.

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

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

Reply via email to