diff options
Diffstat (limited to 'riscv/insns/cpopw.h')
-rw-r--r-- | riscv/insns/cpopw.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/riscv/insns/cpopw.h b/riscv/insns/cpopw.h new file mode 100644 index 0000000..13e9ba0 --- /dev/null +++ b/riscv/insns/cpopw.h @@ -0,0 +1,6 @@ +require_rv64; +require_extension('B'); +reg_t x = 0; +for (int i = 0; i < 32; i++) + if (1 & (RS1 >> i)) x++; +WRITE_RD(sext32(x)); |