From 26ee5028e114afa7f4f6b6173dfcd9f7f10935ac Mon Sep 17 00:00:00 2001 From: XMRig Date: Sun, 3 Jun 2018 00:09:59 +0700 Subject: [PATCH] Use native checks instead of XMRIG_ARMv8. --- src/Cpu_arm.cpp | 5 ++++- src/crypto/CryptoNight_arm.h | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Cpu_arm.cpp b/src/Cpu_arm.cpp index 59ff8421..3e259d0d 100644 --- a/src/Cpu_arm.cpp +++ b/src/Cpu_arm.cpp @@ -47,8 +47,11 @@ void Cpu::initCommon() { memcpy(m_brand, "Unknown", 7); -# if defined(XMRIG_ARMv8) +# if defined (__arm64__) || defined (__aarch64__) m_flags |= X86_64; +# endif + +# if __ARM_FEATURE_CRYPTO m_flags |= AES; # endif } diff --git a/src/crypto/CryptoNight_arm.h b/src/crypto/CryptoNight_arm.h index 284b1f5f..161a095f 100644 --- a/src/crypto/CryptoNight_arm.h +++ b/src/crypto/CryptoNight_arm.h @@ -73,7 +73,7 @@ static inline __attribute__((always_inline)) __m128i _mm_set_epi64x(const uint64 } -#ifdef XMRIG_ARMv8 +#if __ARM_FEATURE_CRYPTO static inline __attribute__((always_inline)) __m128i _mm_aesenc_si128(__m128i v, __m128i rkey) { alignas(16) const __m128i zero = { 0 }; @@ -82,6 +82,8 @@ static inline __attribute__((always_inline)) __m128i _mm_aesenc_si128(__m128i v, #else static inline __attribute__((always_inline)) __m128i _mm_aesenc_si128(__m128i v, __m128i rkey) { + alignas(16) const __m128i zero = { 0 }; + return zero; } #endif @@ -96,7 +98,7 @@ static inline __attribute__((always_inline)) uint64_t _mm_cvtsi128_si64(__m128i #define EXTRACT64(X) _mm_cvtsi128_si64(X) -#if defined(XMRIG_ARMv8) +#if defined (__arm64__) || defined (__aarch64__) static inline uint64_t __umul128(uint64_t a, uint64_t b, uint64_t* hi) { unsigned __int128 r = (unsigned __int128) a * (unsigned __int128) b;