From c2ae62503264b32d71ef4b4f6d214f578e7f4df0 Mon Sep 17 00:00:00 2001 From: SChernykh Date: Thu, 2 Dec 2021 13:34:24 +0100 Subject: [PATCH] Compilationn fixes --- src/crypto/cn/CnHash.cpp | 8 ++++---- src/crypto/cn/CryptoNight_x86.h | 14 +++++++++++++- src/crypto/randomx/randomx.cpp | 4 ++-- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/crypto/cn/CnHash.cpp b/src/crypto/cn/CnHash.cpp index 5e0918f57..a1ef90151 100644 --- a/src/crypto/cn/CnHash.cpp +++ b/src/crypto/cn/CnHash.cpp @@ -55,6 +55,10 @@ } while (0) +bool cn_sse41_enabled = false; +bool cn_vaes_enabled = false; + + #ifdef XMRIG_FEATURE_ASM # define ADD_FN_ASM(algo) do { \ m_map[algo]->data[AV_SINGLE][Assembly::INTEL] = cryptonight_single_hash_asm; \ @@ -66,10 +70,6 @@ } while (0) -bool cn_sse41_enabled = false; -bool cn_vaes_enabled = false; - - namespace xmrig { diff --git a/src/crypto/cn/CryptoNight_x86.h b/src/crypto/cn/CryptoNight_x86.h index 304477106..0d27f5e2b 100644 --- a/src/crypto/cn/CryptoNight_x86.h +++ b/src/crypto/cn/CryptoNight_x86.h @@ -634,12 +634,15 @@ static inline void cryptonight_conceal_tweak(__m128i& cx, __m128& conc_var) cx = _mm_xor_si128(cx, _mm_cvttps_epi32(nc)); } +#ifdef XMRIG_FEATURE_ASM template -void cryptonight_single_hash_gr_sse41(const uint8_t* __restrict__ input, size_t size, uint8_t* __restrict__ output, cryptonight_ctx** __restrict__ ctx, uint64_t height); +static void cryptonight_single_hash_gr_sse41(const uint8_t* __restrict__ input, size_t size, uint8_t* __restrict__ output, cryptonight_ctx** __restrict__ ctx, uint64_t height); +#endif template inline void cryptonight_single_hash(const uint8_t *__restrict__ input, size_t size, uint8_t *__restrict__ output, cryptonight_ctx **__restrict__ ctx, uint64_t height) { +# ifdef XMRIG_FEATURE_ASM if (!SOFT_AES) { switch (ALGO) { case Algorithm::CN_GR_0: @@ -658,6 +661,7 @@ inline void cryptonight_single_hash(const uint8_t *__restrict__ input, size_t si break; } } +# endif constexpr CnAlgo props; constexpr size_t MASK = props.mask(); @@ -1137,6 +1141,7 @@ inline void cryptonight_double_hash_asm(const uint8_t *__restrict__ input, size_ namespace xmrig { +#ifdef XMRIG_FEATURE_ASM template static NOINLINE void cryptonight_single_hash_gr_sse41(const uint8_t* __restrict__ input, size_t size, uint8_t* __restrict__ output, cryptonight_ctx** __restrict__ ctx, uint64_t height) { @@ -1233,11 +1238,13 @@ static NOINLINE void cryptonight_double_hash_gr_sse41(const uint8_t *__restrict_ extra_hashes[ctx[0]->state[0] & 3](ctx[0]->state, 200, output); extra_hashes[ctx[1]->state[0] & 3](ctx[1]->state, 200, output + 32); } +#endif template inline void cryptonight_double_hash(const uint8_t *__restrict__ input, size_t size, uint8_t *__restrict__ output, cryptonight_ctx **__restrict__ ctx, uint64_t height) { +# ifdef XMRIG_FEATURE_ASM if (!SOFT_AES) { switch (ALGO) { case Algorithm::CN_GR_0: @@ -1256,6 +1263,7 @@ inline void cryptonight_double_hash(const uint8_t *__restrict__ input, size_t si break; } } +# endif constexpr CnAlgo props; constexpr size_t MASK = props.mask(); @@ -1516,6 +1524,7 @@ inline void cryptonight_double_hash(const uint8_t *__restrict__ input, size_t si } +#ifdef XMRIG_FEATURE_ASM template static NOINLINE void cryptonight_quad_hash_gr_sse41(const uint8_t* __restrict__ input, size_t size, uint8_t* __restrict__ output, cryptonight_ctx** __restrict__ ctx, uint64_t height) { @@ -1591,6 +1600,7 @@ static NOINLINE void cryptonight_quad_hash_gr_sse41(const uint8_t* __restrict__ extra_hashes[ctx[2]->state[0] & 3](ctx[2]->state, 200, output + 64); extra_hashes[ctx[3]->state[0] & 3](ctx[3]->state, 200, output + 96); } +#endif #define CN_STEP1(a, b0, b1, c, l, ptr, idx, conc_var) \ @@ -1786,6 +1796,7 @@ inline void cryptonight_triple_hash(const uint8_t *__restrict__ input, size_t si template inline void cryptonight_quad_hash(const uint8_t *__restrict__ input, size_t size, uint8_t *__restrict__ output, cryptonight_ctx **__restrict__ ctx, uint64_t height) { +# ifdef XMRIG_FEATURE_ASM if (!SOFT_AES) { switch (ALGO) { case Algorithm::CN_GR_0: @@ -1804,6 +1815,7 @@ inline void cryptonight_quad_hash(const uint8_t *__restrict__ input, size_t size break; } } +# endif constexpr CnAlgo props; constexpr size_t MASK = props.mask(); diff --git a/src/crypto/randomx/randomx.cpp b/src/crypto/randomx/randomx.cpp index b7a3ecaf6..ed520aa84 100644 --- a/src/crypto/randomx/randomx.cpp +++ b/src/crypto/randomx/randomx.cpp @@ -295,7 +295,7 @@ typedef void(randomx::JitCompilerX86::* InstructionGeneratorX86_2)(const randomx INST_HANDLE(IMUL_R, ISUB_M); INST_HANDLE(IMUL_M, IMUL_R); -#if defined(_M_X64) || defined(__x86_64__) +#if defined(XMRIG_FEATURE_ASM) && (defined(_M_X64) || defined(__x86_64__)) if (hasBMI2) { INST_HANDLE2(IMULH_R, IMULH_R_BMI2, IMUL_M); INST_HANDLE2(IMULH_M, IMULH_M_BMI2, IMULH_R); @@ -337,7 +337,7 @@ typedef void(randomx::JitCompilerX86::* InstructionGeneratorX86_2)(const randomx INST_HANDLE(CBRANCH, FSQRT_R); #endif -#if defined(_M_X64) || defined(__x86_64__) +#if defined(XMRIG_FEATURE_ASM) && (defined(_M_X64) || defined(__x86_64__)) if (hasBMI2) { INST_HANDLE2(CFROUND, CFROUND_BMI2, CBRANCH); }