RFR: 8077615: AARCH64: Add C2 intrinsic for BigInteger::multiplyToLen() method
Andrew Haley
aph at redhat.com
Tue Apr 14 17:41:20 UTC 2015
On 04/14/2015 06:22 PM, Vladimir Kozlov wrote:
> We are discussing how and which checks to add into java code which
> calls intrinsified methods to keep intrinsic simple.
Yes, good idea. While you're in there, there's a couple of thoughts I'd
like to draw your attention to.
Montgomery multiplication and squaring are implemented as separate
steps, like so:
a = multiplyToLen(t, modLen, mult, modLen, a);
a = montReduce(a, mod, modLen, inv);
a = squareToLen(t, modLen, a);
a = montReduce(a, mod, modLen, inv);
It is possible to interleave the multiplication and Montgomery
reduction, and this can lead to a useful speedup on some
architectures. It would be nice if Montgomery multiplication and
squaring were factored into separate methods, and then they could be
replaced by intrinsics.
Also, all these word-reversal and misaligned long stores / loads in
the multiplyToLen intrinsic code are a real PITA. If we word-reversed
the arrays so that they were in little-endian form we'd have neither
misaligned long stores / loads nor repeated word-reversals. We could
do the word reversal on the stack: AFAICS it's unusual for
multiplyToLen to be called for huge bignums, and I suppose if it did
happen for a bignum larger than some threshold we could do the word
reversal on the heap.
Andrew.
More information about the hotspot-dev
mailing list