diff options
author | Riccardo Spagni <ric@spagni.net> | 2016-09-10 15:13:33 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2016-09-10 15:13:33 +0200 |
commit | 391d6d0cf81327b1070d56dbf8f1ae34989edc76 (patch) | |
tree | 65210729d529e74e8de86147ac47fba0a057c8f3 /src | |
parent | Merge pull request #1048 (diff) | |
parent | crypto,cmake: enable ASM mul impl on ARM; add cmake opt (diff) | |
download | monero-391d6d0cf81327b1070d56dbf8f1ae34989edc76.tar.xz |
Merge pull request #1049
24d9337 crypto,cmake: enable ASM mul impl on ARM; add cmake opt (redfish)
Diffstat (limited to 'src')
-rw-r--r-- | src/crypto/CMakeLists.txt | 10 | ||||
-rw-r--r-- | src/crypto/slow-hash.c | 6 |
2 files changed, 13 insertions, 3 deletions
diff --git a/src/crypto/CMakeLists.txt b/src/crypto/CMakeLists.txt index 962ec8a06..ed668022f 100644 --- a/src/crypto/CMakeLists.txt +++ b/src/crypto/CMakeLists.txt @@ -74,3 +74,13 @@ bitmonero_add_library(crypto ${crypto_sources} ${crypto_headers} ${crypto_private_headers}) + +if (ARM) + option(NO_OPTIMIZED_MULTIPLY_ON_ARM + "Compute multiply using generic C implementation instead of ARM ASM" OFF) + if(NO_OPTIMIZED_MULTIPLY_ON_ARM) + message(STATUS "Using generic C implementation for multiply") + set_property(SOURCE slow-hash.c + PROPERTY COMPILE_DEFINITIONS "NO_OPTIMIZED_MULTIPLY_ON_ARM") + endif() +endif() diff --git a/src/crypto/slow-hash.c b/src/crypto/slow-hash.c index 8a1807657..a0d2d1302 100644 --- a/src/crypto/slow-hash.c +++ b/src/crypto/slow-hash.c @@ -679,7 +679,7 @@ void slow_hash_free_state(void) #include "aesb.c" -#ifndef ARM_MUL_IMPL_ASM +#ifdef NO_OPTIMIZED_MULTIPLY_ON_ARM /* The asm corresponds to this C code */ #define SHORT uint32_t #define LONG uint64_t @@ -712,7 +712,7 @@ void mul(const uint8_t *ca, const uint8_t *cb, uint8_t *cres) { res[0] = t.tmp[6]; res[1] = t.tmp[7]; } -#else // ARM_MUL_IMPL_ASM (TODO: this fails hash-slow test with GCC 6.1.1) +#else // !NO_OPTIMIZED_MULTIPLY_ON_ARM /* Can work as inline, but actually runs slower. Keep it separate */ #define mul(a, b, c) cn_mul128(a, b, c) @@ -747,7 +747,7 @@ __asm__ __volatile__( : [A]"r"(aa[1]), [a]"r"(aa[0]), [B]"r"(bb[1]), [b]"r"(bb[0]), [r]"r"(r) : "cc", "memory"); } -#endif // ARM_MUL_IMPL_ASM +#endif // NO_OPTIMIZED_MULTIPLY_ON_ARM STATIC INLINE void sum_half_blocks(uint8_t* a, const uint8_t* b) { |