> 
> After the instruction set updates for MSVC the error below popped up:
> 
> ..\lib\eal\x86\include\rte_vect.h(82): error C2059: syntax error: '('
> 
> The issue is that MSVC does not allow __rte_aligned(RTE_X86_ZMM_SIZE).
> It only accepts numbers that are power of 2. So, even though
> RTE_X86_ZMM_SIZE represents a number that is a power of two it cannot
> be used directly.
> https://learn.microsoft.com/en-us/cpp/cpp/align-cpp?view=msvc-170
> 
> Signed-off-by: Andre Muezerie <andre...@linux.microsoft.com>
> Acked-by: Bruce Richardson <bruce.richard...@intel.com>
> ---
>  lib/eal/x86/include/rte_vect.h | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/eal/x86/include/rte_vect.h b/lib/eal/x86/include/rte_vect.h
> index 70c78e9b77..9ea158b27e 100644
> --- a/lib/eal/x86/include/rte_vect.h
> +++ b/lib/eal/x86/include/rte_vect.h
> @@ -76,9 +76,18 @@ __extension__ ({                \
> 
>  #ifdef __AVX512F__
> 
> -#define RTE_X86_ZMM_SIZE     (sizeof(__m512i))
> +#define RTE_X86_ZMM_SIZE        64
>  #define RTE_X86_ZMM_MASK     (RTE_X86_ZMM_SIZE - 1)
> 
> +/*
> + * MSVC does not allow __rte_aligned(sizeof(__m512i)). It only accepts
> + * numbers that are power of 2. So, even though sizeof(__m512i) represents a
> + * number that is a power of two it cannot be used directly.
> + * Ref: https://learn.microsoft.com/en-us/cpp/cpp/align-cpp?view=msvc-170
> + * The static assert below ensures that the hardcoded value defined as
> + * RTE_X86_ZMM_SIZE is equal to sizeof(__m512i).
> + */
> +static_assert(RTE_X86_ZMM_SIZE == (sizeof(__m512i)), "Unexpected size of 
> __m512i");
>  typedef union __rte_aligned(RTE_X86_ZMM_SIZE) __rte_x86_zmm {
>       __m512i  z;
>       ymm_t    y[RTE_X86_ZMM_SIZE / sizeof(ymm_t)];
> --

Acked-by: Konstantin Ananyev <konstantin.anan...@huawei.com>

> 2.48.1.vfs.0.0

Reply via email to