aboutsummaryrefslogtreecommitdiff
path: root/c/blake3_dispatch.c
diff options
context:
space:
mode:
authorJack O'Connor <[email protected]>2020-01-27 13:46:00 -0500
committerJack O'Connor <[email protected]>2020-01-28 15:59:16 -0500
commit37e153cc607ba5b975ce8bd7f2017f01624781bb (patch)
tree20b39b41a9bfad9c6d45e2d92912bd9fc9d6703d /c/blake3_dispatch.c
parentd7a37fa54d67e67c19027928ae524292318c9021 (diff)
add NEON support to blake3_dispatch.c
Currently this requires setting the BLAKE3_USE_NEON preprocessor flag. In the future we may enable this automatically on AArch32/64 or include some kind of dynamic feature detection. (Though ARM makes this harder than x86.) As part of this, get rid of the IS_ARM flag. It wasn't being set properly when I tried it on a Raspberry Pi. Closes #30.
Diffstat (limited to 'c/blake3_dispatch.c')
-rw-r--r--c/blake3_dispatch.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/c/blake3_dispatch.c b/c/blake3_dispatch.c
index 4d033db..7daf43e 100644
--- a/c/blake3_dispatch.c
+++ b/c/blake3_dispatch.c
@@ -73,7 +73,7 @@ void blake3_hash_many_avx512(const uint8_t *const *inputs, size_t num_inputs,
#endif
#endif
-#if defined(IS_ARM) && defined(BLAKE3_USE_NEON)
+#if defined(BLAKE3_USE_NEON)
void blake3_hash_many_neon(const uint8_t *const *inputs, size_t num_inputs,
size_t blocks, const uint32_t key[8],
uint64_t counter, bool increment_counter,
@@ -191,10 +191,8 @@ static
}
g_cpu_features = features;
return features;
-#elif defined(IS_ARM)
- /* How to detect NEON? */
- return 0;
#else
+ /* How to detect NEON? */
return 0;
#endif
}
@@ -275,6 +273,13 @@ void blake3_hash_many(const uint8_t *const *inputs, size_t num_inputs,
}
#endif
#endif
+
+#if defined(BLAKE3_USE_NEON)
+ blake3_hash_many_neon(inputs, num_inputs, blocks, key, counter,
+ increment_counter, flags, flags_start, flags_end, out);
+ return;
+#endif
+
blake3_hash_many_portable(inputs, num_inputs, blocks, key, counter,
increment_counter, flags, flags_start, flags_end,
out);