Commit e76183f0 authored by Daniel Black's avatar Daniel Black

MDEV-11075: Power - runtime detection of optimized instructions

Signed-off-by: default avatarDaniel Black <daniel.black@au.ibm.com>
parent 9320d8ae
...@@ -83,6 +83,12 @@ mysys/my_perf.c, contributed by Facebook under the following license. ...@@ -83,6 +83,12 @@ mysys/my_perf.c, contributed by Facebook under the following license.
#include "my_config.h" #include "my_config.h"
#include <string.h> #include <string.h>
#if defined(__linux__) && defined(HAVE_CRC32_VPMSUM)
/* Used to detect at runtime if we have vpmsum instructions (PowerISA 2.07) */
#include <sys/auxv.h>
#include <bits/hwcap.h>
#endif
#include "univ.i" #include "univ.i"
#include "ut0crc32.h" #include "ut0crc32.h"
...@@ -740,8 +746,14 @@ ut_crc32_init() ...@@ -740,8 +746,14 @@ ut_crc32_init()
} }
#elif defined(HAVE_CRC32_VPMSUM) #elif defined(HAVE_CRC32_VPMSUM)
ut_crc32 = ut_crc32_power8; #if defined(__linux__)
ut_crc32_implementation = "Using POWER8 crc32 instructions"; if (getauxval(AT_HWCAP2) & PPC_FEATURE2_ARCH_2_07) {
#endif
ut_crc32 = ut_crc32_power8;
ut_crc32_implementation = "Using POWER8 crc32 instructions";
#if defined(__linux__)
}
#endif
#endif #endif
} }
...@@ -336,7 +336,13 @@ ut_crc32_init() ...@@ -336,7 +336,13 @@ ut_crc32_init()
} }
#elif defined(HAVE_CRC32_VPMSUM) #elif defined(HAVE_CRC32_VPMSUM)
ut_crc32 = ut_crc32_power8; #if defined(__linux__)
ut_crc32_implementation = "Using POWER8 crc32 instructions"; if (getauxval(AT_HWCAP2) & PPC_FEATURE2_ARCH_2_07) {
#endif
ut_crc32 = ut_crc32_power8;
ut_crc32_implementation = "Using POWER8 crc32 instructions";
#if defined(__linux__)
}
#endif
#endif #endif
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment