*.c: Check for ARM64 SIMD before using the accelerated code.
authorMark Wooding <mdw@distorted.org.uk>
Fri, 15 Nov 2019 17:09:01 +0000 (17:09 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Sat, 9 May 2020 13:37:21 +0000 (14:37 +0100)
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
symm/salsa20.c

index 7152200..f70ee9f 100644 (file)
@@ -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);
 }
index 03fcf46..f424b74 100644 (file)
@@ -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);
 }