From cb2b77822d8e77ccfe0d6b8a913267bbae46fc49 Mon Sep 17 00:00:00 2001 From: gabswb Date: Thu, 22 Dec 2022 08:12:02 -0500 Subject: [PATCH] use _mm_pause instead of __builtin_ia_32_pause when __INTEL_COMPILER defined --- api/include/opentelemetry/common/spin_lock_mutex.h | 4 +++- api/test/common/spinlock_benchmark.cc | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/api/include/opentelemetry/common/spin_lock_mutex.h b/api/include/opentelemetry/common/spin_lock_mutex.h index 764b5fc6b8..1877c8eb40 100644 --- a/api/include/opentelemetry/common/spin_lock_mutex.h +++ b/api/include/opentelemetry/common/spin_lock_mutex.h @@ -18,6 +18,8 @@ #elif defined(__i386__) || defined(__x86_64__) # if defined(__clang__) # include +# elif defined(__INTEL_COMPILER) +# include # endif #endif @@ -65,7 +67,7 @@ class SpinLockMutex #if defined(_MSC_VER) YieldProcessor(); #elif defined(__i386__) || defined(__x86_64__) -# if defined(__clang__) +# if defined(__clang__) || defined(__INTEL_COMPILER) _mm_pause(); # else __builtin_ia32_pause(); diff --git a/api/test/common/spinlock_benchmark.cc b/api/test/common/spinlock_benchmark.cc index 07579579c7..a96888303c 100644 --- a/api/test/common/spinlock_benchmark.cc +++ b/api/test/common/spinlock_benchmark.cc @@ -87,7 +87,7 @@ static void BM_ProcYieldSpinLockThrashing(benchmark::State &s) #if defined(_MSC_VER) YieldProcessor(); #elif defined(__i386__) || defined(__x86_64__) -# if defined(__clang__) +# if defined(__clang__) || defined(__INTEL_COMPILER) _mm_pause(); # else __builtin_ia32_pause();