On Fri, 2 May 2025 17:49:54 GMT, Raffaello Giulietti <rgiulie...@openjdk.org> 
wrote:

> Yes, I'm familiar with both this Java code and the intrinsic code.
> 
> Compare this with the much simpler proposed code. The checked multiplication 
> `unsignedMultiplyExact` apparently performs two 64x64->64 multiplications, 
> but on some architectures it might end up in a single 64x64->128 
> multiplication and one check. So the proposed code performs 6 such 
> multiplications if the method returns + 5 ordinary multiplications in the 
> worst case.
> 
> As a general rule, the simpler the code, the better the outcome of the 
> optimizing compiler.
> 
> Again, to me there's no point in failing fast at the expense of the 
> successful case.

Yes; we can always try to make simpler code faster if the need or interest 
arises.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25003#discussion_r2074441059

Reply via email to