RFR: 8256431: [PPC64] Implement Base64 encodeBlock() for Power64-LE [v4]

Corey Ashford github.com+51754783+coreyashford at openjdk.java.net
Wed Dec 16 18:22:55 UTC 2020


On Wed, 16 Dec 2020 09:44:49 GMT, Martin Doerr <mdoerr at openjdk.org> wrote:

>> Ah, I see now.  It's basically multiplying by the binary-point reciprocal, and then accounting for the number of number of binary point digits, which in this case effectively means take the answer from the top 64 bits of the 128-bit result.
>
> Right. It's tricky to make sure there will be no rounding errors, so the algorithm to determine the reciprocal together with the shift amount is not trivial. It's implemented in "magic_long_divide_constants" (divnode.cpp) and taken from "Hacker's Delight by Henry S. Warren, Jr." where you can find a detailed explanation. But we warned, verifying the proof takes time!
> However, you can easily compute the constants by compiling a Java long division by C2 and disassembling.

I thought there might be some trickiness in that constant because the last digit was rounded.   Thanks for the pointers!

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

PR: https://git.openjdk.java.net/jdk/pull/1245


More information about the hotspot-compiler-dev mailing list