2021-12-30 17:39:18 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "util/types.hpp"
|
|
|
|
|
|
|
|
|
|
#ifdef _M_X64
|
2023-07-11 20:40:30 +02:00
|
|
|
#ifdef _MSC_VER
|
2021-12-30 17:39:18 +01:00
|
|
|
extern "C" void _mm_lfence();
|
2023-07-11 20:40:30 +02:00
|
|
|
#else
|
|
|
|
|
#include <immintrin.h>
|
|
|
|
|
#endif
|
2021-12-30 17:39:18 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
namespace utils
|
|
|
|
|
{
|
|
|
|
|
inline void lfence()
|
|
|
|
|
{
|
|
|
|
|
#ifdef _M_X64
|
|
|
|
|
_mm_lfence();
|
|
|
|
|
#elif defined(ARCH_X64)
|
|
|
|
|
__builtin_ia32_lfence();
|
|
|
|
|
#elif defined(ARCH_ARM64)
|
|
|
|
|
// TODO
|
|
|
|
|
__asm__ volatile("isb");
|
|
|
|
|
#else
|
|
|
|
|
#error "Missing lfence() implementation"
|
|
|
|
|
#endif
|
|
|
|
|
}
|
2025-04-05 21:50:45 +02:00
|
|
|
} // namespace utils
|