Skip to content

Commit 6870815

Browse files
committed
Add -march=native for gcc-compat on Intel
not valid on arm or other archs. Only for gcc-compatible compilers. 30% faster on small samples than -flto
1 parent a8062f8 commit 6870815

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

CMakeLists.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,21 @@ if(ipo_supported)
224224
message(STATUS "IPO / LTO enabled")
225225
set_property(GLOBAL PROPERTY INTERPROCEDURAL_OPTIMIZATION True)
226226
add_definitions(-DLTO)
227+
if ((CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
228+
OR (CMAKE_SYSTEM_PROCESSOR STREQUAL "i386")
229+
OR (CMAKE_SYSTEM_PROCESSOR STREQUAL "i586")
230+
OR (CMAKE_SYSTEM_PROCESSOR STREQUAL "i686")
231+
OR (CMAKE_SYSTEM_PROCESSOR STREQUAL "amd64") # freebsd
232+
OR (CMAKE_SYSTEM_PROCESSOR STREQUAL "AMD64") # windows
233+
OR (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86"))
234+
set(PROCESSOR_FAMILY "Intel")
235+
if(CMAKE_COMPILER_IS_GNUCC
236+
OR (CMAKE_CXX_COMPILER_ID STREQUAL AppleClang)
237+
OR (CMAKE_CXX_COMPILER_ID STREQUAL Clang)
238+
OR (CMAKE_CXX_COMPILER_ID STREQUAL Intel))
239+
add_definitions(-march=native)
240+
endif()
241+
endif()
227242
else()
228243
message(STATUS "IPO / LTO not supported: <${error}>")
229244
endif()

scripts/glucose_CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ set_target_properties(
1515
)
1616

1717
if(ipo_supported)
18-
set_property(TARGET minisat2-condensed PROPERTY INTERPROCEDURAL_OPTIMIZATION True)
18+
set_property(TARGET glucose-condensed PROPERTY INTERPROCEDURAL_OPTIMIZATION True)
1919
endif()
2020

2121
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")

0 commit comments

Comments
 (0)