Skip to contentSkip to conversation

eal: fix compile failure of asm on MSVC toolchain

PATCH Applied Tyler Retzlaff 2 participants 2 messages Oct 17, 2023 – Oct 26, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 eal: fix compile failure of asm on MSVC toolchain

Most MSVC targets do not support inline asm and __MWAITX__ is a GCC implementation detail. Use a test of defined(RTE_TOOLCHAIN_MSVC) to avoid conditional compilation of inline asm and instead use intrinsics instead.

Fixes c7ed1ce04704 ("eal/x86: add power intrinsics for AMD")
---
 lib/eal/x86/rte_power_intrinsics.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
lib/eal/x86/rte_power_intrinsics.c +2 -2
index 63a1f7e..483395d 100644
@@ -60,7 +60,7 @@ static void intel_umwait(const uint64_t timeout)
  */
 static void amd_monitorx(volatile void *addr)
 {
-#if defined(__MWAITX__)
+#if defined(RTE_TOOLCHAIN_MSVC) || defined(__MWAITX__)
 	/* cast away "volatile" when using the intrinsic */
 	_mm_monitorx((void *)(uintptr_t)addr, 0, 0);
 #else
@@ -75,7 +75,7 @@ static void amd_monitorx(volatile void *addr)
 static void amd_mwaitx(const uint64_t timeout)
 {
 	RTE_SET_USED(timeout);
-#if defined(__MWAITX__)
+#if defined(RTE_TOOLCHAIN_MSVC) || defined(__MWAITX__)
 	_mm_mwaitx(0, 0, 0);
 #else
 	asm volatile(".byte 0x0f, 0x01, 0xfb;"
Signature · 1 line
1.8.3.1
Acked-by on v1 1/1 Applied
#1 lore raw
Quoted 9 lines · Tyler Retzlaff

Most MSVC targets do not support inline asm and __MWAITX__ is a GCC implementation detail. Use a test of defined(RTE_TOOLCHAIN_MSVC) to avoid conditional compilation of inline asm and instead use intrinsics instead.

Fixes c7ed1ce04704 ("eal/x86: add power intrinsics for AMD")

Applied, thanks.

Signature · 1 line
David Marchand