summaryrefslogtreecommitdiff
path: root/target-s390x/int_helper.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@twiddle.net>2012-09-01 11:14:04 -0700
committerRichard Henderson <rth@twiddle.net>2013-01-05 12:18:45 -0800
commit99b4f24b3e636ab241b53bc16bf8f0a0ac4a2271 (patch)
treef7fe0ebe88043f9fe0952d665aa5f312e2d00016 /target-s390x/int_helper.c
parent2112bf1bfb696def31b211425e5e74e89f9574c3 (diff)
downloadqemu-99b4f24b3e636ab241b53bc16bf8f0a0ac4a2271.tar.gz
target-s390: Implement POPCNT
Signed-off-by: Richard Henderson <rth@twiddle.net>
Diffstat (limited to 'target-s390x/int_helper.c')
-rw-r--r--target-s390x/int_helper.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/target-s390x/int_helper.c b/target-s390x/int_helper.c
index dc16de206c..685830124f 100644
--- a/target-s390x/int_helper.c
+++ b/target-s390x/int_helper.c
@@ -191,3 +191,15 @@ uint64_t HELPER(cvd)(int32_t bin)
return dec;
}
+
+uint64_t HELPER(popcnt)(uint64_t r2)
+{
+ uint64_t ret = 0;
+ int i;
+
+ for (i = 0; i < 64; i += 8) {
+ uint64_t t = ctpop32((r2 >> i) & 0xff);
+ ret |= t << i;
+ }
+ return ret;
+}