From 83270dcaeae598323b9cb2ae5a1a892ac5f72091 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Sun, 28 Dec 2025 22:51:12 +0100 Subject: Prefetch --- src/utils/prefetch.h | 15 +++++++++++++++ src/utils/utils.h | 1 + 2 files changed, 16 insertions(+) create mode 100644 src/utils/prefetch.h (limited to 'src/utils') diff --git a/src/utils/prefetch.h b/src/utils/prefetch.h new file mode 100644 index 0000000..89b14e8 --- /dev/null +++ b/src/utils/prefetch.h @@ -0,0 +1,15 @@ +#if defined(AVX2) + +#define prefetch(a, i) _mm_prefetch(a+i, _MM_HINT_T0) + +#else +#if defined(__GNUC__) || defined(__clang__) + +#define prefetch(a, i) __builtin_prefetch(a+i, 0, 0) + +#else + +#define prefetch(a, i) (void)i + +#endif +#endif diff --git a/src/utils/utils.h b/src/utils/utils.h index 383781a..e322f20 100644 --- a/src/utils/utils.h +++ b/src/utils/utils.h @@ -4,3 +4,4 @@ #include "math.h" #include "sleep.h" #include "wrapthread.h" +#include "prefetch.h" -- cgit v1.3