Replace error output with target pragma if possible
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
This commit is contained in:
parent
35f2b26fd8
commit
64e5d4a2cd
2 changed files with 56 additions and 22 deletions
|
@ -39,7 +39,29 @@
|
||||||
defined(MBEDTLS_SHA256_USE_A64_CRYPTO_ONLY)
|
defined(MBEDTLS_SHA256_USE_A64_CRYPTO_ONLY)
|
||||||
/* *INDENT-OFF* */
|
/* *INDENT-OFF* */
|
||||||
# if !defined(__ARM_FEATURE_CRYPTO)
|
# if !defined(__ARM_FEATURE_CRYPTO)
|
||||||
# error "Must use minimum -march=armv8-a+crypto for MBEDTLS_SHA256_USE_A64_CRYPTO_*"
|
# if defined(__clang__)
|
||||||
|
# if __clang_major__ < 18
|
||||||
|
/* TODO: Re-consider above after https://reviews.llvm.org/D131064
|
||||||
|
* merged.
|
||||||
|
*
|
||||||
|
* The intrinsic declaration are guarded with ACLE predefined macros
|
||||||
|
* in clang, and those macros are only enabled with command line.
|
||||||
|
* Define the macros can enable those declaration and avoid compile
|
||||||
|
* error on it.
|
||||||
|
*/
|
||||||
|
# define __ARM_FEATURE_CRYPTO 1
|
||||||
|
# endif
|
||||||
|
# pragma clang attribute push (__attribute__((target("crypto"))), apply_to=function)
|
||||||
|
# define MBEDTLS_POP_TARGET_PRAGMA
|
||||||
|
# elif defined(__GNUC__)
|
||||||
|
# if __GNUC__ < 6 /* TODO: check sha256 compatible for GCC */
|
||||||
|
# error "A more recent GCC is required for MBEDTLS_SHA256_USE_A64_CRYPTO_*"
|
||||||
|
# else
|
||||||
|
# pragma GCC target ("arch=armv8-a+crypto")
|
||||||
|
# endif
|
||||||
|
# else
|
||||||
|
# error "Only GCC and Clang supported for MBEDTLS_SHA256_USE_A64_CRYPTO_*"
|
||||||
|
# endif
|
||||||
# endif
|
# endif
|
||||||
/* *INDENT-ON* */
|
/* *INDENT-ON* */
|
||||||
# include <arm_neon.h>
|
# include <arm_neon.h>
|
||||||
|
|
|
@ -64,23 +64,35 @@
|
||||||
# if __clang_major__ < 7
|
# if __clang_major__ < 7
|
||||||
# error "A more recent Clang is required for MBEDTLS_SHA512_USE_A64_CRYPTO_*"
|
# error "A more recent Clang is required for MBEDTLS_SHA512_USE_A64_CRYPTO_*"
|
||||||
# elif __clang_major__ < 13 || \
|
# elif __clang_major__ < 13 || \
|
||||||
(__clang_major__ == 13 && __clang_minor__ == 0 && __clang_patchlevel__ == 0)
|
(__clang_major__ == 13 && __clang_minor__ == 0 && \
|
||||||
|
__clang_patchlevel__ == 0)
|
||||||
/* We implement the intrinsics with inline assembler, so don't error */
|
/* We implement the intrinsics with inline assembler, so don't error */
|
||||||
# else
|
# else
|
||||||
# error "Must use minimum -march=armv8.2-a+sha3 for MBEDTLS_SHA512_USE_A64_CRYPTO_*"
|
# if __clang_major__ < 18
|
||||||
|
/* TODO: Re-consider above after https://reviews.llvm.org/D131064
|
||||||
|
* merged.
|
||||||
|
*
|
||||||
|
* The intrinsic declaration are guarded with ACLE predefined macros
|
||||||
|
* in clang, and those macros are only enabled with command line.
|
||||||
|
* Define the macros can enable those declaration and avoid compile
|
||||||
|
* error on it.
|
||||||
|
*/
|
||||||
|
# define __ARM_FEATURE_SHA512 1
|
||||||
|
# endif
|
||||||
|
# pragma clang attribute push (__attribute__((target("sha3"))), apply_to=function)
|
||||||
|
# define MBEDTLS_POP_TARGET_PRAGMA
|
||||||
# endif
|
# endif
|
||||||
# elif defined(__GNUC__)
|
# elif defined(__GNUC__)
|
||||||
# if __GNUC__ < 8
|
# if __GNUC__ < 8
|
||||||
# error "A more recent GCC is required for MBEDTLS_SHA512_USE_A64_CRYPTO_*"
|
# error "A more recent GCC is required for MBEDTLS_SHA512_USE_A64_CRYPTO_*"
|
||||||
# else
|
# else
|
||||||
# error "Must use minimum -march=armv8.2-a+sha3 for MBEDTLS_SHA512_USE_A64_CRYPTO_*"
|
# pragma GCC target ("arch=armv8.2-a+sha3")
|
||||||
# endif
|
# endif
|
||||||
# else
|
# else
|
||||||
# error "Only GCC and Clang supported for MBEDTLS_SHA512_USE_A64_CRYPTO_*"
|
# error "Only GCC and Clang supported for MBEDTLS_SHA512_USE_A64_CRYPTO_*"
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
/* *INDENT-ON* */
|
/* *INDENT-ON* */
|
||||||
|
|
||||||
# include <arm_neon.h>
|
# include <arm_neon.h>
|
||||||
# endif
|
# endif
|
||||||
# if defined(MBEDTLS_SHA512_USE_A64_CRYPTO_IF_PRESENT)
|
# if defined(MBEDTLS_SHA512_USE_A64_CRYPTO_IF_PRESENT)
|
||||||
|
|
Loading…
Reference in a new issue