[llvm-dev] Extra Bit Manipulation intrinsics?

mbraun via llvm-dev llvm-dev at lists.llvm.org
Mon Nov 5 23:10:17 PST 2018


The problem with that is that a bitfield extract of n bits starting at bit b (mask == (1<<b)-1) corresponds to:

   (X >> b) & mask

Replacing it with an intrinsic hides this fact and you have to carefully examine every instcombine rule that operates on an “&” to also operate on the bitfield extract. You need to add a good amount of extra combines and it becomes likely that some get missed. Thus forming such intrinsics before instruction selection in the backend is bad from a software engineering point of view IMO.

A similar reasoning can be applied to bitfield insertions.

- Matthias

> On Nov 5, 2018, at 9:57 AM, 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



More information about the llvm-dev mailing list