From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 823FC43BF1; Mon, 26 Feb 2024 18:20:38 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3AEC6402B2; Mon, 26 Feb 2024 18:20:38 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id D85EE40144 for ; Mon, 26 Feb 2024 18:20:36 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 1DA2A20B74C1; Mon, 26 Feb 2024 09:20:36 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 1DA2A20B74C1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1708968036; bh=WnrjPQQxStwkgu8HSl0TnyHaQ4F/wPBuz/ca9RF6bUk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=e72HkQwHCpuP4zeF5L5GGpG8lr//Xdn+K2JiAozR6oJ00wqVmtoOZA+Pbzi1hS99c qZLd/DDVGN4VJGB8DmXm40sE4XWPxQEJpJZSNJ84r5LfFUi3UUZ1+6o6XnFrNR1R4A KeZgyR1Lzfei215fVc0NH1Qvo9AJltJkSkZyy9K0= Date: Mon, 26 Feb 2024 09:20:36 -0800 From: Tyler Retzlaff To: Konstantin Ananyev Cc: "dev@dpdk.org" , Andrew Rybchenko , Bruce Richardson , Fengchengwen , Cristian Dumitrescu , David Christensen , David Hunt , Ferruh Yigit , Honnappa Nagarahalli , Jasvinder Singh , Jerin Jacob , Kevin Laatz , Konstantin Ananyev , Min Zhou , Ruifeng Wang , Sameh Gobriel , Stanislaw Kardach , Thomas Monjalon , Vladimir Medvedkin , Yipeng Wang Subject: Re: [PATCH v5 02/39] eal: redefine macro to be integer literal for MSVC Message-ID: <20240226172036.GB20214@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> References: <1707873986-29352-1-git-send-email-roretzla@linux.microsoft.com> <1708715054-22386-1-git-send-email-roretzla@linux.microsoft.com> <1708715054-22386-3-git-send-email-roretzla@linux.microsoft.com> <7135636c3c3f4be68df11163481eafd5@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <7135636c3c3f4be68df11163481eafd5@huawei.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Mon, Feb 26, 2024 at 12:51:38PM +0000, Konstantin Ananyev wrote: > > > > MSVC __declspec(align(#)) is limited and accepts only integer literals > > as opposed to constant expressions. define XMM_SIZE to be 16 instead of > > sizeof(xmm_t) and static_assert that sizeof(xmm_t) == 16 for > > compatibility. > > > > Signed-off-by: Tyler Retzlaff > > Acked-by: Morten Brørup > > --- > > lib/eal/x86/include/rte_vect.h | 5 ++++- > > 1 file changed, 4 insertions(+), 1 deletion(-) > > > > diff --git a/lib/eal/x86/include/rte_vect.h b/lib/eal/x86/include/rte_vect.h > > index a1a537e..441f1a0 100644 > > --- a/lib/eal/x86/include/rte_vect.h > > +++ b/lib/eal/x86/include/rte_vect.h > > @@ -11,6 +11,7 @@ > > * RTE SSE/AVX related header. > > */ > > > > +#include > > #include > > #include > > #include > > @@ -33,9 +34,11 @@ > > > > typedef __m128i xmm_t; > > > > -#define XMM_SIZE (sizeof(xmm_t)) > > +#define XMM_SIZE 16 > > #define XMM_MASK (XMM_SIZE - 1) > > > > +static_assert(sizeof(xmm_t) == 16, ""); > > I think it is better be: > static_assert(sizeof(xmm_t) == XMM_SIZE, ""); > ack, will fix > > BTW, is there any chance that in future versions MSVC would accept align()? it does seem an oversight. i will ask the msvc team if they would like to enhance it. thanks > > > + > > typedef union rte_xmm { > > xmm_t x; > > uint8_t u8[XMM_SIZE / sizeof(uint8_t)]; > > -- > > 1.8.3.1 >