Fixed MingGW compilation

This commit is contained in:
SChernykh 2019-07-01 20:48:51 +02:00
parent 6eb9d0963b
commit 915729bec6
8 changed files with 31 additions and 25 deletions

View file

@ -185,13 +185,16 @@ if (WITH_RANDOMX)
src/crypto/randomx/vm_compiled_light.cpp src/crypto/randomx/vm_compiled_light.cpp
src/crypto/randomx/blake2/blake2b.c src/crypto/randomx/blake2/blake2b.c
) )
if (NOT ARCH_ID)
set(ARCH_ID ${CMAKE_HOST_SYSTEM_PROCESSOR})
endif()
if (CMAKE_C_COMPILER_ID MATCHES MSVC) if (CMAKE_C_COMPILER_ID MATCHES MSVC)
enable_language(ASM_MASM) enable_language(ASM_MASM)
list(APPEND SOURCES_CRYPTO list(APPEND SOURCES_CRYPTO
src/crypto/randomx/jit_compiler_x86_static.asm src/crypto/randomx/jit_compiler_x86_static.asm
src/crypto/randomx/jit_compiler_x86.cpp src/crypto/randomx/jit_compiler_x86.cpp
) )
elseif (ARCH_ID STREQUAL "x86_64" OR ARCH_ID STREQUAL "x86-64" OR ARCH_ID STREQUAL "amd64") elseif (ARCH_ID STREQUAL "x86_64" OR ARCH_ID STREQUAL "x86-64" OR ARCH_ID STREQUAL "amd64" OR ARCH_ID STREQUAL "AMD64")
list(APPEND SOURCES_CRYPTO list(APPEND SOURCES_CRYPTO
src/crypto/randomx/jit_compiler_x86_static.S src/crypto/randomx/jit_compiler_x86_static.S
src/crypto/randomx/jit_compiler_x86.cpp src/crypto/randomx/jit_compiler_x86.cpp

View file

@ -17,7 +17,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES GNU)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-strict-aliasing") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-strict-aliasing")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Ofast") set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Ofast")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-exceptions -fno-rtti -Wno-class-memaccess") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fexceptions -fno-rtti -Wno-class-memaccess")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Ofast -s") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Ofast -s")
if (XMRIG_ARMv8) if (XMRIG_ARMv8)

View file

