POPCNT (R32, M32)
Summary:
"Return the Count of Number of Bits Set to 1"
Reference:
https://www.felixcloutier.com/x86/POPCNT.html
Extension:
SSE4
Category:
SSE
ISA-Set:
POPCNT
CPL:
3
iform:
POPCNT_GPRv_MEMv
iclass:
POPCNT
ASM:
POPCNT
Operands
Operand 1 (w): Register (EAX, ECX, EDX, EBX, ESP, EBP, ESI, EDI, R8D, R9D, R10D, R11D, R12D, R13D, R14D, R15D)
Operand 2 (r): Memory
Operand 3 (w, suppressed): Flags (AF: w, CF: w, OF: w, PF: w, SF: w, ZF: w)
Available performance data
Alder Lake-P
Alder Lake-E
Rocket Lake
Tiger Lake
Ice Lake
Cascade Lake
Cannon Lake
Skylake-X
Coffee Lake
Kaby Lake
Skylake
Broadwell
Haswell
Ivy Bridge
Sandy Bridge
Westmere
Nehalem
Tremont
Goldmont Plus
Goldmont
Airmont
AMD Zen 4
AMD Zen 3
AMD Zen 2
AMD Zen+
Alder Lake-P
Measurements
Latencies
Latency operand 1 → 1:
0
Latency operand 1 → 3:
0
Latency operand 2 → 1 (address, base register):
8
Latency operand 2 → 1 (address, index register):
8
Latency operand 2 → 1 (memory):
≤3
Latency operand 2 → 3 (address, base register):
8
Latency operand 2 → 3 (address, index register):
8
Latency operand 2 → 3 (memory):
≤3
Throughput
Computed from the port usage: 1.00
Measured (loop):
1.00
Measured (unrolled):
1.00
Number of μops
Executed: 2
Retire slots: 1 (if an indexed addressing mode is used: 2)
Decoded (MITE): 1
Microcode Sequencer (MS): 0
Requires the complex decoder (5 other instructions can be decoded with simple decoders in the same cycle)
Port usage:
1*p1+1*p23A
Alder Lake-E
Measurements
Latencies
Latency operand 1 → 1:
0
Latency operand 1 → 3:
0
Latency operand 2 → 1 (address, base register):
7
Latency operand 2 → 1 (address, index register):
7
Latency operand 2 → 1 (memory):
≤3
Latency operand 2 → 3 (address, base register):
7
Latency operand 2 → 3 (address, index register):
7
Latency operand 2 → 3 (memory):
≤3
Throughput
Measured (loop):
1.00
Measured (unrolled):
1.00
Number of μops
Executed: 1
Microcode Sequencer (MS): 0
Rocket Lake
Measurements
Latencies
Latency operand 1 → 1:
0
Latency operand 1 → 3:
0
Latency operand 2 → 1 (address, base register):
8
Latency operand 2 → 1 (address, index register):
8
Latency operand 2 → 1 (memory):
≤3
Latency operand 2 → 3 (address, base register):
8
Latency operand 2 → 3 (address, index register):
8
Latency operand 2 → 3 (memory):
≤3
Throughput
Computed from the port usage: 1.00
Measured (loop):
1.00
Measured (unrolled):
1.00
Number of μops
Executed: 2
Retire slots: 1 (if an indexed addressing mode is used: 2)
Decoded (MITE): 1
Microcode Sequencer (MS): 0
Requires the complex decoder (3 other instructions can be decoded with simple decoders in the same cycle)
Port usage:
1*p1+1*p23
Tiger Lake
Measurements
Latencies
Latency operand 1 → 1:
0
Latency operand 1 → 3:
0
Latency operand 2 → 1 (address, base register):
8
Latency operand 2 → 1 (address, index register):
8
Latency operand 2 → 1 (memory):
≤3
Latency operand 2 → 3 (address, base register):
8
Latency operand 2 → 3 (address, index register):
8
Latency operand 2 → 3 (memory):
≤3
Throughput
Computed from the port usage: 1.00
Measured (loop):
1.00
Measured (unrolled):
1.00
Number of μops
Executed: 2
Retire slots: 1 (if an indexed addressing mode is used: 2)
Decoded (MITE): 1
Microcode Sequencer (MS): 0
Requires the complex decoder (3 other instructions can be decoded with simple decoders in the same cycle)
Port usage:
1*p1+1*p23
Ice Lake
Measurements
Latencies
Latency operand 1 → 1:
0
Latency operand 1 → 3:
0
Latency operand 2 → 1 (address, base register):
8
Latency operand 2 → 1 (address, index register):
8
Latency operand 2 → 1 (memory):
≤3
Latency operand 2 → 3 (address, base register):
8
Latency operand 2 → 3 (address, index register):
8
Latency operand 2 → 3 (memory):
≤3
Throughput
Computed from the port usage: 1.00
Measured (loop):
1.00
Measured (unrolled):
1.00
Number of μops
Executed: 2
Retire slots: 1 (if an indexed addressing mode is used: 2)
Decoded (MITE): 1
Microcode Sequencer (MS): 0
Requires the complex decoder (3 other instructions can be decoded with simple decoders in the same cycle)
Port usage:
1*p1+1*p23
Documentation
Latency: 8.0
Throughput: 1.0
Cascade Lake
Measurements
Latencies
Latency operand 1 → 1:
3
Latency operand 1 → 3:
3
Latency operand 2 → 1 (address, base register):
8
Latency operand 2 → 1 (address, index register):
8
Latency operand 2 → 1 (memory):
≤5
Latency operand 2 → 3 (address, base register):
8
Latency operand 2 → 3 (address, index register):
8
Latency operand 2 → 3 (memory):
≤5
Throughput
Computed from the port usage: 1.00
Measured (loop):
1.00
Measured (unrolled):
1.00
Number of μops
Executed: 2
Retire slots: 1
Decoded (MITE): 1
Microcode Sequencer (MS): 0
Requires the complex decoder (3 other instructions can be decoded with simple decoders in the same cycle)
Port usage:
1*p1+1*p23
Cannon Lake
Measurements
Latencies
Latency operand 1 → 1:
0
Latency operand 1 → 3:
0
Latency operand 2 → 1 (address, base register):
8
Latency operand 2 → 1 (address, index register):
8
Latency operand 2 → 1 (memory):
≤5
Latency operand 2 → 3 (address, base register):
8
Latency operand 2 → 3 (address, index register):
8
Latency operand 2 → 3 (memory):
≤5
Throughput
Computed from the port usage: 1.00
Measured (loop):
1.00
Measured (unrolled):
1.00
Number of μops
Executed: 2
Retire slots: 1 (if an indexed addressing mode is used: 2)
Decoded (MITE): 1
Microcode Sequencer (MS): 0
Requires the complex decoder (3 other instructions can be decoded with simple decoders in the same cycle)
Port usage:
1*p1+1*p23
Skylake-X
Measurements
Latencies
Latency operand 1 → 1:
3
Latency operand 1 → 3:
3
Latency operand 2 → 1 (address, base register):
8
Latency operand 2 → 1 (address, index register):
8
Latency operand 2 → 1 (memory):
≤5
Latency operand 2 → 3 (address, base register):
8
Latency operand 2 → 3 (address, index register):
8
Latency operand 2 → 3 (memory):
≤5
Throughput
Computed from the port usage: 1.00
Measured (loop):
1.00
Measured (unrolled):
1.00
Number of μops
Executed: 2
Retire slots: 1
Decoded (MITE): 1
Microcode Sequencer (MS): 0
Requires the complex decoder (3 other instructions can be decoded with simple decoders in the same cycle)
Port usage:
1*p1+1*p23
IACA 2.3
Throughput
Computed from the port usage: 1.00
IACA:
1.00
Number of μops:
2
Port usage:
1*p1+1*p23
IACA 3.0
Throughput
Computed from the port usage: 1.00
IACA:
1.00
Number of μops:
2
Port usage:
1*p1+1*p23
Coffee Lake
Measurements
Latencies
Latency operand 1 → 1:
3
Latency operand 1 → 3:
3
Latency operand 2 → 1 (address, base register):
8
Latency operand 2 → 1 (address, index register):
8
Latency operand 2 → 1 (memory):
≤5
Latency operand 2 → 3 (address, base register):
8
Latency operand 2 → 3 (address, index register):
8
Latency operand 2 → 3 (memory):
≤5
Throughput
Computed from the port usage: 1.00
Measured (loop):
1.00
Measured (unrolled):
1.00
Number of μops
Executed: 2
Retire slots: 1
Decoded (MITE): 1
Microcode Sequencer (MS): 0
Requires the complex decoder (3 other instructions can be decoded with simple decoders in the same cycle)
Port usage:
1*p1+1*p23
Kaby Lake
Measurements
Latencies
Latency operand 1 → 1:
3
Latency operand 1 → 3:
3
Latency operand 2 → 1 (address, base register):
8
Latency operand 2 → 1 (address, index register):
8
Latency operand 2 → 1 (memory):
≤5
Latency operand 2 → 3 (address, base register):
8
Latency operand 2 → 3 (address, index register):
8
Latency operand 2 → 3 (memory):
≤5
Throughput
Computed from the port usage: 1.00
Measured (loop):
1.00
Measured (unrolled):
1.00
Number of μops
Executed: 2
Retire slots: 1
Decoded (MITE): 1
Microcode Sequencer (MS): 0
Requires the complex decoder (3 other instructions can be decoded with simple decoders in the same cycle)
Port usage:
1*p1+1*p23
Skylake
Measurements
Latencies
Latency operand 1 → 1:
3
Latency operand 1 → 3:
3
Latency operand 2 → 1 (address, base register):
8
Latency operand 2 → 1 (address, index register):
8
Latency operand 2 → 1 (memory):
≤5
Latency operand 2 → 3 (address, base register):
8
Latency operand 2 → 3 (address, index register):
8
Latency operand 2 → 3 (memory):
≤5
Throughput
Computed from the port usage: 1.00
Measured (loop):
1.00
Measured (unrolled):
1.00
Number of μops
Executed: 2
Retire slots: 1
Decoded (MITE): 1
Microcode Sequencer (MS): 0
Requires the complex decoder (3 other instructions can be decoded with simple decoders in the same cycle)
Port usage:
1*p1+1*p23
IACA 2.3
Throughput
Computed from the port usage: 1.00
IACA:
1.00
Number of μops:
2
Port usage:
1*p1+1*p23
IACA 3.0
Throughput
Computed from the port usage: 1.00
IACA:
1.00
Number of μops:
2
Port usage:
1*p1+1*p23
Broadwell
Measurements
Latencies
Latency operand 1 → 1:
3
Latency operand 1 → 3:
3
Latency operand 2 → 1 (address, base register):
8
Latency operand 2 → 1 (address, index register):
8
Latency operand 2 → 1 (memory):
≤7
Latency operand 2 → 3 (address, base register):
8
Latency operand 2 → 3 (address, index register):
8
Latency operand 2 → 3 (memory):
≤7
Throughput
Computed from the port usage: 1.00
Measured (loop):
1.00
Measured (unrolled):
1.00
Number of μops
Executed: 2
Retire slots: 1
Decoded (MITE): 1
Microcode Sequencer (MS): 0
Requires the complex decoder (no other instruction can be decoded with simple decoders in the same cycle)
Port usage:
1*p1+1*p23
IACA 2.2
Throughput
Computed from the port usage: 1.00
IACA:
1.00 (with the -no_interiteration flag: 1.00)
Number of μops:
2
Port usage:
1*p1+1*p23
IACA 2.3
Throughput
Computed from the port usage: 1.00
IACA:
1.00
Number of μops:
2
Port usage:
1*p1+1*p23
IACA 3.0
Throughput
Computed from the port usage: 1.00
IACA:
1.00
Number of μops:
2
Port usage:
1*p1+1*p23
Haswell
Measurements
Latencies
Latency operand 1 → 1:
3
Latency operand 1 → 3:
3
Latency operand 2 → 1 (address, base register):
8
Latency operand 2 → 1 (address, index register):
8
Latency operand 2 → 1 (memory):
≤7
Latency operand 2 → 3 (address, base register):
8
Latency operand 2 → 3 (address, index register):
8
Latency operand 2 → 3 (memory):
≤7
Throughput
Computed from the port usage: 1.00
Measured (loop):
1.00
Measured (unrolled):
1.00
Number of μops
Executed: 2
Retire slots: 1
Decoded (MITE): 1
Microcode Sequencer (MS): 0
Requires the complex decoder (no other instruction can be decoded with simple decoders in the same cycle)
Port usage:
1*p1+1*p23
IACA 2.1
Latency:
9
Throughput
Computed from the port usage: 1.00
IACA:
1.00 (with the -no_interiteration flag: 1.00)
Number of μops:
2
Port usage:
1*p1+1*p23
IACA 2.2
Throughput
Computed from the port usage: 1.00
IACA:
1.00 (with the -no_interiteration flag: 1.00)
Number of μops:
2
Port usage:
1*p1+1*p23
IACA 2.3
Throughput
Computed from the port usage: 1.00
IACA:
1.00
Number of μops:
2
Port usage:
1*p1+1*p23
IACA 3.0
Throughput
Computed from the port usage: 1.00
IACA:
1.00
Number of μops:
2
Port usage:
1*p1+1*p23
Ivy Bridge
Measurements
Latencies
Latency operand 1 → 1:
3
Latency operand 1 → 3:
3
Latency operand 2 → 1 (address, base register):
8
Latency operand 2 → 1 (address, index register):
8
Latency operand 2 → 1 (memory):
≤7
Latency operand 2 → 3 (address, base register):
8
Latency operand 2 → 3 (address, index register):
8
Latency operand 2 → 3 (memory):
≤7
Throughput
Computed from the port usage: 1.00
Measured (loop):
1.00
Measured (unrolled):
1.00
Number of μops
Executed: 2
Retire slots: 1 (if an indexed addressing mode is used: 2)
Decoded (MITE): 1
Microcode Sequencer (MS): 0
Requires the complex decoder (no other instruction can be decoded with simple decoders in the same cycle)
Port usage:
1*p1+1*p23
IACA 2.1
Latency:
9
Throughput
Computed from the port usage: 1.00
IACA:
1.00 (with the -no_interiteration flag: 1.00)
Number of μops:
2
Port usage:
1*p1+1*p23
IACA 2.2
Throughput
Computed from the port usage: 1.00
IACA:
1.00 (with the -no_interiteration flag: 1.00)
Number of μops:
2
Port usage:
1*p1+1*p23
IACA 2.3
Throughput
Computed from the port usage: 1.00
IACA:
1.00
Number of μops:
2
Port usage:
1*p1+1*p23
Sandy Bridge
Measurements
Latencies
Latency operand 1 → 1:
3
Latency operand 1 → 3:
3
Latency operand 2 → 1 (address, base register):
8
Latency operand 2 → 1 (address, index register):
8
Latency operand 2 → 1 (memory):
≤7
Latency operand 2 → 3 (address, base register):
8
Latency operand 2 → 3 (address, index register):
8
Latency operand 2 → 3 (memory):
≤7
Throughput
Computed from the port usage: 1.00
Measured (loop):
1.00
Measured (unrolled):
1.00
Number of μops
Executed: 2
Retire slots: 1 (if an indexed addressing mode is used: 2)
Decoded (MITE): 1
Microcode Sequencer (MS): 0
Requires the complex decoder (no other instruction can be decoded with simple decoders in the same cycle)
Port usage:
1*p1+1*p23
IACA 2.1
Latency:
9
Throughput
Computed from the port usage: 1.00
IACA:
1.00 (with the -no_interiteration flag: 1.00)
Number of μops:
2
Port usage:
1*p1+1*p23
IACA 2.2
Throughput
Computed from the port usage: 1.00
IACA:
1.00 (with the -no_interiteration flag: 1.00)
Number of μops:
2
Port usage:
1*p1+1*p23
IACA 2.3
Throughput
Computed from the port usage: 1.00
IACA:
1.00
Number of μops:
2
Port usage:
1*p1+1*p23
Westmere
Measurements
Latencies
Latency operand 1 → 1:
0
Latency operand 1 → 3:
0
Latency operand 2 → 1 (address, base register):
7
Latency operand 2 → 1 (address, index register):
7
Latency operand 2 → 1 (memory):
≤7
Latency operand 2 → 3 (address, base register):
7
Latency operand 2 → 3 (address, index register):
7
Latency operand 2 → 3 (memory):
≤7
Throughput
Computed from the port usage: 1.00
Measured (loop):
1.00
Measured (unrolled):
1.00
Number of μops
Executed: 2
Retire slots: 1 (if an indexed addressing mode is used: 2)
Microcode Sequencer (MS): 0
Requires the complex decoder
Port usage:
1*p1+1*p2
IACA 2.1
Latency:
9
Throughput
Computed from the port usage: 1.00
IACA:
1.00 (with the -no_interiteration flag: 1.00)
Number of μops:
2
Port usage:
1*p1+1*p2
IACA 2.2
Throughput
Computed from the port usage: 1.00
IACA:
1.00 (with the -no_interiteration flag: 1.00)
Number of μops:
2
Port usage:
1*p1+1*p2
Nehalem
Measurements
Latencies
Latency operand 1 → 1:
0
Latency operand 1 → 3:
0
Latency operand 2 → 1 (address, base register):
7
Latency operand 2 → 1 (address, index register):
7
Latency operand 2 → 1 (memory):
≤7
Latency operand 2 → 3 (address, base register):
7
Latency operand 2 → 3 (address, index register):
7
Latency operand 2 → 3 (memory):
≤7
Throughput
Computed from the port usage: 1.00
Measured (loop):
1.00
Measured (unrolled):
1.00
Number of μops
Executed: 2
Retire slots: 1 (if an indexed addressing mode is used: 2)
Microcode Sequencer (MS): 0
Requires the complex decoder
Port usage:
1*p1+1*p2
IACA 2.1
Latency:
9
Throughput
Computed from the port usage: 1.00
IACA:
1.00 (with the -no_interiteration flag: 1.00)
Number of μops:
2
Port usage:
1*p1+1*p2
IACA 2.2
Throughput
Computed from the port usage: 1.00
IACA:
1.00 (with the -no_interiteration flag: 1.00)
Number of μops:
2
Port usage:
1*p1+1*p2
Tremont
Measurements
Latencies
Latency operand 1 → 1:
0
Latency operand 1 → 3:
0
Latency operand 2 → 1 (address, base register):
6
Latency operand 2 → 1 (address, index register):
6
Latency operand 2 → 1 (memory):
≤7
Latency operand 2 → 3 (address, base register):
6
Latency operand 2 → 3 (address, index register):
6
Latency operand 2 → 3 (memory):
≤7
Throughput
Measured (loop):
1.00
Measured (unrolled):
1.00
Number of μops
Executed: 1
Microcode Sequencer (MS): 0
Goldmont Plus
Measurements
Latencies
Latency operand 1 → 1:
0
Latency operand 1 → 3:
0
Latency operand 2 → 1 (address, base register):
6
Latency operand 2 → 1 (address, index register):
6
Latency operand 2 → 1 (memory):
≤7
Latency operand 2 → 3 (address, base register):
6
Latency operand 2 → 3 (address, index register):
6
Latency operand 2 → 3 (memory):
≤7
Throughput
Measured (loop):
1.00
Measured (unrolled):
1.00
Number of μops
Executed: 1
Microcode Sequencer (MS): 0
Goldmont
Measurements
Latencies
Latency operand 1 → 1:
3
Latency operand 1 → 3:
3
Latency operand 2 → 1 (address, base register):
6
Latency operand 2 → 1 (address, index register):
6
Latency operand 2 → 1 (memory):
≤7
Latency operand 2 → 3 (address, base register):
6
Latency operand 2 → 3 (address, index register):
6
Latency operand 2 → 3 (memory):
≤7
Throughput
Measured (loop):
1.17
Measured (unrolled):
1.00
Number of μops
Executed: 1
Microcode Sequencer (MS): 0
Airmont
Measurements
Latencies
Latency operand 1 → 1:
3
Latency operand 1 → 3:
3
Latency operand 2 → 1 (address, base register):
6
Latency operand 2 → 1 (address, index register):
6
Latency operand 2 → 1 (memory):
≤10
Latency operand 2 → 3 (address, base register):
6
Latency operand 2 → 3 (address, index register):
6
Latency operand 2 → 3 (memory):
≤7
Throughput
Measured (loop):
1.16
Measured (unrolled):
1.00
Number of μops
Executed: 1
Microcode Sequencer (MS): 0
AMD Zen 4
Measurements
Latencies
Latency operand 1 → 1:
0
Latency operand 1 → 3:
0
Latency operand 2 → 1 (address, base register):
5
Latency operand 2 → 1 (address, index register):
5
Latency operand 2 → 1 (memory):
≤7
Latency operand 2 → 3 (address, base register):
5
Latency operand 2 → 3 (address, index register):
5
Latency operand 2 → 3 (memory):
≤7
Throughput
Measured (loop):
0.33
Measured (unrolled):
0.33 (if an indexed addressing mode is used: 0.37)
Number of μops
Executed: 1 (if an indexed addressing mode is used: 2)
AMD Zen 3
Measurements
Latencies
Latency operand 1 → 1:
0
Latency operand 1 → 3:
0
Latency operand 2 → 1 (address, base register):
5
Latency operand 2 → 1 (address, index register):
5
Latency operand 2 → 1 (memory):
≤6
Latency operand 2 → 3 (address, base register):
5
Latency operand 2 → 3 (address, index register):
5
Latency operand 2 → 3 (memory):
≤6
Throughput
Measured (loop):
0.33
Measured (unrolled):
0.33
Number of μops
Executed: 1
Documentation
Latency: 1
Throughput: 0.25
Number of μops: 1
Port usage: ALU
AMD Zen 2
Measurements
Latencies
Latency operand 1 → 1:
0
Latency operand 1 → 3:
0
Latency operand 2 → 1 (address, base register):
5
Latency operand 2 → 1 (address, index register):
5
Latency operand 2 → 1 (memory):
≤1
Latency operand 2 → 3 (address, base register):
5
Latency operand 2 → 3 (address, index register):
5
Latency operand 2 → 3 (memory):
≤1
Throughput
Measured (loop):
0.50
Measured (unrolled):
0.50
Number of μops
Executed: 1
Documentation
Latency: 1
Throughput: 0.25
Number of μops: 1
Port usage: ALU
AMD Zen+
Measurements
Latencies
Latency operand 1 → 1:
0
Latency operand 1 → 3:
0
Latency operand 2 → 1 (address, base register):
5
Latency operand 2 → 1 (address, index register):
5
Latency operand 2 → 1 (memory):
≤7
Latency operand 2 → 3 (address, base register):
5
Latency operand 2 → 3 (address, index register):
5
Latency operand 2 → 3 (memory):
≤7
Throughput
Measured (loop):
0.50
Measured (unrolled):
0.50
Number of μops
Executed: 1