mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
Merge pull request #212 from VectorCamp/bugfix/fix-simde-build
SIMDe on Clang needs SIMDE_NO_CHECK_IMMEDIATE_CONSTANT defined and other SIMDe related fixes now that SIMDe is part of the CI pipeline. Some issue with SIMDe on x86 still remains because of an upstream bug: https://github.com/simd-everywhere/simde/issues/1119 Similarly SIMDe native with clang on Arm also poses a non-high priority build failure: https://buildbot-ci.vectorcamp.gr/#/builders/129/builds/11 Possibly a SIMDe issue as well, need to investigate but will merge this PR as these are non-blockers.
This commit is contained in:
commit
3113d1ca30
@ -44,7 +44,7 @@ if (USE_CPU_NATIVE)
|
||||
endif()
|
||||
elseif (CMAKE_COMPILER_IS_CLANG)
|
||||
if (ARCH_IA32 OR ARCH_X86_64)
|
||||
set(GNUCC_ARCH x86_64_v2)
|
||||
set(GNUCC_ARCH x86-64-v2)
|
||||
set(TUNE_FLAG generic)
|
||||
elseif(ARCH_AARCH64)
|
||||
if (BUILD_SVE2_BITPERM)
|
||||
@ -68,8 +68,22 @@ if (USE_CPU_NATIVE)
|
||||
endif()
|
||||
else()
|
||||
if (SIMDE_BACKEND)
|
||||
set(GNUCC_ARCH native)
|
||||
set(TUNE_FLAG native)
|
||||
if (ARCH_IA32 OR ARCH_X86_64)
|
||||
set(GNUCC_ARCH x86-64-v2)
|
||||
set(TUNE_FLAG generic)
|
||||
elseif(ARCH_AARCH64)
|
||||
set(GNUCC_ARCH armv8-a)
|
||||
set(TUNE_FLAG generic)
|
||||
elseif(ARCH_ARM32)
|
||||
set(GNUCC_ARCH armv7a)
|
||||
set(TUNE_FLAG generic)
|
||||
elseif(ARCH_PPC64EL)
|
||||
set(GNUCC_ARCH power8)
|
||||
set(TUNE_FLAG power8)
|
||||
else()
|
||||
set(GNUCC_ARCH native)
|
||||
set(TUNE_FLAG generic)
|
||||
endif()
|
||||
elseif (ARCH_IA32 OR ARCH_X86_64)
|
||||
set(GNUCC_ARCH native)
|
||||
set(TUNE_FLAG generic)
|
||||
|
@ -7,28 +7,28 @@ if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
||||
endif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
||||
|
||||
option(FAT_RUNTIME "Build a library that supports multiple microarchitectures" OFF)
|
||||
message("Checking Fat Runtime Requirements...")
|
||||
if (FAT_RUNTIME AND NOT LINUX)
|
||||
message(FATAL_ERROR "Fat runtime is only supported on Linux OS")
|
||||
endif()
|
||||
|
||||
if (USE_CPU_NATIVE AND FAT_RUNTIME)
|
||||
message(FATAL_ERROR "Fat runtime is not compatible with Native CPU detection")
|
||||
endif()
|
||||
|
||||
if (FAT_RUNTIME AND LINUX)
|
||||
if (NOT (ARCH_IA32 OR ARCH_X86_64 OR ARCH_AARCH64))
|
||||
message(FATAL_ERROR "Fat runtime is only supported on Intel and Aarch64 architectures")
|
||||
if (FAT_RUNTIME)
|
||||
message("Checking Fat Runtime Requirements...")
|
||||
if (NOT LINUX)
|
||||
message(FATAL_ERROR "Fat runtime is only supported on Linux OS")
|
||||
else()
|
||||
message(STATUS "Building Fat runtime for multiple microarchitectures")
|
||||
message(STATUS "generator is ${CMAKE_GENERATOR}")
|
||||
if (NOT (CMAKE_GENERATOR MATCHES "Unix Makefiles" OR
|
||||
(CMAKE_VERSION VERSION_GREATER "3.0" AND CMAKE_GENERATOR MATCHES "Ninja")))
|
||||
message (FATAL_ERROR "Building the fat runtime requires the Unix Makefiles generator, or Ninja with CMake v3.0 or higher")
|
||||
if (USE_CPU_NATIVE AND FAT_RUNTIME)
|
||||
message(FATAL_ERROR "Fat runtime is not compatible with Native CPU detection")
|
||||
endif()
|
||||
|
||||
if (NOT (ARCH_IA32 OR ARCH_X86_64 OR ARCH_AARCH64))
|
||||
message(FATAL_ERROR "Fat runtime is only supported on Intel and Aarch64 architectures")
|
||||
else()
|
||||
include (${CMAKE_MODULE_PATH}/attrib.cmake)
|
||||
if (NOT HAS_C_ATTR_IFUNC)
|
||||
message(FATAL_ERROR "Compiler does not support ifunc attribute, cannot build fat runtime")
|
||||
message(STATUS "Building Fat runtime for multiple microarchitectures")
|
||||
message(STATUS "generator is ${CMAKE_GENERATOR}")
|
||||
if (NOT (CMAKE_GENERATOR MATCHES "Unix Makefiles" OR
|
||||
(CMAKE_VERSION VERSION_GREATER "3.0" AND CMAKE_GENERATOR MATCHES "Ninja")))
|
||||
message (FATAL_ERROR "Building the fat runtime requires the Unix Makefiles generator, or Ninja with CMake v3.0 or higher")
|
||||
else()
|
||||
include (${CMAKE_MODULE_PATH}/attrib.cmake)
|
||||
if (NOT HAS_C_ATTR_IFUNC)
|
||||
message(FATAL_ERROR "Compiler does not support ifunc attribute, cannot build fat runtime")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
@ -36,5 +36,3 @@ if (FAT_RUNTIME AND LINUX)
|
||||
message(FATAL_ERROR "Fat runtime is only built on Release builds")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
|
||||
|
@ -1,10 +1,16 @@
|
||||
include_directories(${PROJECT_SOURCE_DIR}/simde/simde)
|
||||
LIST(APPEND CMAKE_REQUIRED_INCLUDES ${PROJECT_SOURCE_DIR}/simde)
|
||||
|
||||
CHECK_INCLUDE_FILES("simde/x86/sse4.2.h" SIMDE_SSE42_H_FOUND)
|
||||
CHECK_INCLUDE_FILES(simde/x86/sse4.2.h SIMDE_SSE42_H_FOUND)
|
||||
|
||||
if (SIMDE_SSE42_H_FOUND)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DVS_SIMDE_BACKEND")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DVS_SIMDE_BACKEND")
|
||||
include_directories(${PROJECT_SOURCE_DIR}/simde)
|
||||
|
||||
if (CMAKE_COMPILER_IS_CLANG)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DSIMDE_NO_CHECK_IMMEDIATE_CONSTANT")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSIMDE_NO_CHECK_IMMEDIATE_CONSTANT")
|
||||
endif()
|
||||
|
||||
if (SIMDE_NATIVE)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DVS_SIMDE_NATIVE -DSIMDE_ENABLE_OPENMP -fopenmp-simd")
|
||||
|
@ -203,6 +203,11 @@ u64a pext64_impl(u64a x, u64a mask) {
|
||||
return pext64_impl_c(x, mask);
|
||||
}
|
||||
|
||||
static really_inline
|
||||
u64a pdep64_impl(u64a x, u64a mask) {
|
||||
return pdep64_impl_c(x, mask);
|
||||
}
|
||||
|
||||
/* compilers don't reliably synthesize the 32-bit ANDN instruction here,
|
||||
* so we force its generation.
|
||||
*/
|
||||
|
@ -201,7 +201,7 @@ u64a pext64_impl(u64a x, u64a mask) {
|
||||
}
|
||||
|
||||
static really_inline
|
||||
u64a pdep64(u64a x, u64a mask) {
|
||||
u64a pdep64_impl(u64a x, u64a mask) {
|
||||
return pdep64_impl_c(x, mask);
|
||||
}
|
||||
|
||||
|
@ -282,9 +282,14 @@ u64a pext64_impl(u64a x, u64a mask) {
|
||||
|
||||
#if defined(HAVE_BMI2) && defined(ARCH_64_BIT)
|
||||
static really_inline
|
||||
u64a pdep64(u64a x, u64a mask) {
|
||||
u64a pdep64_impl(u64a x, u64a mask) {
|
||||
return _pdep_u64(x, mask);
|
||||
}
|
||||
#else
|
||||
static really_inline
|
||||
u64a pdep64_impl(u64a x, u64a mask) {
|
||||
return pdep64_impl_c(x, mask);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* compilers don't reliably synthesize the 32-bit ANDN instruction here,
|
||||
|
@ -78,6 +78,7 @@
|
||||
#define rank_in_mask64_impl rank_in_mask64_impl_c
|
||||
#define pext32_impl pext32_impl_c
|
||||
#define pext64_impl pext64_impl_c
|
||||
#define pdep64_impl pdep64_impl_c
|
||||
#endif
|
||||
|
||||
static really_inline
|
||||
@ -207,6 +208,11 @@ u64a pext64(u64a x, u64a mask) {
|
||||
return pext64_impl(x, mask);
|
||||
}
|
||||
|
||||
static really_inline
|
||||
u64a pdep64(u64a x, u64a mask) {
|
||||
return pdep64_impl(x, mask);
|
||||
}
|
||||
|
||||
/* compilers don't reliably synthesize the 32-bit ANDN instruction here,
|
||||
* so we force its generation.
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user