From: Bruce Richardson <bruce.richardson@intel.com>
To: Andre Muezerie <andremue@linux.microsoft.com>
Cc: <dev@dpdk.org>, <sameh.gobriel@intel.com>,
<vladimir.medvedkin@intel.com>, <yipeng1.wang@intel.com>
Subject: Re: [PATCH v2 2/2] app/test: add test_init_m128i using compiler intrinsic
Date: Wed, 5 Mar 2025 09:20:03 +0000 [thread overview]
Message-ID: <Z8gXQylzSC2geGp_@bricha3-mobl1.ger.corp.intel.com> (raw)
In-Reply-To: <1741125199-1217-2-git-send-email-andremue@linux.microsoft.com>
On Tue, Mar 04, 2025 at 01:53:19PM -0800, Andre Muezerie wrote:
> This test initializes an __m128i data type using the old
> non-portable way used until now and the more portable way
> using compiler intrinsics. The test ensures the resulting
> values after initialization match.
>
> Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
> ---
> app/test/test_thash.c | 34 ++++++++++++++++++++++++++++++++++
> 1 file changed, 34 insertions(+)
>
> diff --git a/app/test/test_thash.c b/app/test/test_thash.c
> index 33b0c6adac..5f7081a3ad 100644
> --- a/app/test/test_thash.c
> +++ b/app/test/test_thash.c
> @@ -1029,6 +1029,35 @@ test_keygen(void)
> return TEST_SUCCESS;
> }
>
> +#ifdef RTE_ARCH_X86
> +#ifndef RTE_TOOLCHAIN_MSVC
> +static int
> +test_init_m128i(void)
> +{
> + /* When initializing __m128i with two constant values like below
> + * MSVC issues warning C4305:
> + * 'initializing': truncation from 'unsigned __int64' to 'char'
> + */
> + static const __m128i a = {
> + 0x0405060700010203ULL, 0x0C0D0E0F08090A0BULL};
> +
> + /* Using compiler intrinsics to initialize __m128i is therefore
> + * preferred, like below
> + */
> + const __m128i b = _mm_set_epi64x(
> + 0x0C0D0E0F08090A0BULL, 0x0405060700010203ULL);
> +
> + if (memcmp(&a, &b, sizeof(a)) != 0) {
> + printf("Same value was expected when initializing data "
> + "type using compiler intrinsic\n");
> + return -1;
> + }
> +
> + return TEST_SUCCESS;
> +}
> +#endif
> +#endif
> +
Do we still need this patch? I don't think its necessary.
next prev parent reply other threads:[~2025-03-05 9:20 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-27 22:57 [PATCH 1/2] lib/hash: initialize __m128i data type in a portable way Andre Muezerie
2024-11-27 22:57 ` [PATCH 2/2] app/test: add test_init_m128i using compiler intrinsic Andre Muezerie
2025-03-03 22:29 ` Andre Muezerie
2025-03-03 22:27 ` [PATCH 1/2] lib/hash: initialize __m128i data type in a portable way Andre Muezerie
2025-03-04 10:46 ` Bruce Richardson
2025-03-04 21:53 ` [PATCH v2 " Andre Muezerie
2025-03-04 21:53 ` [PATCH v2 2/2] app/test: add test_init_m128i using compiler intrinsic Andre Muezerie
2025-03-05 9:20 ` Bruce Richardson [this message]
2025-03-05 14:50 ` Andre Muezerie
2025-03-05 9:13 ` [PATCH v2 1/2] lib/hash: initialize __m128i data type in a portable way Bruce Richardson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z8gXQylzSC2geGp_@bricha3-mobl1.ger.corp.intel.com \
--to=bruce.richardson@intel.com \
--cc=andremue@linux.microsoft.com \
--cc=dev@dpdk.org \
--cc=sameh.gobriel@intel.com \
--cc=vladimir.medvedkin@intel.com \
--cc=yipeng1.wang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).