RFR 8167065 - Adding support for double precision shifting for x86
Vladimir Kozlov
vladimir.kozlov at oracle.com
Tue Oct 11 17:51:19 UTC 2016
Hi Razvan,
The biggest issue with this change is missing range checks for accessed arrays (they are generated by JIT with normal compilation). Usually we add additional java method to do that when we intrinsify
array accesses.
And I don't think we should intrinsify these small loops. When performance improvement you will get for BigInteger.shiftLeft and BigInteger.shiftRight if you only Pattern match their body code
(mag[j++] << nBits | mag[j] >>> nBits2)?
Thanks,
Vladimir
On 10/11/16 9:43 AM, Lupusoru, Razvan A wrote:
> Hello,
>
> I would like to propose some work that I have been recently looking into - which is use of double precision shifting on x86_64. Double precision shift is an operation which shifts but instead of
> bringing in zeros or ones, it brings in bits from another source. This is a powerful operation because it allows making some patterns more concise and enables speed up of code which uses masks to
> create same semantics.
>
> So I would like to propose a patch which adds support for double precision shifting in two ways:
>
> 1) Pattern matching is done to catch pattern A << C | B >>> D and A << C + B >>> D (where C + D is 32 and 64 for integers and longs respectively)
>
> 2) BigInteger methods shiftRight and shiftLeft are intrinsified and made to use double precision shifting.
>
> In order to confirm performance gains, small micros were created which test the above operations in tight loops. The tests were done on a Skylake i7-6700k. The following performance improvements were
> seen by me:
>
> - Intrinsification of BigInteger.shiftLeft: 15%
>
> - Intrinsification of BigInteger.shiftRight: 25%
>
> - Pattern replacement of pattern above with integers: 7.5%
>
> - Pattern replacement of patterns above with longs: 2%
>
> The bug is filed here: https://bugs.openjdk.java.net/browse/JDK-8167065
>
> The webrev for hotspot is available here: http://cr.openjdk.java.net/~mcberg/8167065/hotspot/webrev.02/
>
> The webrev for jdk (minor changes to allow intrinsification) is here: http://cr.openjdk.java.net/~mcberg/8167065/jdk/webrev.01/
>
> Thanks so much for your consideration!
>
> --Razvan
>
More information about the hotspot-compiler-dev
mailing list