[clang] First draft: [Clang] Add constant evaluation support for x86 psadbw (PR #169253)
Mohsen Rahmati via cfe-commits
cfe-commits at lists.llvm.org
Mon May 4 10:51:29 PDT 2026
Mohxen wrote:
Hi @RKSimon,
I updated this draft based on your feedback. This now covers the PSADBW intrinsics requested in #188062. This was also split out from #157522.
The patch now handles `psadbw128`, `psadbw256`, and `psadbw512` in both constexpr evaluators, uses `APIntOps::abdu` for the unsigned absolute difference, and keeps the fixed-vector checks as asserts.
I also moved the builtins into existing `Constexpr` builtin groups, marked the public wrappers constexpr, and replaced the separate AST/ByteCode test with `TEST_CONSTEXPR` checks in the existing X86 builtin test files.
Covered wrappers:
`_mm_sad_pu8`, `_mm_sad_epu8`, `_mm256_sad_epu8`, and `_mm512_sad_epu8`.
Local targeted tests pass: `mmx-builtins.c`, `sse2-builtins.c`, `avx2-builtins.c`, and `avx512bw-builtins.c`.
https://github.com/llvm/llvm-project/pull/169253
More information about the cfe-commits
mailing list