aboutsummaryrefslogtreecommitdiff
path: root/c/README.md
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/README.md
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/README.md')
-rw-r--r--c/README.md23
1 files changed, 21 insertions, 2 deletions
diff --git a/c/README.md b/c/README.md
index 21be216..a0d87af 100644
--- a/c/README.md
+++ b/c/README.md
@@ -88,9 +88,28 @@ gcc -shared -O3 -DBLAKE3_NO_SSE41 -DBLAKE3_NO_AVX2 -DBLAKE3_NO_AVX512 \
blake3.c blake3_dispatch.c blake3_portable.c -o libblake3.so
```
-### ARM
+### ARM NEON
-TODO: add NEON support to `blake3_dispatch.c`.
+The NEON implementation is not enabled by default on ARM, since not all
+ARM targets support it. To enable it, set `BLAKE3_USE_NEON=1`. Here's an
+example of building a shared library on ARM Linux with NEON support:
+
+```bash
+gcc -shared -O3 -DBLAKE3_USE_NEON blake3.c blake3_dispatch.c \
+ blake3_portable.c blake3_neon.c -o libblake3.so
+```
+
+Note that on some targets (ARMv7 in particular), extra flags may be
+required to activate NEON support in the compiler. If you see an error
+like...
+
+```
+/usr/lib/gcc/armv7l-unknown-linux-gnueabihf/9.2.0/include/arm_neon.h:635:1: error: inlining failed
+in call to always_inline ‘vaddq_u32’: target specific option mismatch
+```
+
+...then you may need to add something like `-mfpu=neon-vfpv4
+-mfloat-abi=hard`.
### Other Platforms