chiark / gitweb /
*.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 71522003daa005dae9aa342cde4eb10c3ebec23f..f70ee9fb155145530ef332f43819ee49f8e5eb2d 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 03fcf469e8f46dc5de86f5aafaf717a21b157c9d..f424b7461b474c76f2c443dfc54dcc459857ad49 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);
 }