@ -161,11 +161,11 @@ namespace randomx {
} }
static void exe_IROR_R(RANDOMX_EXE_ARGS) { static void exe_IROR_R(RANDOMX_EXE_ARGS) {
*ibc.idst = rotr(*ibc.idst, *ibc.isrc & 63); *ibc.idst = rotr64(*ibc.idst, *ibc.isrc & 63);
} }
static void exe_IROL_R(RANDOMX_EXE_ARGS) { static void exe_IROL_R(RANDOMX_EXE_ARGS) {
*ibc.idst = rotl(*ibc.idst, *ibc.isrc & 63); *ibc.idst = rotl64(*ibc.idst, *ibc.isrc & 63);
} }
static void exe_ISWAP_R(RANDOMX_EXE_ARGS) { static void exe_ISWAP_R(RANDOMX_EXE_ARGS) {
@ -225,7 +225,7 @@ namespace randomx {
} }
static void exe_CFROUND(RANDOMX_EXE_ARGS) { static void exe_CFROUND(RANDOMX_EXE_ARGS) {
rx_set_rounding_mode(rotr(*ibc.isrc, ibc.imm) % 4); rx_set_rounding_mode(rotr64(*ibc.isrc, ibc.imm) % 4);
} }
static void exe_ISTORE(RANDOMX_EXE_ARGS) { static void exe_ISTORE(RANDOMX_EXE_ARGS) {

View file

@ -59,13 +59,13 @@ namespace randomx {
//static_assert(RANDOMX_JUMP_OFFSET >= 0, "RANDOMX_JUMP_OFFSET must be greater than or equal to 0."); //static_assert(RANDOMX_JUMP_OFFSET >= 0, "RANDOMX_JUMP_OFFSET must be greater than or equal to 0.");
//static_assert(RANDOMX_JUMP_BITS + RANDOMX_JUMP_OFFSET <= 16, "RANDOMX_JUMP_BITS + RANDOMX_JUMP_OFFSET must not exceed 16."); //static_assert(RANDOMX_JUMP_BITS + RANDOMX_JUMP_OFFSET <= 16, "RANDOMX_JUMP_BITS + RANDOMX_JUMP_OFFSET must not exceed 16.");
//constexpr int wtSum = RANDOMX_FREQ_IADD_RS + RANDOMX_FREQ_IADD_M + RANDOMX_FREQ_ISUB_R + \ /*constexpr int wtSum = RANDOMX_FREQ_IADD_RS + RANDOMX_FREQ_IADD_M + RANDOMX_FREQ_ISUB_R + \
// RANDOMX_FREQ_ISUB_M + RANDOMX_FREQ_IMUL_R + RANDOMX_FREQ_IMUL_M + RANDOMX_FREQ_IMULH_R + \ RANDOMX_FREQ_ISUB_M + RANDOMX_FREQ_IMUL_R + RANDOMX_FREQ_IMUL_M + RANDOMX_FREQ_IMULH_R + \
// RANDOMX_FREQ_IMULH_M + RANDOMX_FREQ_ISMULH_R + RANDOMX_FREQ_ISMULH_M + RANDOMX_FREQ_IMUL_RCP + \ RANDOMX_FREQ_IMULH_M + RANDOMX_FREQ_ISMULH_R + RANDOMX_FREQ_ISMULH_M + RANDOMX_FREQ_IMUL_RCP + \
// RANDOMX_FREQ_INEG_R + RANDOMX_FREQ_IXOR_R + RANDOMX_FREQ_IXOR_M + RANDOMX_FREQ_IROR_R + RANDOMX_FREQ_IROL_R + RANDOMX_FREQ_ISWAP_R + \ RANDOMX_FREQ_INEG_R + RANDOMX_FREQ_IXOR_R + RANDOMX_FREQ_IXOR_M + RANDOMX_FREQ_IROR_R + RANDOMX_FREQ_IROL_R + RANDOMX_FREQ_ISWAP_R + \
// RANDOMX_FREQ_FSWAP_R + RANDOMX_FREQ_FADD_R + RANDOMX_FREQ_FADD_M + RANDOMX_FREQ_FSUB_R + RANDOMX_FREQ_FSUB_M + \ RANDOMX_FREQ_FSWAP_R + RANDOMX_FREQ_FADD_R + RANDOMX_FREQ_FADD_M + RANDOMX_FREQ_FSUB_R + RANDOMX_FREQ_FSUB_M + \
// RANDOMX_FREQ_FSCAL_R + RANDOMX_FREQ_FMUL_R + RANDOMX_FREQ_FDIV_M + RANDOMX_FREQ_FSQRT_R + RANDOMX_FREQ_CBRANCH + \ RANDOMX_FREQ_FSCAL_R + RANDOMX_FREQ_FMUL_R + RANDOMX_FREQ_FDIV_M + RANDOMX_FREQ_FSQRT_R + RANDOMX_FREQ_CBRANCH + \
// RANDOMX_FREQ_CFROUND + RANDOMX_FREQ_ISTORE + RANDOMX_FREQ_NOP; RANDOMX_FREQ_CFROUND + RANDOMX_FREQ_ISTORE + RANDOMX_FREQ_NOP;*/
//static_assert(wtSum == 256, "Sum of instruction frequencies must be 256."); //static_assert(wtSum == 256, "Sum of instruction frequencies must be 256.");

View file

@ -51,14 +51,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <intrin.h> #include <intrin.h>
#include <stdlib.h> #include <stdlib.h>
uint64_t rotl(uint64_t x, unsigned int c) { uint64_t rotl64(uint64_t x, unsigned int c) {
return _rotl64(x, c); return _rotl64(x, c);
} }
uint64_t rotr(uint64_t x, unsigned int c) { uint64_t rotr64(uint64_t x, unsigned int c) {
return _rotr64(x, c); return _rotr64(x, c);
} }
#define HAVE_ROTL #define HAVE_ROTL64
#define HAVE_ROTR #define HAVE_ROTR64
#if EVAL_DEFINE(__MACHINEARM64_X64(1)) #if EVAL_DEFINE(__MACHINEARM64_X64(1))
uint64_t mulh(uint64_t a, uint64_t b) { uint64_t mulh(uint64_t a, uint64_t b) {
@ -88,18 +88,18 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
} }
#endif #endif
#ifndef HAVE_ROTR #ifndef HAVE_ROTR64
uint64_t rotr(uint64_t a, unsigned int b) { uint64_t rotr64(uint64_t a, unsigned int b) {
return (a >> b) | (a << (-b & 63)); return (a >> b) | (a << (-b & 63));
} }
#define HAVE_ROTR #define HAVE_ROTR64
#endif #endif
#ifndef HAVE_ROTL #ifndef HAVE_ROTL64
uint64_t rotl(uint64_t a, unsigned int b) { uint64_t rotl64(uint64_t a, unsigned int b) {
return (a << b) | (a >> (-b & 63)); return (a << b) | (a >> (-b & 63));
} }
#define HAVE_ROTL #define HAVE_ROTL64
#endif #endif
#ifndef HAVE_MULH #ifndef HAVE_MULH

View file

@ -601,5 +601,5 @@ FORCE_INLINE rx_vec_i128 rx_aesdec_vec_i128(rx_vec_i128 v, rx_vec_i128 rkey) {
double loadDoublePortable(const void* addr); double loadDoublePortable(const void* addr);
uint64_t mulh(uint64_t, uint64_t); uint64_t mulh(uint64_t, uint64_t);
int64_t smulh(int64_t, int64_t); int64_t smulh(int64_t, int64_t);
uint64_t rotl(uint64_t, unsigned int); uint64_t rotl64(uint64_t, unsigned int);
uint64_t rotr(uint64_t, unsigned int); uint64_t rotr64(uint64_t, unsigned int);

View file

@ -859,7 +859,7 @@ namespace randomx {
r[instr.dst] *= r[instr.src]; r[instr.dst] *= r[instr.src];
break; break;
case SuperscalarInstructionType::IROR_C: case SuperscalarInstructionType::IROR_C:
r[instr.dst] = rotr(r[instr.dst], instr.getImm32()); r[instr.dst] = rotr64(r[instr.dst], instr.getImm32());
break; break;
case SuperscalarInstructionType::IADD_C7: case SuperscalarInstructionType::IADD_C7:
case SuperscalarInstructionType::IADD_C8: case SuperscalarInstructionType::IADD_C8:

View file

@ -410,6 +410,9 @@ void Workers::updateDataset(const uint8_t* seed_hash, xmrig::Variant variant, co
case xmrig::VARIANT_RX_LOKI: case xmrig::VARIANT_RX_LOKI:
randomx_apply_config(RandomX_LokiConfig); randomx_apply_config(RandomX_LokiConfig);
break; break;
default:
randomx_apply_config(RandomX_MoneroConfig);
break;
} }
m_rx_variant = variant; m_rx_variant = variant;
} }