Define missing SNAPPY_PREFETCH macros.

PiperOrigin-RevId: 523287305
This commit is contained in:
Richard O'Grady 2023-04-10 20:48:20 -07:00
parent 92f18e66fd
commit cfc573e08f
3 changed files with 15 additions and 0 deletions

View File

@ -153,6 +153,12 @@ int main() {
return __builtin_ctzll(0); return __builtin_ctzll(0);
}" HAVE_BUILTIN_CTZ) }" HAVE_BUILTIN_CTZ)
check_cxx_source_compiles("
int main() {
__builtin_prefetch(0, 0, 3);
return 0;
}" HAVE_BUILTIN_PREFETCH)
check_cxx_source_compiles(" check_cxx_source_compiles("
__attribute__((always_inline)) int zero() { return 0; } __attribute__((always_inline)) int zero() { return 0; }

View File

@ -10,6 +10,9 @@
/* Define to 1 if the compiler supports __builtin_expect. */ /* Define to 1 if the compiler supports __builtin_expect. */
#cmakedefine01 HAVE_BUILTIN_EXPECT #cmakedefine01 HAVE_BUILTIN_EXPECT
/* Define to 1 if the compiler supports __builtin_prefetch. */
#cmakedefine01 HAVE_BUILTIN_PREFETCH
/* Define to 1 if you have a definition for mmap() in <sys/mman.h>. */ /* Define to 1 if you have a definition for mmap() in <sys/mman.h>. */
#cmakedefine01 HAVE_FUNC_MMAP #cmakedefine01 HAVE_FUNC_MMAP

View File

@ -105,6 +105,12 @@
#define SNAPPY_ATTRIBUTE_ALWAYS_INLINE #define SNAPPY_ATTRIBUTE_ALWAYS_INLINE
#endif // HAVE_ATTRIBUTE_ALWAYS_INLINE #endif // HAVE_ATTRIBUTE_ALWAYS_INLINE
#if HAVE_BUILTIN_PREFETCH
#define SNAPPY_PREFETCH(ptr) __builtin_prefetch(ptr, 0, 3)
#else
#define SNAPPY_PREFETCH(ptr) (void)(ptr)
#endif
// Stubbed version of ABSL_FLAG. // Stubbed version of ABSL_FLAG.
// //
// In the open source version, flags can only be changed at compile time. // In the open source version, flags can only be changed at compile time.