diff --git a/common/common_defs.h b/common/common_defs.h index dbaee51..4bc3095 100644 --- a/common/common_defs.h +++ b/common/common_defs.h @@ -142,6 +142,12 @@ typedef size_t machine_word_t; #ifndef COMPILER_SUPPORTS_AVX2_TARGET_INTRINSICS # define COMPILER_SUPPORTS_AVX2_TARGET_INTRINSICS 0 #endif +#ifndef COMPILER_SUPPORTS_NEON_TARGET_INTRINSICS +# define COMPILER_SUPPORTS_NEON_TARGET_INTRINSICS 0 +#endif +#ifndef COMPILER_SUPPORTS_PMULL_TARGET_INTRINSICS +# define COMPILER_SUPPORTS_PMULL_TARGET_INTRINSICS 0 +#endif /* _aligned_attribute(n) - declare that the annotated variable, or variables of * the annotated type, are to be aligned on n-byte boundaries */ diff --git a/common/compiler_gcc.h b/common/compiler_gcc.h index ad68eba..bdebce7 100644 --- a/common/compiler_gcc.h +++ b/common/compiler_gcc.h @@ -86,6 +86,23 @@ # define COMPILER_SUPPORTS_AVX2_TARGET_INTRINSICS \ COMPILER_SUPPORTS_AVX2_TARGET # endif +# elif defined(__arm__) || defined(__aarch64__) + /* + * Prior to gcc 6.1 (r230411 for arm, r226563 for aarch64), NEON + * and crypto intrinsics not available in the main target could not be + * used in 'target' attribute functions. + * + * clang as of 5.0.1 still doesn't allow it. But, it does seem to allow + * the pmull intrinsics if only __ARM_NEON is enabled. + */ +# define COMPILER_SUPPORTS_NEON_TARGET_INTRINSICS GCC_PREREQ(6, 1) +# ifdef __ARM_NEON +# define COMPILER_SUPPORTS_PMULL_TARGET_INTRINSICS \ + (GCC_PREREQ(6, 1) || __has_builtin(__builtin_neon_vmull_p64)) +# else +# define COMPILER_SUPPORTS_PMULL_TARGET_INTRINSICS \ + (GCC_PREREQ(6, 1)) +# endif # endif #endif /* COMPILER_SUPPORTS_TARGET_FUNCTION_ATTRIBUTE */