[LLVMdev] Question about llvm.ctpop.*

Chris Lattner clattner at apple.com
Tue Nov 13 17:53:36 PST 2012


On Nov 13, 2012, at 4:53 PM, Shuxin Yang <shuxin.llvm at gmail.com> wrote:

> Hi,
> 
>   Following is excerpted from http://llvm.org/releases/3.1/docs/LangRef.html#int_ctpop.
> How come the return type needs to be consistent with parameter type?  i64/i128 seems to be overkill,
> and i8, i16 are inconvenient.

It isn't required at the machine code level, it is just to make clients of the IR simpler, because ctpop (and other bithack intrinsics) are simpler that way.  Also, picking any fixed result type won't work: you have to support vectors.  Allowing it to be arbitrary just adds complexity.

-Chris


> 
> -----------------------------------
>  declare i8 @llvm.ctpop.i8(i8  <src>)
>  declare i16 @llvm.ctpop.i16(i16 <src>)
>  declare i32 @llvm.ctpop.i32(i32 <src>)
>  declare i64 @llvm.ctpop.i64(i64 <src>)
>  declare i256 @llvm.ctpop.i256(i256 <src>)
>  declare <2 x i32> @llvm.ctpop.v2i32(<2 x i32> <src>)
> -----------------------------------------------
> 
> Thanks
> Shuxin
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list