Question about llvm.ctpop.*

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'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
matters.

-Eli

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