drivers/net: use intrinsic to access content of __m128i
PATCH 1/1 drivers/net: use intrinsic to access content of __m128i
Compiler intrinsics should be used to access/manipulate contents of __m128i.
Existing code results in the error below when compiled with MSVC:
../drivers/net/octeon_ep/cnxk_ep_rx_sse.c(61): error C2440:
'type cast': cannot convert from '__m128i' to 'rte_xmm_t'
The fix is to use an intrinsic instead. This compiles fine with gcc, clang and msvc.
--- drivers/net/octeon_ep/cnxk_ep_rx_sse.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/octeon_ep/cnxk_ep_rx_sse.c +4 -4
@@ -58,10 +58,10 @@ cnxk_ep_process_pkts_vec_sse(struct rte_mbuf **rx_pkts, struct otx_ep_droq *droq s23 =_mm_shuffle_epi8 (s23, cpy_mask);/* Store packet length and data length to mbuf. */ - *(uint64_t *)&m0->pkt_len = ((rte_xmm_t )s01).u64[0 ]; - *(uint64_t *)&m1->pkt_len = ((rte_xmm_t )s01).u64[1 ]; - *(uint64_t *)&m2->pkt_len = ((rte_xmm_t )s23).u64[0 ]; - *(uint64_t *)&m3->pkt_len = ((rte_xmm_t )s23).u64[1 ]; + *(uint64_t *)&m0->pkt_len =_mm_extract_epi64 (s01,0 ); + *(uint64_t *)&m1->pkt_len =_mm_extract_epi64 (s01,1 ); + *(uint64_t *)&m2->pkt_len =_mm_extract_epi64 (s23,0 ); + *(uint64_t *)&m3->pkt_len =_mm_extract_epi64 (s23,1 );/* Reset rearm data. */ *(uint64_t *)&m0->rearm_data = droq->rearm_data;
Signature · 1 line
2.47.0.vfs.0.3
PATCH v2 1/1 drivers/net: use intrinsic to access content of __m128i
Compiler intrinsics should be used to access/manipulate contents of __m128i.
Existing code results in the error below when compiled with MSVC:
../drivers/net/octeon_ep/cnxk_ep_rx_sse.c(61): error C2440:
'type cast': cannot convert from '__m128i' to 'rte_xmm_t'
The fix is to use an intrinsic instead. This compiles fine with gcc, clang and msvc.
--- drivers/net/octeon_ep/cnxk_ep_rx_sse.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/net/octeon_ep/cnxk_ep_rx_sse.c +11 -0
@@ -58,10 +58,21 @@ cnxk_ep_process_pkts_vec_sse(struct rte_mbuf **rx_pkts, struct otx_ep_droq *droq s23 =_mm_shuffle_epi8 (s23, cpy_mask);/* Store packet length and data length to mbuf. */ +#ifdef RTE_ARCH_64 + *(uint64_t *)&m0->pkt_len =_mm_extract_epi64 (s01,0 ); + *(uint64_t *)&m1->pkt_len =_mm_extract_epi64 (s01,1 ); + *(uint64_t *)&m2->pkt_len =_mm_extract_epi64 (s23,0 ); + *(uint64_t *)&m3->pkt_len =_mm_extract_epi64 (s23,1 ); +#else +/* _mm_extract_epi64 is only available on 64-bit architecture. +* The cast below is non-portable and results in compile error +* using MSVC. +*/ *(uint64_t *)&m0->pkt_len = ((rte_xmm_t )s01).u64[0 ]; *(uint64_t *)&m1->pkt_len = ((rte_xmm_t )s01).u64[1 ]; *(uint64_t *)&m2->pkt_len = ((rte_xmm_t )s23).u64[0 ]; *(uint64_t *)&m3->pkt_len = ((rte_xmm_t )s23).u64[1 ]; +#endif /* Reset rearm data. */ *(uint64_t *)&m0->rearm_data = droq->rearm_data;
Signature · 1 line
2.47.0.vfs.0.3
Quoted 20 lines
-----Original Message-----
From: Andre Muezerie <[email protected]>
Sent: Saturday, December 28, 2024 6:53 AM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; Vamsi Krishna Attunuru <[email protected]>
Subject: [EXTERNAL] [PATCH v2]drivers/net: use intrinsic to access content of__m128iCompiler intrinsics should be used to access/manipulate contents of
__m128i. Existing code results in the error below when compiled with MSVC:
.. /drivers/net/octeon_ep/cnxk_ep_rx_sse. c(61): error C2440: 'type cast':
cannot convert from '__m128i'Compiler intrinsics should be used to access/manipulate contents of
__m128i. Existing code results in the error below when compiled with MSVC:
Quoted 7 lines
../drivers/net/octeon_ep/cnxk_ep_rx_sse.c(61): error C2440:
'type cast': cannot convert from '__m128i' to 'rte_xmm_t'The fix is to use an intrinsic instead. This compiles fine with gcc, clang and msvc.
Signed-off-by Andre Muezerie <[email protected]>
Jerin Jacob
AppliedQuoted 39 lines
-----Original Message-----
From: Vamsi Krishna Attunuru <[email protected]>
Sent: Wednesday, February 5, 2025 10:20 AM
To: Andre Muezerie <[email protected]>
Cc: [email protected]; [email protected]; [email protected]
Subject: RE: [EXTERNAL] [PATCH v2]drivers/net: use intrinsic to access content of__m128iQuoted 28 lines
-----Original Message----- >From: Andre Muezerie <andremue@ linux. microsoft. com> >Sent: Saturday, December 28, 2024 6: 53 AM >To:
andremue@ linux. microsoft. com >Cc: bruce. richardson@ intel. com; dev@ dpdk. org; >konstantin. v. ananyev@ yandex. ru;-----Original Message-----
From: Andre Muezerie <[email protected]>
Sent: Saturday, December 28, 2024 6:53 AM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; Vamsi Krishna Attunuru <[email protected]>
Subject: [EXTERNAL] [PATCH v2]drivers/net: use intrinsic to access content of__m128iCompiler intrinsics should be used to access/manipulate contents of
__m128i. Existing code results in the error below when compiled with MSVC:
.. /drivers/net/octeon_ep/cnxk_ep_rx_sse. c(61): error C2440: 'type cast':
cannot convert from '__m128i'Compiler intrinsics should be used to access/manipulate contents of
__m128i. Existing code results in the error below when compiled with MSVC:../drivers/net/octeon_ep/cnxk_ep_rx_sse.c(61): error C2440:
'type cast': cannot convert from '__m128i' to 'rte_xmm_t'
Quoted 6 lines
Quoted 4 lines
The fix is to use an intrinsic instead. This compiles fine with gcc, clang and msvc.
Signed-off-by Andre Muezerie <[email protected]>Acked-by Vamsi Attunuru <[email protected]>
Applied to dpdk-next-net-mrvl/for-main. Thanks