Skip to content

Commit f220ef0

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 880d492 commit f220ef0

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
@@ -226,6 +226,21 @@ if(ipo_supported)
226226
message(STATUS "IPO / LTO enabled")
227227
set_property(GLOBAL PROPERTY INTERPROCEDURAL_OPTIMIZATION True)
228228
add_definitions(-DLTO)
229+
if ((CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
230+
OR (CMAKE_SYSTEM_PROCESSOR STREQUAL "i386")
231+
OR (CMAKE_SYSTEM_PROCESSOR STREQUAL "i586")
232+
OR (CMAKE_SYSTEM_PROCESSOR STREQUAL "i686")
233+
OR (CMAKE_SYSTEM_PROCESSOR STREQUAL "amd64") # freebsd
234+
OR (CMAKE_SYSTEM_PROCESSOR STREQUAL "AMD64") # windows
235+
OR (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86"))
236+
set(PROCESSOR_FAMILY "Intel")
237+
if(CMAKE_COMPILER_IS_GNUCC
238+
OR (CMAKE_CXX_COMPILER_ID STREQUAL AppleClang)
239+
OR (CMAKE_CXX_COMPILER_ID STREQUAL Clang)
240+
OR (CMAKE_CXX_COMPILER_ID STREQUAL Intel))
241+
add_definitions(-march=native)
242+
endif()
243+
endif()
229244
else()
230245
message(STATUS "IPO / LTO not supported: <${error}>")
231246
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)