summaryrefslogtreecommitdiff
path: root/absl/base/config.h
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2022-03-28 13:12:19 -0700
committerGravatar rogeeff <rogeeff@google.com>2022-03-29 10:08:46 -0400
commit3204cc0625230e9876f0310a6dea0014210ab325 (patch)
tree7b9193fc4b720bc8e767912b8a38f82c11e19569 /absl/base/config.h
parent0c6302fe427963ec5c471d3ee660120682ab15f7 (diff)
Export of internal Abseil changes
-- 291f7ef542f73e4801ab5108014bc02344ef31df by Derek Mauro <dmauro@google.com>: Internal change PiperOrigin-RevId: 437835981 Change-Id: I42fd92e74903894533ac9984d7f622e3ba20f468 -- 2e8caf1a57c50b518e05b4bca48e4fe1bb19af82 by Andy Getzendanner <durandal@google.com>: Internal change PiperOrigin-RevId: 437832673 Change-Id: I61b35089418d01a54cecf161b254b68252bebff3 -- b927482ccc399f7e337b60582988b914d9946e4e by Derek Mauro <dmauro@google.com>: Simplify endian intrinsics for modern compilers All modern compilers have either __builtin_bswapN (gcc, clang) or _byteswap_TYPE (MSVC). The other intrinsic definitions are no longer necessary. PiperOrigin-RevId: 437772295 Change-Id: Ifb3d88ba24b9097f87ceb202272b36d2f5e5117f -- b6782a2247a16d5c14706a74ec577c19963d9f97 by Derek Mauro <dmauro@google.com>: Internal change PiperOrigin-RevId: 437373174 Change-Id: I0f77e1780dee90d7a3c32a08d96c4aeb624a57b4 -- a53e0c724e37b0b01515a99bd25394b8e21ffdfc by Derek Mauro <dmauro@google.com>: Unify detection of SSE2 and SSSE3 instruction sets and include the proper headers Fix the intrinsic implementation of FastHexToBufferZeroPad16 in numbers.h which only relies on SSSE3, not SSE 4.2. https://godbolt.org/z/Pf5bn1Yv9 Closes #639 PiperOrigin-RevId: 437286940 Change-Id: Ic97948399b61b91e9c0bccd09313b795b904d714 -- f173f597cb2a75ef2a989f45a496334b85e6f40d by Abseil Team <absl-team@google.com>: Change assertion function to enable clearer error messages. PiperOrigin-RevId: 437227057 Change-Id: If420d2f63b51feef6648762f344d5be012cd9c85 GitOrigin-RevId: 291f7ef542f73e4801ab5108014bc02344ef31df
Diffstat (limited to 'absl/base/config.h')
-rw-r--r--absl/base/config.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/absl/base/config.h b/absl/base/config.h
index 78de4d1c..429dd353 100644
--- a/absl/base/config.h
+++ b/absl/base/config.h
@@ -269,6 +269,8 @@ static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' ||
#define ABSL_HAVE_SOURCE_LOCATION_CURRENT 1
#elif ABSL_INTERNAL_HAVE_MIN_GNUC_VERSION(5, 0)
#define ABSL_HAVE_SOURCE_LOCATION_CURRENT 1
+#elif defined(_MSC_VER) && _MSC_VER >= 1926
+#define ABSL_HAVE_SOURCE_LOCATION_CURRENT 1
#endif
#endif
@@ -818,4 +820,34 @@ static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' ||
#define ABSL_INTERNAL_HAS_RTTI 1
#endif // !defined(__GNUC__) || defined(__GXX_RTTI)
+// ABSL_INTERNAL_HAVE_SSE2 is used for compile-time detection of SSE2 support.
+// See https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html for an overview of
+// which architectures support the various x86 instruction sets.
+#ifdef ABSL_INTERNAL_HAVE_SSE2
+#error ABSL_INTERNAL_HAVE_SSE2 cannot be directly set
+#elif defined(__SSE2__)
+#define ABSL_INTERNAL_HAVE_SSE2 1
+#elif defined(_M_X64) || (defined(_M_IX86_FP) && _M_IX86_FP >= 2)
+// MSVC only defines _M_IX86_FP for x86 32-bit code, and _M_IX86_FP >= 2
+// indicates that at least SSE2 was targeted with the /arch:SSE2 option.
+// All x86-64 processors support SSE2, so support can be assumed.
+// https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros
+#define ABSL_INTERNAL_HAVE_SSE2 1
+#endif
+
+// ABSL_INTERNAL_HAVE_SSSE3 is used for compile-time detection of SSSE3 support.
+// See https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html for an overview of
+// which architectures support the various x86 instruction sets.
+//
+// MSVC does not have a mode that targets SSSE3 at compile-time. To use SSSE3
+// with MSVC requires either assuming that the code will only every run on CPUs
+// that support SSSE3, otherwise __cpuid() can be used to detect support at
+// runtime and fallback to a non-SSSE3 implementation when SSSE3 is unsupported
+// by the CPU.
+#ifdef ABSL_INTERNAL_HAVE_SSSE3
+#error ABSL_INTERNAL_HAVE_SSSE3 cannot be directly set
+#elif defined(__SSSE3__)
+#define ABSL_INTERNAL_HAVE_SSSE3 1
+#endif
+
#endif // ABSL_BASE_CONFIG_H_