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

Morten Brørup
2026-01-24T07:58:57Z

> From: Scott Mitchell <scott.k.mitch1@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@gmail.com>

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