-
Enhancement
-
Resolution: Fixed
-
P3
-
9, 10, 11, 12
-
b04
-
x86
-
generic
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%
BigInteger is used in binary, cryptography calculation and GNU Multiple
Precision Arithmetic Library.
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%
BigInteger is used in binary, cryptography calculation and GNU Multiple
Precision Arithmetic Library.
- duplicates
-
JDK-8234692 Big Integer Shift Optimization using VBMI2 Instructions
-
- Open
-