Issue 172857
Summary Feature request: `@llvm.pdep` and `@llvm.pext`
Labels new issue
Assignees
Reporter eisenwave
    There are currently target-specific intrinsics like `@llvm.x86.bmi.pdep.32`, but no portable wrapper exists yet.

Having a portable intrinsic is mainly relevant due to
- https://github.com/cplusplus/papers/issues/1768

This paper is past the design stage for C++, and I hope for it to be merged into the C++29 working draft next year.

<img width="1363" height="283" alt="Image" src="" />

https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3104r4.html#hardware-support

Hardware support may not be universal, but at least the `pext` on x86 and `bext` on ARM are completely identical. There is also massive potential for optimization when the mask for `pext` and `pdep` is known.

The goal would be to lower `std::bit_compress` -> `__builtin_bit_compress` -> `@llvm.pext` -> `pext`.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to