2018-09-18 03:19:53 +00:00
|
|
|
# detect SIMD extensions
|
2016-09-02 06:38:21 +00:00
|
|
|
#
|
arch,cmake: compile ppc.c on all powerpc machines
* cmake/modules/SIMDExt.cmake: define HAVE_PPC for 32-bit PowerPC.
* src/arch/CMakeLists.txt: compile ppc.c for all PowerPC architectures,
including powerpc (32-bit PowerPC), ppc64el (64-bit Little Endian
PowerPC) and ppc64 (64-bit Big Endian PowerPC).
before this change, ppc.c is only compiled if HAVE_POWER8 is defined.
but Power8 is a 64-bit PowerPC architecture. while in src/arch/probe.cc,
we check for `defined(__powerpc__) || defined(__ppc__)`, if this is
true, ceph_arch_ppc_probe() is used to check for the support of
Altivec. but on non-power8 PowerPC machines, the linker fails to find the
symbols like ceph_arch_ppc_probe(), as ppc.c is not compiled on them.
in this change, ppc.c is compiled on all PowerPC architectures, so that
ceph_arch_ppc_probe() is also available on non-power8 machines. this
change does not impact the behavior of non-power8 machines. because
on them, the runtime check would fail to detect the existence of
PPC_FEATURE2_VEC_CRYPTO instructions.
Reported-by: Mattias Ellert <mattias.ellert@physics.uu.se>
Signed-off-by: Kefu Chai <tchaikov@gmail.com>
2021-08-29 14:24:30 +00:00
|
|
|
# HAVE_ARM
|
2016-09-02 06:38:21 +00:00
|
|
|
# HAVE_ARMV8_CRC
|
arch,cmake: compile ppc.c on all powerpc machines
* cmake/modules/SIMDExt.cmake: define HAVE_PPC for 32-bit PowerPC.
* src/arch/CMakeLists.txt: compile ppc.c for all PowerPC architectures,
including powerpc (32-bit PowerPC), ppc64el (64-bit Little Endian
PowerPC) and ppc64 (64-bit Big Endian PowerPC).
before this change, ppc.c is only compiled if HAVE_POWER8 is defined.
but Power8 is a 64-bit PowerPC architecture. while in src/arch/probe.cc,
we check for `defined(__powerpc__) || defined(__ppc__)`, if this is
true, ceph_arch_ppc_probe() is used to check for the support of
Altivec. but on non-power8 PowerPC machines, the linker fails to find the
symbols like ceph_arch_ppc_probe(), as ppc.c is not compiled on them.
in this change, ppc.c is compiled on all PowerPC architectures, so that
ceph_arch_ppc_probe() is also available on non-power8 machines. this
change does not impact the behavior of non-power8 machines. because
on them, the runtime check would fail to detect the existence of
PPC_FEATURE2_VEC_CRYPTO instructions.
Reported-by: Mattias Ellert <mattias.ellert@physics.uu.se>
Signed-off-by: Kefu Chai <tchaikov@gmail.com>
2021-08-29 14:24:30 +00:00
|
|
|
# HAVE_ARMV8_CRC_CRYPTO_INTRINSICS
|
|
|
|
# HAVE_ARMV8_CRYPTO
|
2016-09-22 19:40:52 +00:00
|
|
|
# HAVE_ARMV8_SIMD
|
|
|
|
# HAVE_ARM_NEON
|
arch,cmake: compile ppc.c on all powerpc machines
* cmake/modules/SIMDExt.cmake: define HAVE_PPC for 32-bit PowerPC.
* src/arch/CMakeLists.txt: compile ppc.c for all PowerPC architectures,
including powerpc (32-bit PowerPC), ppc64el (64-bit Little Endian
PowerPC) and ppc64 (64-bit Big Endian PowerPC).
before this change, ppc.c is only compiled if HAVE_POWER8 is defined.
but Power8 is a 64-bit PowerPC architecture. while in src/arch/probe.cc,
we check for `defined(__powerpc__) || defined(__ppc__)`, if this is
true, ceph_arch_ppc_probe() is used to check for the support of
Altivec. but on non-power8 PowerPC machines, the linker fails to find the
symbols like ceph_arch_ppc_probe(), as ppc.c is not compiled on them.
in this change, ppc.c is compiled on all PowerPC architectures, so that
ceph_arch_ppc_probe() is also available on non-power8 machines. this
change does not impact the behavior of non-power8 machines. because
on them, the runtime check would fail to detect the existence of
PPC_FEATURE2_VEC_CRYPTO instructions.
Reported-by: Mattias Ellert <mattias.ellert@physics.uu.se>
Signed-off-by: Kefu Chai <tchaikov@gmail.com>
2021-08-29 14:24:30 +00:00
|
|
|
#
|
|
|
|
# HAVE_INTEL
|
2016-09-22 19:40:52 +00:00
|
|
|
# HAVE_INTEL_SSE
|
|
|
|
# HAVE_INTEL_SSE2
|
|
|
|
# HAVE_INTEL_SSE3
|
|
|
|
# HAVE_INTEL_SSSE3
|
|
|
|
# HAVE_INTEL_PCLMUL
|
|
|
|
# HAVE_INTEL_SSE4_1
|
|
|
|
# HAVE_INTEL_SSE4_2
|
2016-09-02 06:38:21 +00:00
|
|
|
#
|
arch,cmake: compile ppc.c on all powerpc machines
* cmake/modules/SIMDExt.cmake: define HAVE_PPC for 32-bit PowerPC.
* src/arch/CMakeLists.txt: compile ppc.c for all PowerPC architectures,
including powerpc (32-bit PowerPC), ppc64el (64-bit Little Endian
PowerPC) and ppc64 (64-bit Big Endian PowerPC).
before this change, ppc.c is only compiled if HAVE_POWER8 is defined.
but Power8 is a 64-bit PowerPC architecture. while in src/arch/probe.cc,
we check for `defined(__powerpc__) || defined(__ppc__)`, if this is
true, ceph_arch_ppc_probe() is used to check for the support of
Altivec. but on non-power8 PowerPC machines, the linker fails to find the
symbols like ceph_arch_ppc_probe(), as ppc.c is not compiled on them.
in this change, ppc.c is compiled on all PowerPC architectures, so that
ceph_arch_ppc_probe() is also available on non-power8 machines. this
change does not impact the behavior of non-power8 machines. because
on them, the runtime check would fail to detect the existence of
PPC_FEATURE2_VEC_CRYPTO instructions.
Reported-by: Mattias Ellert <mattias.ellert@physics.uu.se>
Signed-off-by: Kefu Chai <tchaikov@gmail.com>
2021-08-29 14:24:30 +00:00
|
|
|
# HAVE_PPC64LE
|
|
|
|
# HAVE_PPC64
|
|
|
|
# HAVE_PPC
|
|
|
|
#
|
2016-09-22 19:40:52 +00:00
|
|
|
# SIMD_COMPILE_FLAGS
|
2016-09-02 06:38:21 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|AARCH64")
|
2016-09-21 14:00:01 +00:00
|
|
|
set(HAVE_ARM 1)
|
2018-09-19 06:17:38 +00:00
|
|
|
include(CheckCCompilerFlag)
|
2017-03-25 03:12:38 +00:00
|
|
|
|
2018-09-19 06:17:38 +00:00
|
|
|
check_c_compiler_flag(-march=armv8-a+crc+crypto HAVE_ARMV8_CRC_CRYPTO_INTRINSICS)
|
2017-01-13 04:36:39 +00:00
|
|
|
if(HAVE_ARMV8_CRC_CRYPTO_INTRINSICS)
|
2018-09-19 06:17:38 +00:00
|
|
|
set(ARMV8_CRC_COMPILE_FLAGS "-march=armv8-a+crc+crypto")
|
|
|
|
set(HAVE_ARMV8_CRC TRUE)
|
|
|
|
set(HAVE_ARMV8_CRYPTO TRUE)
|
|
|
|
else()
|
|
|
|
check_c_compiler_flag(-march=armv8-a+crc HAVE_ARMV8_CRC)
|
|
|
|
check_c_compiler_flag(-march=armv8-a+crypto HAVE_ARMV8_CRYPTO)
|
|
|
|
if(HAVE_ARMV8_CRC)
|
|
|
|
set(ARMV8_CRC_COMPILE_FLAGS "-march=armv8-a+crc")
|
|
|
|
elseif(HAVE_ARMV8_CRYPTO)
|
|
|
|
set(ARMV8_CRC_COMPILE_FLAGS "-march=armv8-a+crypto")
|
|
|
|
endif()
|
2017-01-13 04:36:39 +00:00
|
|
|
endif()
|
2017-03-25 03:10:15 +00:00
|
|
|
|
2016-09-22 19:40:52 +00:00
|
|
|
CHECK_C_COMPILER_FLAG(-march=armv8-a+simd HAVE_ARMV8_SIMD)
|
|
|
|
if(HAVE_ARMV8_SIMD)
|
|
|
|
set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -march=armv8-a+simd")
|
2016-09-02 06:38:21 +00:00
|
|
|
endif()
|
2017-03-25 03:10:15 +00:00
|
|
|
|
2016-09-02 06:38:21 +00:00
|
|
|
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "arm|ARM")
|
2017-01-13 04:36:39 +00:00
|
|
|
set(HAVE_ARM 1)
|
2016-09-22 19:40:52 +00:00
|
|
|
CHECK_C_COMPILER_FLAG(-mfpu=neon HAVE_ARM_NEON)
|
|
|
|
if(HAVE_ARM_NEON)
|
|
|
|
set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -mfpu=neon")
|
2016-09-02 06:38:21 +00:00
|
|
|
endif()
|
2017-03-25 03:10:15 +00:00
|
|
|
|
2016-09-02 06:38:21 +00:00
|
|
|
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "i386|i686|amd64|x86_64|AMD64")
|
2017-01-13 04:36:39 +00:00
|
|
|
set(HAVE_INTEL 1)
|
2017-06-06 14:01:40 +00:00
|
|
|
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")
|
arch,cmake: compile ppc.c on all powerpc machines
* cmake/modules/SIMDExt.cmake: define HAVE_PPC for 32-bit PowerPC.
* src/arch/CMakeLists.txt: compile ppc.c for all PowerPC architectures,
including powerpc (32-bit PowerPC), ppc64el (64-bit Little Endian
PowerPC) and ppc64 (64-bit Big Endian PowerPC).
before this change, ppc.c is only compiled if HAVE_POWER8 is defined.
but Power8 is a 64-bit PowerPC architecture. while in src/arch/probe.cc,
we check for `defined(__powerpc__) || defined(__ppc__)`, if this is
true, ceph_arch_ppc_probe() is used to check for the support of
Altivec. but on non-power8 PowerPC machines, the linker fails to find the
symbols like ceph_arch_ppc_probe(), as ppc.c is not compiled on them.
in this change, ppc.c is compiled on all PowerPC architectures, so that
ceph_arch_ppc_probe() is also available on non-power8 machines. this
change does not impact the behavior of non-power8 machines. because
on them, the runtime check would fail to detect the existence of
PPC_FEATURE2_VEC_CRYPTO instructions.
Reported-by: Mattias Ellert <mattias.ellert@physics.uu.se>
Signed-off-by: Kefu Chai <tchaikov@gmail.com>
2021-08-29 14:24:30 +00:00
|
|
|
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "(powerpc|ppc)")
|
2017-07-31 17:50:23 +00:00
|
|
|
if(CMAKE_SYSTEM_PROCESSOR MATCHES "(powerpc|ppc)64le")
|
|
|
|
set(HAVE_PPC64LE 1)
|
|
|
|
message(STATUS " we are ppc64le")
|
arch,cmake: compile ppc.c on all powerpc machines
* cmake/modules/SIMDExt.cmake: define HAVE_PPC for 32-bit PowerPC.
* src/arch/CMakeLists.txt: compile ppc.c for all PowerPC architectures,
including powerpc (32-bit PowerPC), ppc64el (64-bit Little Endian
PowerPC) and ppc64 (64-bit Big Endian PowerPC).
before this change, ppc.c is only compiled if HAVE_POWER8 is defined.
but Power8 is a 64-bit PowerPC architecture. while in src/arch/probe.cc,
we check for `defined(__powerpc__) || defined(__ppc__)`, if this is
true, ceph_arch_ppc_probe() is used to check for the support of
Altivec. but on non-power8 PowerPC machines, the linker fails to find the
symbols like ceph_arch_ppc_probe(), as ppc.c is not compiled on them.
in this change, ppc.c is compiled on all PowerPC architectures, so that
ceph_arch_ppc_probe() is also available on non-power8 machines. this
change does not impact the behavior of non-power8 machines. because
on them, the runtime check would fail to detect the existence of
PPC_FEATURE2_VEC_CRYPTO instructions.
Reported-by: Mattias Ellert <mattias.ellert@physics.uu.se>
Signed-off-by: Kefu Chai <tchaikov@gmail.com>
2021-08-29 14:24:30 +00:00
|
|
|
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "(powerpc|ppc)64")
|
2017-07-31 17:50:23 +00:00
|
|
|
set(HAVE_PPC64 1)
|
|
|
|
message(STATUS " we are ppc64")
|
arch,cmake: compile ppc.c on all powerpc machines
* cmake/modules/SIMDExt.cmake: define HAVE_PPC for 32-bit PowerPC.
* src/arch/CMakeLists.txt: compile ppc.c for all PowerPC architectures,
including powerpc (32-bit PowerPC), ppc64el (64-bit Little Endian
PowerPC) and ppc64 (64-bit Big Endian PowerPC).
before this change, ppc.c is only compiled if HAVE_POWER8 is defined.
but Power8 is a 64-bit PowerPC architecture. while in src/arch/probe.cc,
we check for `defined(__powerpc__) || defined(__ppc__)`, if this is
true, ceph_arch_ppc_probe() is used to check for the support of
Altivec. but on non-power8 PowerPC machines, the linker fails to find the
symbols like ceph_arch_ppc_probe(), as ppc.c is not compiled on them.
in this change, ppc.c is compiled on all PowerPC architectures, so that
ceph_arch_ppc_probe() is also available on non-power8 machines. this
change does not impact the behavior of non-power8 machines. because
on them, the runtime check would fail to detect the existence of
PPC_FEATURE2_VEC_CRYPTO instructions.
Reported-by: Mattias Ellert <mattias.ellert@physics.uu.se>
Signed-off-by: Kefu Chai <tchaikov@gmail.com>
2021-08-29 14:24:30 +00:00
|
|
|
else()
|
|
|
|
set(HAVE_PPC 1)
|
|
|
|
endif()
|
2017-04-02 17:01:52 +00:00
|
|
|
CHECK_C_COMPILER_FLAG("-maltivec" HAS_ALTIVEC)
|
|
|
|
if(HAS_ALTIVEC)
|
|
|
|
message(STATUS " HAS_ALTIVEC yes")
|
2020-06-17 23:08:06 +00:00
|
|
|
add_compile_options(-maltivec)
|
2017-04-02 17:01:52 +00:00
|
|
|
endif()
|
|
|
|
CHECK_C_COMPILER_FLAG("-mcpu=power8" HAVE_POWER8)
|
|
|
|
if(HAVE_POWER8)
|
|
|
|
message(STATUS " HAVE_POWER8 yes")
|
|
|
|
endif()
|
2016-09-02 06:38:21 +00:00
|
|
|
endif()
|