From 2b3f6527d522b647a6c8b5039228ebe569686c38 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Fri, 15 Nov 2019 17:09:01 +0000 Subject: [PATCH] *.c: Check for ARM64 SIMD before using the accelerated code. I don't expect ARM64 processors to omit the SIMD instructions, but it's convenient to have a way to inhibit the accelerated code (e.g., for performance measurement). --- symm/chacha.c | 3 ++- symm/salsa20.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/symm/chacha.c b/symm/chacha.c index 71522003..f70ee9fb 100644 --- a/symm/chacha.c +++ b/symm/chacha.c @@ -93,7 +93,8 @@ static core__functype *pick_core(void) cpu_feature_p(CPUFEAT_ARM_NEON)); #endif #if CPUFAM_ARM64 - DISPATCH_PICK_COND(chacha_core, chacha_core_arm64, 1); + DISPATCH_PICK_COND(chacha_core, chacha_core_arm64, + cpu_feature_p(CPUFEAT_ARM_NEON)); #endif DISPATCH_PICK_FALLBACK(chacha_core, simple_core); } diff --git a/symm/salsa20.c b/symm/salsa20.c index 03fcf469..f424b746 100644 --- a/symm/salsa20.c +++ b/symm/salsa20.c @@ -93,7 +93,8 @@ static core__functype *pick_core(void) cpu_feature_p(CPUFEAT_ARM_NEON)); #endif #if CPUFAM_ARM64 - DISPATCH_PICK_COND(salsa20_core, salsa20_core_arm64, 1); + DISPATCH_PICK_COND(salsa20_core, salsa20_core_arm64, + cpu_feature_p(CPUFEAT_ARM_NEON)); #endif DISPATCH_PICK_FALLBACK(salsa20_core, simple_core); } -- 2.11.0