Population Count Bit Manipulation

Count the number of set (1) bits in an integer operand.

Vendor-Neutral Definition

d = number of 1-bits in a, evaluated at the operand's integer width.
⚠️ Cross-vendor mappings describe semantic relationships and are not guaranteed one-to-one compiler translations.
equivalent with restrictions Both count the set bits in an integer operand.
Property NVIDIA PTX AMDGPU
Instruction popc v_bcnt_u32_b32
ISA Layer Virtual Native
Data Types b32, b64 b32, u32
Version / Target Introduced PTX ISA 2.0 gfx942/gfx1100

Important Differences

  • v_bcnt_u32_b32 on AMDGPU is a 3-operand accumulating popcount (result = popcount(src0) + src1) rather than PTX popc's plain 2-operand form; a zero accumulator operand is required to match PTX popc's semantics exactly.

Source Evidence

Verification method: documentation