summaryrefslogtreecommitdiff
path: root/absl/crc/internal/cpu_detect.cc
diff options
context:
space:
mode:
authorGravatar Copybara-Service <copybara-worker@google.com>2023-05-22 14:15:08 -0700
committerGravatar Copybara-Service <copybara-worker@google.com>2023-05-22 14:15:08 -0700
commit051aa9805f28cf156d232b6319f09da4d5b5cb3e (patch)
tree5db546b919a865a06cf90c8fa5b50dbaa1213a5e /absl/crc/internal/cpu_detect.cc
parent02d1f5e18bb12d9aecade624eb339c319fd866d4 (diff)
parentbd748714ce32841d410b1b8ec5f2daa5043ee6b2 (diff)
Merge pull request #1452 from niranjan-nilakantan:niranjan-nilakantan/issue1358
PiperOrigin-RevId: 534179290 Change-Id: I9ad24518cc6a336fbaf602269fb01319491c8b60
Diffstat (limited to 'absl/crc/internal/cpu_detect.cc')
-rw-r--r--absl/crc/internal/cpu_detect.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/absl/crc/internal/cpu_detect.cc b/absl/crc/internal/cpu_detect.cc
index d61b7018..4e29d0fa 100644
--- a/absl/crc/internal/cpu_detect.cc
+++ b/absl/crc/internal/cpu_detect.cc
@@ -34,9 +34,11 @@ namespace crc_internal {
#if defined(__x86_64__) || defined(_M_X64)
-namespace {
-
-#if !defined(_WIN32) && !defined(_WIN64)
+#if ABSL_HAVE_BUILTIN(__cpuid)
+// MSVC-equivalent __cpuid intrinsic declaration for clang-like compilers
+// for non-Windows build environments.
+extern void __cpuid(int[4], int);
+#elif !defined(_WIN32) && !defined(_WIN64)
// MSVC defines this function for us.
// https://learn.microsoft.com/en-us/cpp/intrinsics/cpuid-cpuidex
static void __cpuid(int cpu_info[4], int info_type) {
@@ -47,6 +49,8 @@ static void __cpuid(int cpu_info[4], int info_type) {
}
#endif // !defined(_WIN32) && !defined(_WIN64)
+namespace {
+
enum class Vendor {
kUnknown,
kIntel,