[PATCH v10] eal: RTE_PTR_ADD/SUB char* for compiler optimizations

Morten Brørup mb at smartsharesystems.com
Sat Jan 24 08:58:52 CET 2026


> From: Scott Mitchell <scott.k.mitch1 at gmail.com>
> 
> Modify RTE_PTR_ADD and RTE_PTR_SUB to use char* pointer arithmetic
> on Clang instead of uintptr_t casts. Benefits of this approach:
> - API compatibility: works for both integer and pointer inputs
> - Retains simple macros: no pragmas, no _Generic
> - Enables Clang optimizations: Clang can now unroll and vectorize
>   pointer loops. GCC uses uintptr_t to avoid false positive warnings.
> 
> Example use case which benefits is __rte_raw_cksum. Performance
> results from cksum_perf_autotest on Intel Xeon (Cascade Lake,
> AVX-512) built with Clang 18.1 (TSC cycles/byte):
>   Block size    Before    After    Improvement
>          100      0.40     0.24        ~40%
>         1500      0.50     0.06        ~8x
>         9000      0.49     0.06        ~8x
> 
> Signed-off-by: Scott Mitchell <scott.k.mitch1 at gmail.com>

Acked-by: Morten Brørup <mb at smartsharesystems.com>



More information about the dev mailing list