cpop
riscv_unified_db)RV32 / RV64 (Ratified & Standard Extensions)
main
userZbbSummary
Counts the number of 1's (i.e., set bits) in the source register.
Syntax / Encoding
cpop xd, xs1 | 011000000010xxxxx001xxxxx0010011 (mask=0xfff0707f match=0x60201013)
Cross-Chip Latency & Throughput (11 cores)
| Microarchitecture | Latency (cycles) | Recip. TP | uops | Ports | Source |
|---|---|---|---|---|---|
| Syntacore SCR7 | 1 | 1 | 1 | BMU | llvm_sched_models |
| Tenstorrent Ascalon-X | 1 | 1 | 1 | AscalonFX | llvm_sched_models |
| MIPS P8700 (RISC-V) | 2 | 1 | 1 | p8700IssueAL2 | llvm_sched_models |
| SiFive P670 / P600 | 2 | 1 | 1 | SiFiveP600MulI2F | llvm_sched_models |
| SiFive P870 / P800 | 2 | 0.5 | 1 | SiFiveP800Mul | llvm_sched_models |
| SpacemiT X100 | 2 | 0.25 | 1 | SMTX100_IQ | llvm_sched_models |
| SpacemiT X60 (K1) | 2 | 0.5 | 1 | SMX60_IEU | llvm_sched_models |
| Andes 45-Series | 3 | 0.5 | 1 | Andes45ALU | llvm_sched_models |
| SiFive 7-Series (U74) | 3 | 1 | 1 | PipeB | llvm_sched_models |
| XiangShan KunMingHu | 3 | 0.5 | 1 | XSPipeGroupBKU | llvm_sched_models |
| XiangShan NanHu | 3 | 0.5 | 1 | XS2MDU | llvm_sched_models |
Binary Encodings (1)
| Width | Format | Bit Pattern | Mask / Match |
|---|---|---|---|
| 32 | RV | 011000000010xxxxx001xxxxx0010011 | 0xfff0707f / 0x60201013 |
Operands
| Name | Description |
|---|---|
xs1 | bits [19:15] |
xd | bits [11:7] |
Reference Notes
Counts the number of 1's (i.e., set bits) in the source register. .Software Hint [NOTE] ---- This operations is known as population count, popcount, sideways sum, bit summation, or Hamming weight. The GCC builtin function `__builtin_popcount (unsigned int x)` is implemented by cpop on RV32 and by cpopw on RV64. The GCC builtin function `__builtin_popcountl (unsigned long x)` for LP64 is implemented by cpop on RV64. ----