Add AVX/AVX2 compile options

This commit is contained in:
Jack Andersen 2017-12-15 15:33:19 -10:00
parent ce2ed8cec6
commit 77082fe57d
2 changed files with 19 additions and 11 deletions

View File

@ -13,17 +13,19 @@ find_package(Sanitizers)
option(URDE_SSE2 "Enable SSE2 flags." Off)
option(URDE_SSE3 "Enable SSE3 flags." On)
option(URDE_SSE41 "Enable SSE4.1 flags." Off)
option(URDE_AVX "Enable AVX flags." Off)
option(URDE_AVX2 "Enable AVX2 flags." Off)
if(MSVC)
if(URDE_SSE41)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE2")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /arch:SSE2")
elseif(URDE_SSE3)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE2")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /arch:SSE2")
elseif(URDE_SSE2)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE2")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /arch:SSE2")
if(URDE_AVX2)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:AVX2 -D__SSE4_1__=1")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /arch:SSE2 -D__SSE4_1__=1")
elseif(URDE_AVX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:AVX -D__SSE4_1__=1")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /arch:SSE2 -D__SSE4_1__=1")
elseif(URDE_SSE41)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__SSE4_1__=1")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__SSE4_1__=1")
endif()
if(${CMAKE_GENERATOR} MATCHES "Visual Studio*")
@ -52,7 +54,13 @@ if(MSVC)
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "/DEBUG /RELEASE /LTCG /OPT:REF /OPT:ICF /INCREMENTAL:NO /DEBUGTYPE:cv,fixup")
else()
if(URDE_SSE41)
if(URDE_AVX2)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx2")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx2")
elseif(URDE_AVX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx")
elseif(URDE_SSE41)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.1")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse4.1")
elseif(URDE_SSE3)

@ -1 +1 @@
Subproject commit 0e4c7e20eab7e737fa114dab7fdeb5d54497fd5f
Subproject commit 3bca18381dd63708217e98db9684f8e37f022bca