[llvm-dev] Extra Bit Manipulation intrinsics?

Hongbin Zheng via llvm-dev llvm-dev at lists.llvm.org
Mon Nov 5 20:45:21 PST 2018


There used to be such intrinsics (bit-field extract/deposit):
http://releases.llvm.org/2.0/docs/LangRef.html#int_part_select
http://releases.llvm.org/2.0/docs/LangRef.html#int_part_set
But they are removed later.

Our internal branch of llvm actual keep them.
Depending on how you want to use them, if you mixed them into pointer
calculations, it can easily confuse scalar evolution. This is bad.
Also, it is not hard to build these intrinsics from patterns of
and/or/shift/trunc/zext, so mabe you could build them in the backend
instead of at the LLVM IR level. E.g
https://github.com/etherzhhb/Shang/blob/eb4aa11385b93af4b73cfd4701e1473124ada325/lib/BitLevelOpt/BitLevelOpt.cpp


On Mon, Nov 5, 2018 at 8:25 PM Braden Nelson via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> Would it be worth it to add intrinsics for bitfield extract/deposit and
> binary rotate left/right?
> Both of these have dedicated instructions in multiple ISAs, including the
> two major ISAs (x86-64 and ARM)
> Adding them could decrease load on the backend to recognize common
> intrinsic patterns that correspond to these instructions, but could
> increase load on backends that do not have dedicated instructions for these
> intrinsics.
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181105/1b77b289/attachment.html>


More information about the llvm-dev mailing list