dynamic CPU detection for libgcrypt assembly code?

Jussi Kivilinna jussi.kivilinna at iki.fi
Fri Dec 20 16:04:34 CET 2013


On 20.12.2013 16:44, Hans-Christoph Steiner wrote:
> 
> Hey,
> 
> Its great to see all that work being done adding assembly optimizations to
> libgcrypt, it should make a really big difference on mobile devices.  My
> question is whether there is any kind of dynamic CPU detection that would
> enable certain modules, like ARM NEON code?  We'd like to include the NEON
> code, but if the same binary won't work on armv7 chips that don't have NEON,
> then its a showstopper for us.

Libgcrypt has HW detection modules for x86 and ARM. On x86, cpuid instruction
is used to detect CPU features. On ARM, detection is platform dependent since
there is no cpuid instruction; with linux/arm platform NEON detection is done through '/proc/self/auxv':AT_HWCAP. On non-linux/arm platform, NEON implementations can be enabled by compiling binary for ARMv7/NEON (libgcrypt notices that compiler has __ARM_NEON__ macro predefined).

-Jussi

> 
> .hc
> 




More information about the Gnupg-devel mailing list