2019-08-06 21:58:28 -07:00
|
|
|
/*
|
2023-12-01 14:35:38 +00:00
|
|
|
* Copyright (C) 2020-2023 Intel Corporation
|
2019-08-06 21:58:28 -07:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/utilities/cpuintrinsics.h"
|
2019-08-06 21:58:28 -07:00
|
|
|
|
2023-12-01 14:35:38 +00:00
|
|
|
#if defined(_WIN32)
|
|
|
|
|
#include <intrin.h>
|
|
|
|
|
#else
|
|
|
|
|
#include <x86intrin.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
2021-09-02 21:25:03 +00:00
|
|
|
#if defined(__ARM_ARCH)
|
|
|
|
|
#include <sse2neon.h>
|
|
|
|
|
#else
|
2019-08-06 21:58:28 -07:00
|
|
|
#include <emmintrin.h>
|
2021-09-02 21:25:03 +00:00
|
|
|
#endif
|
2019-08-06 21:58:28 -07:00
|
|
|
|
|
|
|
|
namespace NEO {
|
|
|
|
|
namespace CpuIntrinsics {
|
|
|
|
|
|
|
|
|
|
void clFlush(void const *ptr) {
|
|
|
|
|
_mm_clflush(ptr);
|
|
|
|
|
}
|
|
|
|
|
|
2023-12-01 14:35:38 +00:00
|
|
|
void clFlushOpt(void *ptr) {
|
|
|
|
|
#ifdef SUPPORTS_CLFLUSHOPT
|
|
|
|
|
_mm_clflushopt(ptr);
|
|
|
|
|
#else
|
|
|
|
|
_mm_clflush(ptr);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-01 11:47:24 +00:00
|
|
|
void sfence() {
|
|
|
|
|
_mm_sfence();
|
|
|
|
|
}
|
|
|
|
|
|
2020-01-14 13:52:06 +01:00
|
|
|
void pause() {
|
|
|
|
|
_mm_pause();
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-06 21:58:28 -07:00
|
|
|
} // namespace CpuIntrinsics
|
|
|
|
|
} // namespace NEO
|