Skip to content

Commit

Permalink
build: misc fixes for cmake build on i386
Browse files Browse the repository at this point in the history
Limit scope of SIMD detection to 64 bit x86 for:

    HAVE_INTEL_PCLMUL
    HAVE_INTEL_SSE4_1
    HAVE_INTEL_SSE4_2

resolving build failures in gf-complete on i386; this is
inline with the previous autotools based feature detection.

Only compile crypto/isa-l if yasm 64 bit complier is found,
effectively limiting scope to x86_64.

Signed-off-by: James Page <james.page@ubuntu.com>
  • Loading branch information
javacruft committed Jun 6, 2017
1 parent e38ca14 commit 31572c9
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 30 deletions.
60 changes: 32 additions & 28 deletions cmake/modules/SIMDExt.cmake
Expand Up @@ -75,34 +75,38 @@ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "arm|ARM")

elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "i386|i686|amd64|x86_64|AMD64")
set(HAVE_INTEL 1)
CHECK_C_COMPILER_FLAG(-msse HAVE_INTEL_SSE)
if(HAVE_INTEL_SSE)
set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -msse")
endif()
CHECK_C_COMPILER_FLAG(-msse2 HAVE_INTEL_SSE2)
if(HAVE_INTEL_SSE2)
set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -msse2")
endif()
CHECK_C_COMPILER_FLAG(-msse3 HAVE_INTEL_SSE3)
if(HAVE_INTEL_SSE3)
set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -msse3")
endif()
CHECK_C_COMPILER_FLAG(-mssse3 HAVE_INTEL_SSSE3)
if(HAVE_INTEL_SSSE3)
set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -mssse3")
endif()
CHECK_C_COMPILER_FLAG(-mpclmul HAVE_INTEL_PCLMUL)
if(HAVE_INTEL_PCLMUL)
set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -mpclmul")
endif()
CHECK_C_COMPILER_FLAG(-msse4.1 HAVE_INTEL_SSE4_1)
if(HAVE_INTEL_SSE4_1)
set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -msse4.1")
endif()
CHECK_C_COMPILER_FLAG(-msse4.2 HAVE_INTEL_SSE4_2)
if(HAVE_INTEL_SSE4_2)
set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -msse4.2")
endif()
if(CMAKE_SYSTEM_PROCESSOR MATCHES "i686|amd64|x86_64|AMD64")
CHECK_C_COMPILER_FLAG(-msse HAVE_INTEL_SSE)
if(HAVE_INTEL_SSE)
set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -msse")
endif()
if(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64|x86_64|AMD64")
CHECK_C_COMPILER_FLAG(-msse2 HAVE_INTEL_SSE2)
if(HAVE_INTEL_SSE2)
set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -msse2")
endif()
CHECK_C_COMPILER_FLAG(-msse3 HAVE_INTEL_SSE3)
if(HAVE_INTEL_SSE3)
set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -msse3")
endif()
CHECK_C_COMPILER_FLAG(-mssse3 HAVE_INTEL_SSSE3)
if(HAVE_INTEL_SSSE3)
set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -mssse3")
endif()
CHECK_C_COMPILER_FLAG(-mpclmul HAVE_INTEL_PCLMUL)
if(HAVE_INTEL_PCLMUL)
set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -mpclmul")
endif()
CHECK_C_COMPILER_FLAG(-msse4.1 HAVE_INTEL_SSE4_1)
if(HAVE_INTEL_SSE4_1)
set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -msse4.1")
endif()
CHECK_C_COMPILER_FLAG(-msse4.2 HAVE_INTEL_SSE4_2)
if(HAVE_INTEL_SSE4_2)
set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -msse4.2")
endif()
endif(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64|x86_64|AMD64")
endif(CMAKE_SYSTEM_PROCESSOR MATCHES "i686|amd64|x86_64|AMD64")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "(powerpc|ppc)64le")
set(HAVE_PPC64LE 1)
message(STATUS " we are ppc64le")
Expand Down
4 changes: 2 additions & 2 deletions src/CMakeLists.txt
Expand Up @@ -898,9 +898,9 @@ if(WITH_TESTS)
DESTINATION bin)
endif(WITH_TESTS)

if(HAVE_INTEL)
if(HAVE_INTEL AND HAVE_BETTER_YASM_ELF64)
add_subdirectory(crypto/isa-l)
endif(HAVE_INTEL)
endif(HAVE_INTEL AND HAVE_BETTER_YASM_ELF64)

if(WITH_TESTS)

Expand Down

0 comments on commit 31572c9

Please sign in to comment.