[LLVMdev] Question about llvm.ctpop.*

Eli Friedman eli.friedman at gmail.com
Tue Nov 13 17:53:06 PST 2012

On Tue, 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.
> -----------------------------------
>   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>)

It's basically just for the sake of simplicity... why should the
intrinsic be overloaded over two types if only one is necessary? If
there's a compelling use-case, it wouldn't be difficult to make the
return type independent of the operand type, but I'm not sure why it


More information about the llvm-dev mailing list