|
36 | 36 | // declarations of some other intrinsics, breaking compilation.
|
37 | 37 | // Therefore, we simply declare __rdtsc ourselves. See also
|
38 | 38 | // http://connect.microsoft.com/VisualStudio/feedback/details/262047
|
| 39 | +// |
| 40 | +// Note that MSVC defines the x64 preprocessor macros when building |
| 41 | +// for Arm64EC, despite it using Arm64 assembly instructions. |
39 | 42 | #if defined(COMPILER_MSVC) && !defined(_M_IX86) && !defined(_M_ARM64) && \
|
40 | 43 | !defined(_M_ARM64EC)
|
41 | 44 | extern "C" uint64_t __rdtsc();
|
@@ -79,7 +82,10 @@ inline BENCHMARK_ALWAYS_INLINE int64_t Now() {
|
79 | 82 | int64_t ret;
|
80 | 83 | __asm__ volatile("rdtsc" : "=A"(ret));
|
81 | 84 | return ret;
|
82 |
| -#elif defined(__x86_64__) || defined(__amd64__) |
| 85 | + |
| 86 | +// Note that Clang, like MSVC, defines the x64 preprocessor macros when building |
| 87 | +// for Arm64EC, despite it using Arm64 assembly instructions. |
| 88 | +#elif (defined(__x86_64__) || defined(__amd64__)) && !defined(__arm64ec__) |
83 | 89 | uint64_t low, high;
|
84 | 90 | __asm__ volatile("rdtsc" : "=a"(low), "=d"(high));
|
85 | 91 | return static_cast<int64_t>((high << 32) | low);
|
@@ -139,7 +145,7 @@ inline BENCHMARK_ALWAYS_INLINE int64_t Now() {
|
139 | 145 | struct timespec ts = {0, 0};
|
140 | 146 | clock_gettime(CLOCK_MONOTONIC, &ts);
|
141 | 147 | return static_cast<int64_t>(ts.tv_sec) * 1000000000 + ts.tv_nsec;
|
142 |
| -#elif defined(__aarch64__) |
| 148 | +#elif defined(__aarch64__) || defined(__arm64ec__) |
143 | 149 | // System timer of ARMv8 runs at a different frequency than the CPU's.
|
144 | 150 | // The frequency is fixed, typically in the range 1-50MHz. It can be
|
145 | 151 | // read at CNTFRQ special register. We assume the OS has set up
|
|
0 commit comments