Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8167065

Add intrinsic support for double precision shifting on x86_64

XMLWordPrintable

    • 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.

            svkamath Smita Kamath (Inactive)
            mcberg Michael Berg (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 2 weeks
                2w
                Remaining:
                Remaining Estimate - 2 days
                2d
                Logged:
                Time Spent - Not Specified Time Not Required
                Not Specified