diff --git a/cmake/asm.cmake b/cmake/asm.cmake index d6c88e99f..cb50f0d95 100644 --- a/cmake/asm.cmake +++ b/cmake/asm.cmake @@ -1,20 +1,23 @@ if (WITH_ASM AND NOT XMRIG_ARM AND CMAKE_SIZEOF_VOID_P EQUAL 8) set(XMRIG_ASM_LIBRARY "xmrig-asm") - if (CMAKE_CXX_COMPILER_ID MATCHES MSVC) + if (CMAKE_C_COMPILER_ID MATCHES MSVC) enable_language(ASM_MASM) - set_property(SOURCE "src/crypto/asm/cnv2_main_loop.asm" PROPERTY ASM_MASM) - add_library(${XMRIG_ASM_LIBRARY} STATIC - "src/crypto/asm/cnv2_main_loop.asm" - ) + set(XMRIG_ASM_FILE "src/crypto/asm/cnv2_main_loop.asm") + set_property(SOURCE ${XMRIG_ASM_FILE} PROPERTY ASM_MASM) else() enable_language(ASM) - set_property(SOURCE "src/crypto/asm/cnv2_main_loop.S" PROPERTY C) - add_library(${XMRIG_ASM_LIBRARY} STATIC - "src/crypto/asm/cnv2_main_loop.S" - ) + + if (WIN32 AND CMAKE_C_COMPILER_ID MATCHES GNU) + set(XMRIG_ASM_FILE "src/crypto/asm/cnv2_main_loop_win.S") + else() + set(XMRIG_ASM_FILE "src/crypto/asm/cnv2_main_loop.S") + endif() + + set_property(SOURCE ${XMRIG_ASM_FILE} PROPERTY C) endif() + add_library(${XMRIG_ASM_LIBRARY} STATIC ${XMRIG_ASM_FILE}) set(XMRIG_ASM_SOURCES src/crypto/Asm.h src/crypto/Asm.cpp) set_property(TARGET ${XMRIG_ASM_LIBRARY} PROPERTY LINKER_LANGUAGE C) else() diff --git a/src/crypto/asm/cnv2_main_loop_win.S b/src/crypto/asm/cnv2_main_loop_win.S new file mode 100644 index 000000000..3c2028b61 --- /dev/null +++ b/src/crypto/asm/cnv2_main_loop_win.S @@ -0,0 +1,15 @@ +#define ALIGN .align +.intel_syntax noprefix +.section .text +.global cnv2_mainloop_ivybridge_asm +.global cnv2_mainloop_ryzen_asm + +ALIGN 16 +cnv2_mainloop_ivybridge_asm: + #include "cnv2_main_loop_ivybridge.inc" + ret 0 + +ALIGN 16 +cnv2_mainloop_ryzen_asm: + #include "cnv2_main_loop_ryzen.inc" + ret 0