From 5462cf0a89d2990c074cdd64033c9ba149f6541d Mon Sep 17 00:00:00 2001 From: Benjamin Barenblat Date: Wed, 22 Jul 2020 08:15:04 -0400 Subject: Configure SwissTable to target older processors On Intel and compatibles, SwissTable can benefit from SSE2 and SSSE3 if available. Currently, though, it determines availability through a compile-time check, which pins binary packages to the CPU of the builder. Correct this: - Disable SSE2 and SSSE3 on i386. SSSE3 has never been available on i386 CPUs, and Debian supports some i386 CPUs that lack the extension (e.g., the Athlon XP). - Disable SSSE3 on amd64. SSSE3 did not appear until the mid-'00s, and Debian supports all amd64 CPUs, even going back to the original Opteron. Keep SSE2 enabled, since all amd64 CPUs support SSE2. --- debian/changelog | 2 ++ debian/patches/configure.diff | 43 ++++++++++++++++++++++++++++++++++++++----- 2 files changed, 40 insertions(+), 5 deletions(-) diff --git a/debian/changelog b/debian/changelog index 9a778cd0..6aaaaef4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,8 @@ abseil (0~20200225.2-2) UNRELEASED; urgency=medium * Rebuild for unstable. * Rework symbols file using pkg-kde-tools for increased robustness. + * Avoid SSSE3 on amd64 and SSE2 on i386 for greater processor + compatibility. -- Benjamin Barenblat Thu, 23 Jul 2020 10:53:19 -0400 diff --git a/debian/patches/configure.diff b/debian/patches/configure.diff index fd29fa59..bb88ae7d 100644 --- a/debian/patches/configure.diff +++ b/debian/patches/configure.diff @@ -11,6 +11,13 @@ Configure Abseil for Debian. (rather than aliases for the std:: versions), and compile everything in an inline namespace. + - Disable Intel SSE2 on i386, since Debian supports some i386 processors + without that extension. Keep it enabled on amd64, since all amd64 processors + have it. + + - Disable Intel SSSE3 entirely, since no i386 processor supports it and Debian + supports amd64 processors without it. + --- a/CMake/AbseilHelpers.cmake +++ b/CMake/AbseilHelpers.cmake @@ -215,6 +215,9 @@ @@ -25,7 +32,7 @@ Configure Abseil for Debian. add_library(${_NAME} INTERFACE) --- a/absl/base/options.h +++ b/absl/base/options.h -@@ -100,7 +100,7 @@ ABSL_OPTION_USE_STD_ANY +@@ -100,7 +100,7 @@ // User code should not inspect this macro. To check in the preprocessor if // absl::any is a typedef of std::any, use the feature macro ABSL_USES_STD_ANY. @@ -34,7 +41,7 @@ Configure Abseil for Debian. // ABSL_OPTION_USE_STD_OPTIONAL -@@ -127,7 +127,7 @@ ABSL_OPTION_USE_STD_OPTIONAL +@@ -127,7 +127,7 @@ // absl::optional is a typedef of std::optional, use the feature macro // ABSL_USES_STD_OPTIONAL. @@ -43,7 +50,7 @@ Configure Abseil for Debian. // ABSL_OPTION_USE_STD_STRING_VIEW -@@ -154,7 +154,7 @@ ABSL_OPTION_USE_STD_STRING_VIEW +@@ -154,7 +154,7 @@ // absl::string_view is a typedef of std::string_view, use the feature macro // ABSL_USES_STD_STRING_VIEW. @@ -52,7 +59,7 @@ Configure Abseil for Debian. // ABSL_OPTION_USE_STD_VARIANT // -@@ -180,7 +180,7 @@ ABSL_OPTION_USE_STD_VARIANT +@@ -180,7 +180,7 @@ // absl::variant is a typedef of std::variant, use the feature macro // ABSL_USES_STD_VARIANT. @@ -61,7 +68,7 @@ Configure Abseil for Debian. // ABSL_OPTION_USE_INLINE_NAMESPACE -@@ -206,6 +206,6 @@ ABSL_OPTION_INLINE_NAMESPACE_NAME +@@ -206,6 +206,6 @@ // allowed. #define ABSL_OPTION_USE_INLINE_NAMESPACE 1 @@ -69,3 +76,29 @@ Configure Abseil for Debian. +#define ABSL_OPTION_INLINE_NAMESPACE_NAME debian0 #endif // ABSL_BASE_OPTIONS_H_ +--- a/absl/container/internal/have_sse.h ++++ b/absl/container/internal/have_sse.h +@@ -17,22 +17,14 @@ + #define ABSL_CONTAINER_INTERNAL_HAVE_SSE_H_ + + #ifndef SWISSTABLE_HAVE_SSE2 +-#if defined(__SSE2__) || \ +- (defined(_MSC_VER) && \ +- (defined(_M_X64) || (defined(_M_IX86) && _M_IX86_FP >= 2))) ++#if defined(__x86_64__) || (defined(_MSC_VER) && defined(_M_X64)) + #define SWISSTABLE_HAVE_SSE2 1 + #else + #define SWISSTABLE_HAVE_SSE2 0 + #endif + #endif + +-#ifndef SWISSTABLE_HAVE_SSSE3 +-#ifdef __SSSE3__ +-#define SWISSTABLE_HAVE_SSSE3 1 +-#else + #define SWISSTABLE_HAVE_SSSE3 0 +-#endif +-#endif + + #if SWISSTABLE_HAVE_SSSE3 && !SWISSTABLE_HAVE_SSE2 + #error "Bad configuration!" -- cgit v1.2.3