popc GPU Virtual ISA NVIDIA

Population Count Bit Manipulation

popc.type d, a;

Count the number of set bits in an integer operand.

Encoding

PTX is a virtual instruction set. It has no single, stable native binary encoding — the compiler lowers this instruction to different native machine code depending on the selected NVIDIA target architecture (compute capability). This page intentionally shows no bit-diagram; see the target/version requirements below for what governs how this instruction compiles.
PTX ISA Version Introduced PTX ISA 2.0
Minimum Target sm_20

Syntax Forms

One mnemonic covers many type / state-space / scope / modifier combinations — each row below is an independently valid form.

Syntax Data Types State Space(s) Modifiers Min. Target Description
popc.type d, a; b32, b64 sm_20 Population count.

Operands

  • d
    Destination register (u32)
  • a
    Source operand

At a Glance

Data Types b32, b64

Related AMDGPU Concepts

Population Count ↗
equivalent with restrictions
v_bcnt_u32_b32 (AMDGPU)

Reference

NVIDIA PTX ISA

Semantics

d = number of 1-bits in a.

Sources