[clang] [Headers][X86] Use `__builtin_elementwise_ctlz` instead of avx512cd intrinsics. (PR #155089)
Phoebe Wang via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 25 19:25:32 PDT 2025
phoebewang wrote:
> > Convert _mm_lzcnt_epi32 etc. (inc mask/maskz variants) to use __builtin_elementwise_ctlz
>
> It's not obvious to me how the mask/maskz variants (e.g. `_mm_maskz_lzcnt_epi32`) can be refactored to use `__builtin_elementwise_ctlz`.
>
> Is it enough to replace this call:
>
> https://github.com/llvm/llvm-project/blob/35e733689b9b47469cbb51a90d405738146e447c/clang/lib/Headers/avx512cdintrin.h#L84
>
> by a call to `__builtin_elementwise_ctlz`?
No, calling to intrinsic is good. We just need to change `__DEFAULT_FN_ATTRS` to `__DEFAULT_FN_ATTRS_CONSTEXPR` and add tests for them.
https://github.com/llvm/llvm-project/pull/155089
More information about the cfe-commits
mailing list