Skip to content

Commit

Permalink
Do not build optimised power crc32 on bigendian
Browse files Browse the repository at this point in the history
  • Loading branch information
grooverdan committed Dec 18, 2015
1 parent 953d568 commit e4e2d9d
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 16 deletions.
12 changes: 8 additions & 4 deletions extra/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,21 @@ IF(WITH_INNOBASE_STORAGE_ENGINE OR WITH_XTRADB_STORAGE_ENGINE)
# We use the InnoDB code directly in case the code changes.
ADD_DEFINITIONS("-DUNIV_INNOCHECKSUM")

enable_language(ASM)

SET(INNOBASE_SOURCES
../storage/innobase/buf/buf0checksum.cc
../storage/innobase/ut/ut0crc32.cc
../storage/innobase/ut/ut0ut.cc
../storage/innobase/ut/crc32_power8/crc32.S
../storage/innobase/ut/crc32_power8/crc32_wrapper.c
../storage/innobase/page/page0zip.cc
)

IF(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64le")
enable_language(ASM)
LIST(APPEND INNOBASE_SOURCES
../storage/innobase/ut/crc32_power8/crc32.S
../storage/innobase/ut/crc32_power8/crc32_wrapper.c
)
ENDIF()

MYSQL_ADD_EXECUTABLE(innochecksum innochecksum.cc ${INNOBASE_SOURCES})
TARGET_LINK_LIBRARIES(innochecksum mysys mysys_ssl)
ADD_DEPENDENCIES(innochecksum GenError)
Expand Down
12 changes: 8 additions & 4 deletions storage/innobase/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,6 @@ IF(MSVC)
PROPERTIES COMPILE_FLAGS "/wd4003")
ENDIF()

enable_language(ASM)

SET(INNOBASE_SOURCES
api/api0api.cc
api/api0misc.cc
Expand Down Expand Up @@ -478,8 +476,6 @@ SET(INNOBASE_SOURCES
ut/ut0bh.cc
ut/ut0byte.cc
ut/ut0crc32.cc
ut/crc32_power8/crc32.S
ut/crc32_power8/crc32_wrapper.c
ut/ut0dbg.cc
ut/ut0list.cc
ut/ut0mem.cc
Expand All @@ -490,6 +486,14 @@ SET(INNOBASE_SOURCES
ut/ut0wqueue.cc
ut/ut0timer.cc)

IF(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64le")
enable_language(ASM)
LIST(APPEND INNOBASE_SOURCES
ut/crc32_power8/crc32.S
ut/crc32_power8/crc32_wrapper.c
)
ENDIF()

IF(WITH_INNODB)
# Legacy option
SET(WITH_INNOBASE_STORAGE_ENGINE TRUE)
Expand Down
5 changes: 3 additions & 2 deletions storage/innobase/ut/ut0crc32.cc
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ ut_crc32_power8(
const byte* buf, /*!< in: data over which to calculate CRC32 */
ulint len) /*!< in: data length */
{
#if defined(__powerpc__)
#if defined(__powerpc__) && !defined(WORDS_BIGENDIAN)
return crc32_vpmsum(0, buf, len);
#else
ut_error;
Expand Down Expand Up @@ -338,7 +338,8 @@ ut_crc32_init()

#endif /* defined(__GNUC__) && defined(__x86_64__) */

#if defined(__linux__) && defined(__powerpc__) && defined(AT_HWCAP2)
#if defined(__linux__) && defined(__powerpc__) && defined(AT_HWCAP2) \
&& !defined(WORDS_BIGENDIAN)
if (getauxval(AT_HWCAP2) & PPC_FEATURE2_ARCH_2_07)
ut_crc32_power8_enabled = true;
#endif /* defined(__linux__) && defined(__powerpc__) */
Expand Down
12 changes: 8 additions & 4 deletions storage/xtradb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,6 @@ IF (MSVC AND CMAKE_SIZEOF_VOID_P EQUAL 8)
PROPERTIES COMPILE_FLAGS -Od)
ENDIF()

enable_language(ASM)

SET(INNOBASE_SOURCES
api/api0api.cc
api/api0misc.cc
Expand Down Expand Up @@ -464,8 +462,6 @@ SET(INNOBASE_SOURCES
ut/ut0bh.cc
ut/ut0byte.cc
ut/ut0crc32.cc
ut/crc32_power8/crc32.S
ut/crc32_power8/crc32_wrapper.c
ut/ut0dbg.cc
ut/ut0list.cc
ut/ut0mem.cc
Expand All @@ -476,6 +472,14 @@ SET(INNOBASE_SOURCES
ut/ut0wqueue.cc
ut/ut0timer.cc)

IF(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64le")
enable_language(ASM)
LIST(APPEND INNOBASE_SOURCES
ut/crc32_power8/crc32.S
ut/crc32_power8/crc32_wrapper.c
)
ENDIF()

MYSQL_ADD_PLUGIN(xtradb ${INNOBASE_SOURCES} STORAGE_ENGINE
DEFAULT RECOMPILE_FOR_EMBEDDED
LINK_LIBRARIES ${ZLIB_LIBRARY} ${LINKER_SCRIPT})
Expand Down
5 changes: 3 additions & 2 deletions storage/xtradb/ut/ut0crc32.cc
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ ut_crc32_power8(
const byte* buf, /*!< in: data over which to calculate CRC32 */
ulint len) /*!< in: data length */
{
#if defined(__powerpc__)
#if defined(__powerpc__) && !defined(WORDS_BIGENDIAN)
return crc32_vpmsum(0, buf, len);
#else
ut_error;
Expand Down Expand Up @@ -338,7 +338,8 @@ ut_crc32_init()

#endif /* defined(__GNUC__) && defined(__x86_64__) */

#if defined(__linux__) && defined(__powerpc__) && defined(AT_HWCAP2)
#if defined(__linux__) && defined(__powerpc__) && defined(AT_HWCAP2) \
&& !defined(WORDS_BIGENDIAN)
if (getauxval(AT_HWCAP2) & PPC_FEATURE2_ARCH_2_07)
ut_crc32_power8_enabled = true;
#endif /* defined(__linux__) && defined(__powerpc__) */
Expand Down

0 comments on commit e4e2d9d

Please sign in to comment.