summaryrefslogtreecommitdiff
path: root/absl/base/prefetch.h
diff options
context:
space:
mode:
authorGravatar Chris Kennelly <ckennelly@google.com>2023-10-26 08:43:56 -0700
committerGravatar Copybara-Service <copybara-worker@google.com>2023-10-26 08:44:46 -0700
commitd59eabb1219bd7c0585e4e86fe9147473c703f33 (patch)
treeba28490ed60d3066d61b64e0ba8fdfefc78ac8ba /absl/base/prefetch.h
parent4a6ea63d35d28785b87c51536aed00362a94c5f9 (diff)
Prefer builtin to inline assembly when built with -mprfchw.
PiperOrigin-RevId: 576884571 Change-Id: I7bfe68e5aedd8563f8e6dbdb5d7cc66e9af22567
Diffstat (limited to 'absl/base/prefetch.h')
-rw-r--r--absl/base/prefetch.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/absl/base/prefetch.h b/absl/base/prefetch.h
index 609e26e7..98b3bf96 100644
--- a/absl/base/prefetch.h
+++ b/absl/base/prefetch.h
@@ -157,7 +157,7 @@ ABSL_ATTRIBUTE_ALWAYS_INLINE inline void PrefetchToLocalCacheForWrite(
// unless -march=broadwell or newer; this is not generally the default, so we
// manually emit prefetchw. PREFETCHW is recognized as a no-op on older Intel
// processors and has been present on AMD processors since the K6-2.
-#if defined(__x86_64__)
+#if defined(__x86_64__) && !defined(__PRFCHW__)
asm("prefetchw %0" : : "m"(*reinterpret_cast<const char*>(addr)));
#else
__builtin_prefetch(addr, 1, 3);