> Inline assembly is not supported for MSVC x64. Convert code to use
> _xend, _xabort and _xtest intrinsics.
>
> Signed-off-by: Tyler Retzlaff <roret...@linux.microsoft.com>
> ---
> config/x86/meson.build | 6 ++++++
> lib/eal/x86/include/rte_rtm.h | 18 +++++-------------
> 2 files changed, 11 insertions(+), 13 deletions(-)
>
> diff --git a/config/x86/meson.build b/config/x86/meson.build
> index 54345c4..4c0b06c 100644
> --- a/config/x86/meson.build
> +++ b/config/x86/meson.build
> @@ -30,6 +30,12 @@ if cc.get_define('__SSE4_2__', args: machine_args) == ''
> machine_args += '-msse4'
> endif
>
> +# enable restricted transactional memory intrinsics
> +# https://gcc.gnu.org/onlinedocs/gcc/x86-transactional-memory-intrinsics.html
> +if cc.get_id() != 'msvc'
> + machine_args += '-mrtm'
> +endif
> +
> base_flags = ['SSE', 'SSE2', 'SSE3','SSSE3', 'SSE4_1', 'SSE4_2']
> foreach f:base_flags
> compile_time_cpuflags += ['RTE_CPUFLAG_' + f]
> diff --git a/lib/eal/x86/include/rte_rtm.h b/lib/eal/x86/include/rte_rtm.h
> index 36bf498..b84e58e 100644
> --- a/lib/eal/x86/include/rte_rtm.h
> +++ b/lib/eal/x86/include/rte_rtm.h
> @@ -5,6 +5,7 @@
> #ifndef _RTE_RTM_H_
> #define _RTE_RTM_H_ 1
>
> +#include <immintrin.h>
>
> /* Official RTM intrinsics interface matching gcc/icc, but works
> on older gcc compatible compilers and binutils. */
> @@ -28,31 +29,22 @@
> static __rte_always_inline
> unsigned int rte_xbegin(void)
> {
> - unsigned int ret = RTE_XBEGIN_STARTED;
> -
> - asm volatile(".byte 0xc7,0xf8 ; .long 0" : "+a" (ret) :: "memory");
> - return ret;
> + return _xbegin();
> }
>
> static __rte_always_inline
> void rte_xend(void)
> {
> - asm volatile(".byte 0x0f,0x01,0xd5" ::: "memory");
> + _xend();
> }
>
> /* not an inline function to workaround a clang bug with -O0 */
> -#define rte_xabort(status) do { \
> - asm volatile(".byte 0xc6,0xf8,%P0" :: "i" (status) : "memory"); \
> -} while (0)
> +#define rte_xabort(status) _xabort(status)
>
> static __rte_always_inline
> int rte_xtest(void)
> {
> - unsigned char out;
> -
> - asm volatile(".byte 0x0f,0x01,0xd6 ; setnz %0" :
> - "=r" (out) :: "memory");
> - return out;
> + return _xtest();
> }
>
> #ifdef __cplusplus
> --
Acked-by: Konstantin Ananyev <konstantin.anan...@huawei.com>
> 1.8.3.1