Commit edf4cc75 authored by Marko Mäkelä's avatar Marko Mäkelä Committed by GitHub

Merge pull request #275 from grooverdan/10.2-MDEV-11075-crc32-runtime-detect-getauxval

MDEV-11075: Power - runtime detection of optimized instructions
parents 9320d8ae e76183f0
......@@ -83,6 +83,12 @@ mysys/my_perf.c, contributed by Facebook under the following license.
#include "my_config.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 "ut0crc32.h"
......@@ -740,8 +746,14 @@ ut_crc32_init()
}
#elif defined(HAVE_CRC32_VPMSUM)
ut_crc32 = ut_crc32_power8;
ut_crc32_implementation = "Using POWER8 crc32 instructions";
#if defined(__linux__)
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
}
......@@ -336,7 +336,13 @@ ut_crc32_init()
}
#elif defined(HAVE_CRC32_VPMSUM)
ut_crc32 = ut_crc32_power8;
ut_crc32_implementation = "Using POWER8 crc32 instructions";
#if defined(__linux__)
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
}
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