From 9c95be105f518d18407115c2c06893857c24b116 Mon Sep 17 00:00:00 2001 From: Jussi Kivilinna Date: Sat, 31 Aug 2013 12:48:30 +0300 Subject: Add ARM HW feature detection module and add NEON detection * configure.ac: Add option --disable-neon-support. (HAVE_GCC_INLINE_ASM_NEON): New. (ENABLE_NEON_SUPPORT): New. [arm]: Add 'hwf-arm.lo' as HW feature module. * src/Makefile.am: Add 'hwf-arm.c'. * src/g10lib.h (HWF_ARM_NEON): New macro. * src/global.c (hwflist): Add HWF_ARM_NEON entry. * src/hwf-arm.c: New file. * src/hwf-common.h (_gcry_hwf_detect_arm): New prototype. * src/hwfeatures.c (_gcry_detect_hw_features) [HAVE_CPU_ARCH_ARM]: Add call to _gcry_hwf_detect_arm. -- Add HW detection module for detecting ARM NEON instruction set. ARM does not have cpuid instruction so we have to rely on OS to pass feature set information to user-space. For linux, NEON support can be detected by parsing '/proc/self/auxv' for hardware capabilities information. For other OSes, NEON can be detected by checking if platform/compiler only supports NEON capable CPUs (by check if __ARM_NEON__ macro is defined). Signed-off-by: Jussi Kivilinna --- src/hwfeatures.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/hwfeatures.c') diff --git a/src/hwfeatures.c b/src/hwfeatures.c index 87d05d83..1e3c27dc 100644 --- a/src/hwfeatures.c +++ b/src/hwfeatures.c @@ -59,6 +59,11 @@ _gcry_detect_hw_features (unsigned int disabled_features) hw_features = _gcry_hwf_detect_x86 (); } #endif /* HAVE_CPU_ARCH_X86 */ +#if defined (HAVE_CPU_ARCH_ARM) + { + hw_features = _gcry_hwf_detect_arm (); + } +#endif /* HAVE_CPU_ARCH_ARM */ hw_features &= ~disabled_features; } -- cgit v1.2.1