mirror of
https://github.com/BLAKE3-team/BLAKE3
synced 2024-05-07 22:16:18 +02:00
Use BLAKE3_USE_NEON=0 instead of BLAKE3_NO_NEON def
This commit is contained in:
parent
f4d5c6e785
commit
2aa7c963be
|
@ -38,12 +38,12 @@ ASM_TARGETS += blake3_avx512_x86-64_unix.S
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef BLAKE3_USE_NEON
|
ifdef BLAKE3_USE_NEON
|
||||||
EXTRAFLAGS += -DBLAKE3_USE_NEON
|
EXTRAFLAGS += -DBLAKE3_USE_NEON=1
|
||||||
TARGETS += blake3_neon.o
|
TARGETS += blake3_neon.o
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef BLAKE3_NO_NEON
|
ifdef BLAKE3_NO_NEON
|
||||||
EXTRAFLAGS += -DBLAKE3_NO_NEON
|
EXTRAFLAGS += -DBLAKE3_USE_NEON=0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
all: blake3.c blake3_dispatch.c blake3_portable.c main.c $(TARGETS)
|
all: blake3.c blake3_dispatch.c blake3_portable.c main.c $(TARGETS)
|
||||||
|
|
|
@ -256,15 +256,15 @@ other ARM targets, since not all of them support it. To enable it, set
|
||||||
ARM Linux with NEON support:
|
ARM Linux with NEON support:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
gcc -shared -O3 -o libblake3.so -DBLAKE3_USE_NEON blake3.c blake3_dispatch.c \
|
gcc -shared -O3 -o libblake3.so -DBLAKE3_USE_NEON=1 blake3.c blake3_dispatch.c \
|
||||||
blake3_portable.c blake3_neon.c
|
blake3_portable.c blake3_neon.c
|
||||||
```
|
```
|
||||||
|
|
||||||
To explicitiy disable using NEON instructions on AARCH64, set
|
To explicitiy disable using NEON instructions on AARCH64, set
|
||||||
`BLAKE3_NO_NEON=1`.
|
`BLAKE3_USE_NEON=0`.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
gcc -shared -O3 -o libblake3.so -DBLAKE3_NO_NEON blake3.c blake3_dispatch.c \
|
gcc -shared -O3 -o libblake3.so -DBLAKE3_USE_NEON=0 blake3.c blake3_dispatch.c \
|
||||||
blake3_portable.c
|
blake3_portable.c
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -232,7 +232,7 @@ void blake3_hash_many(const uint8_t *const *inputs, size_t num_inputs,
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(BLAKE3_USE_NEON)
|
#if BLAKE3_USE_NEON == 1
|
||||||
blake3_hash_many_neon(inputs, num_inputs, blocks, key, counter,
|
blake3_hash_many_neon(inputs, num_inputs, blocks, key, counter,
|
||||||
increment_counter, flags, flags_start, flags_end, out);
|
increment_counter, flags, flags_start, flags_end, out);
|
||||||
return;
|
return;
|
||||||
|
@ -269,7 +269,7 @@ size_t blake3_simd_degree(void) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#if defined(BLAKE3_USE_NEON)
|
#if BLAKE3_USE_NEON == 1
|
||||||
return 4;
|
return 4;
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -49,13 +49,18 @@ enum blake3_flags {
|
||||||
#include <immintrin.h>
|
#include <immintrin.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(IS_AARCH64) && !defined(BLAKE3_NO_NEON) && !defined(BLAKE3_USE_NEON)
|
#if !defined(BLAKE3_USE_NEON)
|
||||||
#define BLAKE3_USE_NEON
|
// If BLAKE3_USE_NEON not manually set, autodetect based on AArch64ness
|
||||||
|
#if defined(IS_AARCH64)
|
||||||
|
#define BLAKE3_USE_NEON 1
|
||||||
|
#else
|
||||||
|
#define BLAKE3_USE_NEON 0
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(IS_X86)
|
#if defined(IS_X86)
|
||||||
#define MAX_SIMD_DEGREE 16
|
#define MAX_SIMD_DEGREE 16
|
||||||
#elif defined(BLAKE3_USE_NEON)
|
#elif BLAKE3_USE_NEON == 1
|
||||||
#define MAX_SIMD_DEGREE 4
|
#define MAX_SIMD_DEGREE 4
|
||||||
#else
|
#else
|
||||||
#define MAX_SIMD_DEGREE 1
|
#define MAX_SIMD_DEGREE 1
|
||||||
|
@ -265,7 +270,7 @@ void blake3_hash_many_avx512(const uint8_t *const *inputs, size_t num_inputs,
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(BLAKE3_USE_NEON)
|
#if BLAKE3_USE_NEON == 1
|
||||||
void blake3_hash_many_neon(const uint8_t *const *inputs, size_t num_inputs,
|
void blake3_hash_many_neon(const uint8_t *const *inputs, size_t num_inputs,
|
||||||
size_t blocks, const uint32_t key[8],
|
size_t blocks, const uint32_t key[8],
|
||||||
uint64_t counter, bool increment_counter,
|
uint64_t counter, bool increment_counter,
|
||||||
|
|
Loading…
Reference in New Issue