Index: src/ppc/simulator-ppc.cc |
diff --git a/src/ppc/simulator-ppc.cc b/src/ppc/simulator-ppc.cc |
index 356281560ef415490f099d60920557301099e120..cdce60eb5980f73ffa5015b0199a3595d454e137 100644 |
--- a/src/ppc/simulator-ppc.cc |
+++ b/src/ppc/simulator-ppc.cc |
@@ -1849,6 +1849,20 @@ bool Simulator::ExecuteExt2_10bit(Instruction* instr) { |
} |
break; |
} |
+ case POPCNTW: { |
+ int rs = instr->RSValue(); |
+ int ra = instr->RAValue(); |
+ uintptr_t rs_val = get_register(rs); |
+ uintptr_t count = 0; |
+ int n = 0; |
+ uintptr_t bit = 0x80000000; |
+ for (; n < 32; n++) { |
+ if (bit & rs_val) count++; |
+ bit >>= 1; |
+ } |
+ set_register(ra, count); |
+ break; |
+ } |
case SYNC: { |
// todo - simulate sync |
break; |