Skip to content

Commit 3552245

Browse files
grooverdanspetrunia
authored andcommitted
RocksDB: use crc32c optimised version for POWER
1 parent bff9b80 commit 3552245

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

storage/rocksdb/build_rocksdb.cmake

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,24 @@ if(NOT WIN32)
112112
add_definitions(-DROCKSDB_PLATFORM_POSIX -DROCKSDB_LIB_IO_POSIX)
113113
endif()
114114

115+
include(CheckCCompilerFlag)
116+
# ppc64 or ppc64le
117+
if(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64")
118+
CHECK_C_COMPILER_FLAG("-maltivec" HAS_ALTIVEC)
119+
if(HAS_ALTIVEC)
120+
message(STATUS " HAS_ALTIVEC yes")
121+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -maltivec")
122+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -maltivec")
123+
endif(HAS_ALTIVEC)
124+
if(NOT CMAKE_C_FLAGS MATCHES "m(cpu|tune)")
125+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mcpu=power8")
126+
endif()
127+
if(NOT CMAKE_CXX_FLAGS MATCHES "m(cpu|tune)")
128+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcpu=power8")
129+
endif()
130+
ADD_DEFINITIONS(-DHAVE_POWER8 -DHAS_ALTIVEC)
131+
endif(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64")
132+
115133
option(WITH_FALLOCATE "build with fallocate" ON)
116134

117135
if(WITH_FALLOCATE AND UNIX)
@@ -377,6 +395,13 @@ else()
377395
port/port_posix.cc
378396
env/env_posix.cc
379397
env/io_posix.cc)
398+
# ppc64 or ppc64le
399+
if(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64")
400+
enable_language(ASM)
401+
list(APPEND ROCKSDB_SOURCES
402+
util/crc32c_ppc.c
403+
util/crc32c_ppc_asm.S)
404+
endif(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64")
380405
endif()
381406
SET(SOURCES)
382407
FOREACH(s ${ROCKSDB_SOURCES})

0 commit comments

Comments
 (0)