diff options
Diffstat (limited to '')
| -rw-r--r-- | src/utils/prefetch.h | 15 | ||||
| -rw-r--r-- | src/utils/utils.h | 1 |
2 files changed, 16 insertions, 0 deletions
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 @@ | |||
| 1 | #if defined(AVX2) | ||
| 2 | |||
| 3 | #define prefetch(a, i) _mm_prefetch(a+i, _MM_HINT_T0) | ||
| 4 | |||
| 5 | #else | ||
| 6 | #if defined(__GNUC__) || defined(__clang__) | ||
| 7 | |||
| 8 | #define prefetch(a, i) __builtin_prefetch(a+i, 0, 0) | ||
| 9 | |||
| 10 | #else | ||
| 11 | |||
| 12 | #define prefetch(a, i) (void)i | ||
| 13 | |||
| 14 | #endif | ||
| 15 | #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 @@ | |||
| 4 | #include "math.h" | 4 | #include "math.h" |
| 5 | #include "sleep.h" | 5 | #include "sleep.h" |
| 6 | #include "wrapthread.h" | 6 | #include "wrapthread.h" |
| 7 | #include "prefetch.h" | ||
