3 ms·
ARMv8 NEON has a 64x64->128 multiply.
by monocasa 8y ago
ARMv8 NEON has a 64x64->128 multiply.
- profquail 8y agoAye, it’s PMULL, and it’s available as part of the ARM Crypto Extensions. This patch shows that using it can result in a large performance improvement: https://github.com/randombit/botan/issues/842 https://github.com/randombit/botan/issues/842
- floatboth 8y agoHm, why aren't compilers generating that instruction? upd: apparently reasons like: > So I guess for most of the case loading or storing i128, the data will be used by some library functions running on cores instead of NEON, so storing i128 to two GPR64 is more general. https://reviews.llvm.org/D2344 https://reviews.llvm.org/D2344
- dragontamer 8y ago> Hm, why aren't compilers generating that instruction? Thats polynomial multiply. Its (almost) a multiplication in GF2 for elliptical curves. Thats not a "normal" multiply. "PMULL" is basically a bitshift and XOR. Your traditional "MUL" is bitshift and ADD. Its called "polynomial multiply" because bitshift-and-xor has very similar properties to bitshift-and-add (it distributes over XOR, associative, communative, etc. etc). Bitshift-and-xor has a few features that are better for cryptography. But its NOT the multiplication you are taught in grade school. -------- EDIT: With that being said... those "better features" for cryptography would make PMULL probably a better function for random-number generation. PMULL will return a different result than the real multiplication, but you'll have an easier time making a field (aka: reversable 1-to-1 bijections) out of PMULL than MUL...
- dragontamer 8y agoI don't see any generalized 64x64->128-bit multiply on ARM's intrinsic documentation: https://developer.arm.com/technologies/neon/intrinsics https://developer.arm.com/technologies/neon/intrinsics I see "pmull" (vmull_p64), but that's polynomial multiply, which is used for Galois Field multiplication. Not "normal" multiplication. You can search for "uint64", to look for all NEON intrinsics that take a 64-bit integer. (ex: uint64x2_t). I personally didn't see any 64x64->128 bit standard multiply in NEON.