dynamic CPU detection for libgcrypt assembly code?
Hans-Christoph Steiner
hans at guardianproject.info
Mon Dec 23 21:40:19 CET 2013
On 12/20/2013 02:06 PM, Jussi Kivilinna wrote:
> On 20.12.2013 18:09, Hans-Christoph Steiner wrote:
>>
>>
>> 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.
>
> Well, after little bit of research, I found out that Android blocks read access
> to /proc/self/auxv. Instead there is another API for cpu features:
> http://www.kandroid.org/ndk/docs/CPU-ARM-NEON.html
>
> For proper NEON support on Android, libgcrypt should use this API for arm hw
> detection.
>
> -Jussi
>
>>
>> .hc
Ok, I tested this latest patch on my unrooted dev tablet, and it detects NEON
properly. I think that patch is ready to include.
.hc
--
PGP fingerprint: 5E61 C878 0F86 295C E17D 8677 9F0F E587 374B BE81
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 969 bytes
Desc: OpenPGP digital signature
URL: </pipermail/attachments/20131223/9bd9333f/attachment.sig>
More information about the Gnupg-devel
mailing list