Skip to content

Commit

Permalink
Prefer builtin to inline assembly when built with -mprfchw.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 576884571
Change-Id: I7bfe68e5aedd8563f8e6dbdb5d7cc66e9af22567
  • Loading branch information
ckennelly authored and copybara-github committed Oct 26, 2023
1 parent 4a6ea63 commit d59eabb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion absl/base/prefetch.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit d59eabb

Please sign in to comment.