[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 131/147] target-s390: Implement POPCNT
From: |
Richard Henderson |
Subject: |
[Qemu-devel] [PATCH 131/147] target-s390: Implement POPCNT |
Date: |
Thu, 27 Sep 2012 18:07:47 -0700 |
Signed-off-by: Richard Henderson <address@hidden>
---
target-s390x/helper.h | 1 +
target-s390x/insn-data.def | 3 +++
target-s390x/int_helper.c | 12 ++++++++++++
target-s390x/translate.c | 6 ++++++
4 files changed, 22 insertions(+)
diff --git a/target-s390x/helper.h b/target-s390x/helper.h
index fba3b70..03effd1 100644
--- a/target-s390x/helper.h
+++ b/target-s390x/helper.h
@@ -86,6 +86,7 @@ DEF_HELPER_4(unpk, void, env, i32, i64, i64)
DEF_HELPER_4(tr, void, env, i32, i64, i64)
DEF_HELPER_4(cksm, i64, env, i64, i64, i64)
DEF_HELPER_FLAGS_2(sfpc, TCG_CALL_CONST, void, env, i64)
+DEF_HELPER_FLAGS_1(popcnt, TCG_CALL_PURE|TCG_CALL_CONST, i64, i64)
DEF_HELPER_FLAGS_5(calc_cc, TCG_CALL_PURE|TCG_CALL_CONST,
i32, env, i32, i64, i64, i64)
diff --git a/target-s390x/insn-data.def b/target-s390x/insn-data.def
index 0777b55..49e4a44 100644
--- a/target-s390x/insn-data.def
+++ b/target-s390x/insn-data.def
@@ -539,6 +539,9 @@
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)
diff --git a/target-s390x/int_helper.c b/target-s390x/int_helper.c
index 00f764c..3a86fba 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;
+}
diff --git a/target-s390x/translate.c b/target-s390x/translate.c
index dddd822..6c23729 100644
--- a/target-s390x/translate.c
+++ b/target-s390x/translate.c
@@ -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)
{
--
1.7.11.4
- [Qemu-devel] [PATCH 121/147] target-s390: Implement RISBG, (continued)
- [Qemu-devel] [PATCH 121/147] target-s390: Implement RISBG, Richard Henderson, 2012/09/27
- [Qemu-devel] [PATCH 122/147] target-s390: Implement LDGR, LGDR, Richard Henderson, 2012/09/27
- [Qemu-devel] [PATCH 123/147] target-s390: Implement R[NOX]SBG, Richard Henderson, 2012/09/27
- [Qemu-devel] [PATCH 124/147] target-s390: Implement PREFETCH, Richard Henderson, 2012/09/27
- [Qemu-devel] [PATCH 125/147] target-s390: Implement COMPARE RELATIVE LONG, Richard Henderson, 2012/09/27
- [Qemu-devel] [PATCH 126/147] target-s390: Implement COMPARE AND TRAP, Richard Henderson, 2012/09/27
- [Qemu-devel] [PATCH 127/147] target-s390: Implement LOAD ON CONDITION, Richard Henderson, 2012/09/27
- [Qemu-devel] [PATCH 128/147] target-s390: Implement STORE ON CONDITION, Richard Henderson, 2012/09/27
- [Qemu-devel] [PATCH 129/147] target-s390: Implement CONVERT TO LOGICAL, Richard Henderson, 2012/09/27
- [Qemu-devel] [PATCH 130/147] target-s390: Implement CONVERT FROM LOGICAL, Richard Henderson, 2012/09/27
- [Qemu-devel] [PATCH 131/147] target-s390: Implement POPCNT,
Richard Henderson <=
- [Qemu-devel] [PATCH 132/147] target-s390: Implement CPSDR, Richard Henderson, 2012/09/27
- [Qemu-devel] [PATCH 133/147] target-s390: Check insn operand specifications, Richard Henderson, 2012/09/27
- [Qemu-devel] [PATCH 134/147] target-s390: Implement LCDFR, Richard Henderson, 2012/09/27
- [Qemu-devel] [PATCH 135/147] softfloat: Fix uint64_to_float64, Richard Henderson, 2012/09/27
- [Qemu-devel] [PATCH 136/147] softfloat: Implement uint64_to_float128, Richard Henderson, 2012/09/27
- [Qemu-devel] [PATCH 137/147] target-s390: Use uint64_to_float128, Richard Henderson, 2012/09/27
- [Qemu-devel] [PATCH 138/147] target-s390: Implement SET ROUNDING MODE, Richard Henderson, 2012/09/27
- [Qemu-devel] [PATCH 139/147] target-s390: Implement LOAD/SET FP AND SIGNAL, Richard Henderson, 2012/09/27