From 4c9cee34f20071a8d08e202afe679e4269f161e2 Mon Sep 17 00:00:00 2001 From: JbR <90027771+jbr-smtg@users.noreply.github.com> Date: Mon, 6 Feb 2023 16:58:14 +0100 Subject: [PATCH] Fixing issue with ARM64EC and MSVC (#1514) Co-authored-by: dominic <510002+dmah42@users.noreply.github.com> --- src/cycleclock.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/cycleclock.h b/src/cycleclock.h index df6ffa51..ae1ef2d2 100644 --- a/src/cycleclock.h +++ b/src/cycleclock.h @@ -36,7 +36,8 @@ // declarations of some other intrinsics, breaking compilation. // Therefore, we simply declare __rdtsc ourselves. See also // http://connect.microsoft.com/VisualStudio/feedback/details/262047 -#if defined(COMPILER_MSVC) && !defined(_M_IX86) && !defined(_M_ARM64) +#if defined(COMPILER_MSVC) && !defined(_M_IX86) && !defined(_M_ARM64) && \ + !defined(_M_ARM64EC) extern "C" uint64_t __rdtsc(); #pragma intrinsic(__rdtsc) #endif @@ -114,7 +115,7 @@ inline BENCHMARK_ALWAYS_INLINE int64_t Now() { // when I know it will work. Otherwise, I'll use __rdtsc and hope // the code is being compiled with a non-ancient compiler. _asm rdtsc -#elif defined(COMPILER_MSVC) && defined(_M_ARM64) +#elif defined(COMPILER_MSVC) && (defined(_M_ARM64) || defined(_M_ARM64EC)) // See // https://docs.microsoft.com/en-us/cpp/intrinsics/arm64-intrinsics // and https://reviews.llvm.org/D53115 int64_t virtual_timer_value;