From 1a3f484051d1531971cd58cb410ef26f4d89b4f5 Mon Sep 17 00:00:00 2001 From: William Brown Date: Apr 21 2017 13:07:09 +0000 Subject: Ticket 49228 - Fix SSE4.2 detection. Bug Description: We incorrectly detect sse4.2 on some platforms. Fix Description: Instead of detecting this, we allow GCC to define the feature flag when possible. At this time, we only use sse4.2 for verification during tests. RPMS build with -mtune=generic, which will disable sse4.2, so anyone who wants "fast" test execution (ie a developer) should set -march=native in their cflags. https://pagure.io/389-ds-base/issue/49228 Author: wibrown Review by: mreynolds Signed-off-by: Mark Reynolds --- diff --git a/configure.ac b/configure.ac index 710c0ba..7b9f175 100644 --- a/configure.ac +++ b/configure.ac @@ -654,21 +654,9 @@ dnl Cstd and Crun are required to link any C++ related code ;; esac -AC_MSG_CHECKING([for SSE4.2 features ...]) -save_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -msse4.2" -AC_TRY_COMPILE( - [], - [return 0;], - [ - AC_DEFINE([HAVE_SSE4_2], [1], [Have sss4.2 on this platform arch]) - AC_MSG_RESULT([SSE4.2 avaliable on this platform]) - ], - [ - AC_MSG_RESULT([SSE4.2 not avaliable on this platform]) - ] -) -CFLAGS="$save_CFLAGS" +### TO CHECK FOR SSE4.2!!! +# gcc -march=native -dM -E - < /dev/null | grep SSE +# We can just use the define in GCC instead! AC_MSG_CHECKING([for GCC provided 64-bit atomic operations]) AC_LINK_IFELSE([AC_LANG_PROGRAM([[ diff --git a/src/libsds/sds/core/crc32c.c b/src/libsds/sds/core/crc32c.c index 8388a61..e4465c3 100644 --- a/src/libsds/sds/core/crc32c.c +++ b/src/libsds/sds/core/crc32c.c @@ -15,7 +15,7 @@ #include #include -#ifdef HAVE_SSE4_2 +#ifdef __SSE4_2__ #if CPU_x86_64 #define REX_PRE "0x48, " @@ -146,5 +146,5 @@ sds_crc32c(uint32_t crc, const unsigned char *data, size_t length) return crc; } -#endif +#endif /* __SSE4_2__ */ diff --git a/src/libsds/test/test_sds.c b/src/libsds/test/test_sds.c index 0d29f22..aff49d0 100644 --- a/src/libsds/test/test_sds.c +++ b/src/libsds/test/test_sds.c @@ -12,14 +12,12 @@ int main ( int argc __attribute__((unused)), char **argv __attribute__((unused))) { int result = 0; - /* result += run_bpt_tests(); result += run_set_tests(); result += run_cow_tests(); result += run_queue_tests(); result += run_tqueue_tests(); result += run_lqueue_tests(); - */ result += run_siphash_tests(); result += run_ht_tests(); return result;