calculating Luhn checksum with Vector API

Ghadi Shayban gshayban at gmail.com
Fri Aug 19 19:32:49 UTC 2022


Hi folks,
I've implemented [1] the common Luhn checksum algorithm [2], and I have a
few questions:

How does one verify that the method is jitting to the good instructions,
rather than to e.g. a sequential fallback?
Is L31-L39 the right way to do an addition across lanes? Should
VectorShuffles be squirreled away in a static final? I see the admonition
at the end of [3] about storing in non-final fields, but I wasn't sure if
hotspot would treat the inline locals as constant.

Thanks!

[1] https://gist.github.com/ghadishayban/9bfdc8230cfdcc8f7bad6d3fd8797552
[2] https://en.wikipedia.org/wiki/Luhn_algorithm
[3]
https://download.java.net/java/early_access/jdk19/docs/api/jdk.incubator.vector/jdk/incubator/vector/VectorShuffle.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/panama-dev/attachments/20220819/46892bd6/attachment.htm>


More information about the panama-dev mailing list