]> git.proxmox.com Git - qemu.git/commitdiff
target-s390: Implement POPCNT
authorRichard Henderson <rth@twiddle.net>
Sat, 1 Sep 2012 18:14:04 +0000 (11:14 -0700)
committerRichard Henderson <rth@twiddle.net>
Sat, 5 Jan 2013 20:18:45 +0000 (12:18 -0800)
Signed-off-by: Richard Henderson <rth@twiddle.net>
target-s390x/helper.h
target-s390x/insn-data.def
target-s390x/int_helper.c
target-s390x/translate.c

index aef6f0faf885b335d7eebc4bfc8ef43a8a00af0e..23d23d5b3aa4617040987e22fa83ca3b4c904af2 100644 (file)
@@ -87,6 +87,7 @@ DEF_HELPER_4(tr, void, env, i32, i64, i64)
 DEF_HELPER_4(cksm, i64, env, i64, i64, i64)
 DEF_HELPER_FLAGS_5(calc_cc, TCG_CALL_NO_RWG_SE, i32, env, i32, i64, i64, i64)
 DEF_HELPER_FLAGS_2(sfpc, TCG_CALL_NO_RWG, void, env, i64)
+DEF_HELPER_FLAGS_1(popcnt, TCG_CALL_NO_RWG_SE, i64, i64)
 
 #ifndef CONFIG_USER_ONLY
 DEF_HELPER_3(servc, i32, env, i64, i64)
index 0777b5567beb2777c4ec894c2596071f62e80347..49e4a441fd4dbb8d193fd2577e7e25475f754553 100644 (file)
     C(0xe336, PFD,     RXY_b, GIE, 0, 0, 0, 0, 0, 0)
     C(0xc602, PFDRL,   RIL_c, GIE, 0, 0, 0, 0, 0, 0)
 
+/* POPULATION COUNT */
+    C(0xb9e1, POPCNT,  RRE,   PC,  0, r2_o, r1, 0, popcnt, nz64)
+
 /* ROTATE LEFT SINGLE LOGICAL */
     C(0xeb1d, RLL,     RSY_a, Z,   r3_o, sh32, new, r1_32, rll32, 0)
     C(0xeb1c, RLLG,    RSY_a, Z,   r3_o, sh64, r1, 0, rll64, 0)
index dc16de206c076374545632e402b4b4efd460dbf0..685830124f695a17360ce968fc55cc1692fbc9fe 100644 (file)
@@ -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;
+}
index dc5aac794131f6fe63deb78002a83de518e0c100..fe880956f0d70a3e846a4d7d68f38d44d8e89559 100644 (file)
@@ -2558,6 +2558,12 @@ static ExitStatus op_ori(DisasContext *s, DisasOps *o)
     return NO_EXIT;
 }
 
+static ExitStatus op_popcnt(DisasContext *s, DisasOps *o)
+{
+    gen_helper_popcnt(o->out, o->in2);
+    return NO_EXIT;
+}
+
 #ifndef CONFIG_USER_ONLY
 static ExitStatus op_ptlb(DisasContext *s, DisasOps *o)
 {