Skip to content

[Clang] VectorExprEvaluator::VisitCallExpr / InterpretBuiltin - add MMX/SSE/AVX/AVX512 VPSADBW / VMPSADBW / VDBPSADBW intrinsics to be used in constexpr #157522

@RKSimon

Description

@RKSimon

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_sad_epu8 _mm256_sad_epu8 _mm512_sad_epu8 _mm_sad_pu8

_mm_mpsadbw_epu8 _mm256_mpsadbw_epu8

_mm_dbsad_epu8 _mm_mask_dbsad_epu8 _mm_maskz_dbsad_epu8
_mm256_dbsad_epu8 _mm256_mask_dbsad_epu8 _mm256_maskz_dbsad_epu8
_mm512_dbsad_epu8 _mm512_mask_dbsad_epu8 _mm512_maskz_dbsad_epu8

These intrinsics can be tricky to correctly evaluate, so I'd recommend previous knowledge of SSE/AVX instructions is required: VPSADBW is pretty straightfoward, but VMPSADBW / VDBPSADBW is messy.

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

Metadata

Metadata

Assignees

Labels

backend:X86clang:bytecodeIssues for the clang bytecode constexpr interpreterclang:frontendLanguage frontend issues, e.g. anything involving "Sema"constexprAnything related to constant evaluationgood first issuehttps://github.com/llvm/llvm-project/contribute

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions