dynamic CPU detection for libgcrypt assembly code?

Hans-Christoph Steiner hans at guardianproject.info
Fri Dec 20 17:09:51 CET 2013



On 12/20/2013 10:04 AM, Jussi Kivilinna wrote:
> 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).

So Android is Linux but not GNU or UNIX.  Sounds like /proc/self/auxv should
work for Android then, in my quick survey of one Android device, it does have
/proc/self/auxv.

.hc

-- 
PGP fingerprint: 5E61 C878 0F86 295C E17D  8677 9F0F E587 374B BE81



More information about the Gnupg-devel mailing list