From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51646) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQsYv-0002YF-LL for qemu-devel@nongnu.org; Sat, 23 Jul 2016 04:45:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bQsYu-0007J0-C7 for qemu-devel@nongnu.org; Sat, 23 Jul 2016 04:45:33 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:42149) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQsYt-0007Ia-TG for qemu-devel@nongnu.org; Sat, 23 Jul 2016 04:45:32 -0400 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u6N8hiov050864 for ; Sat, 23 Jul 2016 04:45:31 -0400 Received: from e23smtp02.au.ibm.com (e23smtp02.au.ibm.com [202.81.31.144]) by mx0a-001b2d01.pphosted.com with ESMTP id 24c2wbu599-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Sat, 23 Jul 2016 04:45:30 -0400 Received: from localhost by e23smtp02.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sat, 23 Jul 2016 18:45:28 +1000 From: Nikunj A Dadhania Date: Sat, 23 Jul 2016 14:14:44 +0530 In-Reply-To: <1469263490-19130-1-git-send-email-nikunj@linux.vnet.ibm.com> References: <1469263490-19130-1-git-send-email-nikunj@linux.vnet.ibm.com> Message-Id: <1469263490-19130-8-git-send-email-nikunj@linux.vnet.ibm.com> Subject: [Qemu-devel] [RFC v2 07/13] target-ppc: add cnttzd[.] instruction List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au, rth@twiddle.net Cc: qemu-devel@nongnu.org, nikunj@linux.vnet.ibm.com, bharata@linux.vnet.ibm.com, aneesh.kumar@linux.vnet.ibm.com, Sandipan Das From: Sandipan Das Add ISA3.0 Count trailing zeros double word Signed-off-by: Sandipan Das [ added ISA300 flag ] Signed-off-by: Nikunj A Dadhania --- target-ppc/helper.h | 1 + target-ppc/int_helper.c | 5 +++++ target-ppc/translate.c | 10 ++++++++++ 3 files changed, 16 insertions(+) diff --git a/target-ppc/helper.h b/target-ppc/helper.h index 26a0930..8a3eb5d 100644 --- a/target-ppc/helper.h +++ b/target-ppc/helper.h @@ -48,6 +48,7 @@ DEF_HELPER_3(sraw, tl, env, tl, tl) DEF_HELPER_FLAGS_2(modsd, TCG_CALL_NO_RWG_SE, i64, i64, i64) DEF_HELPER_FLAGS_2(modud, TCG_CALL_NO_RWG_SE, i64, i64, i64) DEF_HELPER_FLAGS_1(cntlzd, TCG_CALL_NO_RWG_SE, tl, tl) +DEF_HELPER_FLAGS_1(cnttzd, TCG_CALL_NO_RWG_SE, tl, tl) DEF_HELPER_FLAGS_1(popcntd, TCG_CALL_NO_RWG_SE, tl, tl) DEF_HELPER_FLAGS_2(bpermd, TCG_CALL_NO_RWG_SE, i64, i64, i64) DEF_HELPER_3(srad, tl, env, tl, tl) diff --git a/target-ppc/int_helper.c b/target-ppc/int_helper.c index e95572b..1d02e8a 100644 --- a/target-ppc/int_helper.c +++ b/target-ppc/int_helper.c @@ -181,6 +181,11 @@ target_ulong helper_cntlzd(target_ulong t) { return clz64(t); } + +target_ulong helper_cnttzd(target_ulong t) +{ + return ctz64(t); +} #endif #if defined(TARGET_PPC64) diff --git a/target-ppc/translate.c b/target-ppc/translate.c index 38a117c..1fc1922 100644 --- a/target-ppc/translate.c +++ b/target-ppc/translate.c @@ -1760,6 +1760,15 @@ static void gen_cntlzd(DisasContext *ctx) if (unlikely(Rc(ctx->opcode) != 0)) gen_set_Rc0(ctx, cpu_gpr[rA(ctx->opcode)]); } + +/* cnttzd */ +static void gen_cnttzd(DisasContext *ctx) +{ + gen_helper_cnttzd(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rS(ctx->opcode)]); + if (unlikely(Rc(ctx->opcode) != 0)) { + gen_set_Rc0(ctx, cpu_gpr[rA(ctx->opcode)]); + } +} #endif /*** Integer rotate ***/ @@ -9997,6 +10006,7 @@ GEN_HANDLER_E(prtyw, 0x1F, 0x1A, 0x04, 0x0000F801, PPC_NONE, PPC2_ISA205), #if defined(TARGET_PPC64) GEN_HANDLER(popcntd, 0x1F, 0x1A, 0x0F, 0x0000F801, PPC_POPCNTWD), GEN_HANDLER(cntlzd, 0x1F, 0x1A, 0x01, 0x00000000, PPC_64B), +GEN_HANDLER_E(cnttzd, 0x1F, 0x1A, 0x11, 0x00000000, PPC_NONE, PPC2_ISA300), GEN_HANDLER_E(prtyd, 0x1F, 0x1A, 0x05, 0x0000F801, PPC_NONE, PPC2_ISA205), GEN_HANDLER_E(bpermd, 0x1F, 0x1C, 0x07, 0x00000001, PPC_NONE, PPC2_PERM_ISA206), #endif -- 2.7.4