llvm/llvm-project

[Clang] VectorExprEvaluator::VisitCallExpr / InterpretBuiltin - allow SSE/AVX2 VMPSADBW intrinsics to be used in constexpr

Fermée

#157 522 ouverte le 8 sept. 2025

 (10 commentaires) (0 réaction) (0 personne assignée)C++ (10 782 forks)batch import
backend:X86clang:bytecodeclang:frontendconstexprgood first issue

Métriques du dépôt

Stars
 (26 378 étoiles)
Métriques de merge PR
 (Merge moyen 1j 2h) (1 000 PRs mergées en 30 j)

Description

The horizontal sum of difference intrinsics can all be used in constexpr with suitable handling of the builtins inside VectorExprEvaluator::VisitCallExpr and InterBuiltin.cpp, and testing in the relevent *-builtins.c files.

_mm_mpsadbw_epu8 _mm256_mpsadbw_epu8

These intrinsics can be tricky to correctly evaluate, so I'd recommend previous knowledge of SSE/AVX instructions is required

Care needs to be taken with the signed/unsigned extension of the arguments - we might need to adjust the builtin signatures.

Guide contributeur