disabled SPECK defaulting to NEON support on ARM (#602)

This commit is contained in:
Logan oos Even 2021-01-26 21:23:08 +05:45 committed by GitHub
parent 2fbbafc88d
commit 3574865bf0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 4 deletions

View File

@ -105,7 +105,7 @@ So far, the following portions of n2n's code benefit from hardware features:
```
AES: AES-NI
ChaCha20: SSE2, SSSE3
SPECK: SSE2, SSSE3, AVX2, NEON
SPECK: SSE2, SSSE3, AVX2, (NEON)
Pearson Hashing: AES-NI
Random Numbers: RDSEED, RDRND (not faster but more random seed)
```
@ -146,4 +146,14 @@ If used with multiple supernodes, by default, an edge choses the least loaded su
which of course can be combined with the compiler optimizations mentioned above…
Note that the activation of this strategy requires a sufficiently accurate local day-of-time clock. It probably will fail on smaller systems using `uclibc` (instead of `glibc`) whose day-of-time clock is said to not provide sub-second accuracy.
Note that the activation of this strategy requires a sufficiently accurate local day-of-time clock. It probably will fail on smaller systems using `uclibc` (instead of `glibc`) whose day-of-time clock is said to not provide sub-second accuracy.
## SPECK ARM NEON Hardware Acceleration
By default, SPECK does not take advantage of ARM NEON hardware acceleration even if compiled with `-march=native`. The reason is that the NEON implementation proved to be slower than the 64-bit scalar code on Raspberry Pi 3B+, see [here](https://github.com/ntop/n2n/issues/563).
Your specific ARM mileage may vary, so it can be enabled by configuring the definition of the `SPECK_ARM_NEON` macro:
`./configure CFLAGS="-DSPECK_ARM_NEON"`
Just make sure that the correct architecture is set, too. `-march=native` usually works quite well.

View File

@ -72,7 +72,7 @@ typedef struct {
} speck_context_t;
#elif defined (__ARM_NEON) // NEON support ------------------------------------------------------------------------
#elif defined (__ARM_NEON) && defined (SPECK_ARM_NEON) // NEON support ---------------------------------------
#include <arm_neon.h>

View File

@ -441,7 +441,7 @@ static int speck_expand_key (speck_context_t *ctx, const unsigned char *k, int k
}
#elif defined (__ARM_NEON) // NEON support -------------------------------------------------------------------
#elif defined (__ARM_NEON) && defined (SPECK_ARM_NEON) // NEON support ---------------------------------------
#define LCS(x,r) (((x)<<r)|((x)>>(64-r)))