From patchwork Thu Sep 4 17:20:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 385972 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 36856140111 for ; Fri, 5 Sep 2014 03:50:14 +1000 (EST) Received: from localhost ([::1]:53151 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPbAi-0005uj-C1 for incoming@patchwork.ozlabs.org; Thu, 04 Sep 2014 13:50:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39876) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPaiW-0004PH-Io for qemu-devel@nongnu.org; Thu, 04 Sep 2014 13:21:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XPaiF-0005pY-TZ for qemu-devel@nongnu.org; Thu, 04 Sep 2014 13:21:04 -0400 Received: from cantor2.suse.de ([195.135.220.15]:43977 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPaiF-0005nw-Cf; Thu, 04 Sep 2014 13:20:47 -0400 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 552BFAD9F; Thu, 4 Sep 2014 17:20:46 +0000 (UTC) From: Alexander Graf To: qemu-ppc@nongnu.org Date: Thu, 4 Sep 2014 19:20:37 +0200 Message-Id: <1409851240-48126-50-git-send-email-agraf@suse.de> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1409851240-48126-1-git-send-email-agraf@suse.de> References: <1409851240-48126-1-git-send-email-agraf@suse.de> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 195.135.220.15 Cc: peter.maydell@linaro.org, qemu-devel@nongnu.org, Tom Musta Subject: [Qemu-devel] [PULL 49/52] target-ppc: Implement mulldo with TCG X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Tom Musta Optimize mulldo by using the muls2_i64 operation rather than a helper. Eliminate the obsolete helper code. Signed-off-by: Tom Musta Suggested-by: Richard Henderson Reviewed-by: Richard Henderson Signed-off-by: Alexander Graf --- target-ppc/helper.h | 1 - target-ppc/int_helper.c | 27 --------------------------- target-ppc/translate.c | 16 ++++++++++++++-- 3 files changed, 14 insertions(+), 30 deletions(-) diff --git a/target-ppc/helper.h b/target-ppc/helper.h index 509eae5..0cfdc8a 100644 --- a/target-ppc/helper.h +++ b/target-ppc/helper.h @@ -28,7 +28,6 @@ DEF_HELPER_2(icbi, void, env, tl) DEF_HELPER_5(lscbx, tl, env, tl, i32, i32, i32) #if defined(TARGET_PPC64) -DEF_HELPER_3(mulldo, i64, env, i64, i64) DEF_HELPER_4(divdeu, i64, env, i64, i64, i32) DEF_HELPER_4(divde, i64, env, i64, i64, i32) #endif diff --git a/target-ppc/int_helper.c b/target-ppc/int_helper.c index e5b103b..713d777 100644 --- a/target-ppc/int_helper.c +++ b/target-ppc/int_helper.c @@ -24,33 +24,6 @@ #include "helper_regs.h" /*****************************************************************************/ /* Fixed point operations helpers */ -#if defined(TARGET_PPC64) - -uint64_t helper_mulldo(CPUPPCState *env, uint64_t arg1, uint64_t arg2) -{ - int64_t th; - uint64_t tl; - - muls64(&tl, (uint64_t *)&th, arg1, arg2); - - /* th should either contain all 1 bits or all 0 bits and should - * match the sign bit of tl; otherwise we have overflowed. */ - - if ((int64_t)tl < 0) { - if (likely(th == -1LL)) { - env->ov = 0; - } else { - env->so = env->ov = 1; - } - } else if (likely(th == 0LL)) { - env->ov = 0; - } else { - env->so = env->ov = 1; - } - - return (int64_t)tl; -} -#endif target_ulong helper_divweu(CPUPPCState *env, target_ulong ra, target_ulong rb, uint32_t oe) diff --git a/target-ppc/translate.c b/target-ppc/translate.c index 1062634..d03daea 100644 --- a/target-ppc/translate.c +++ b/target-ppc/translate.c @@ -1215,8 +1215,20 @@ static void gen_mulld(DisasContext *ctx) /* mulldo mulldo. */ static void gen_mulldo(DisasContext *ctx) { - gen_helper_mulldo(cpu_gpr[rD(ctx->opcode)], cpu_env, - cpu_gpr[rA(ctx->opcode)], cpu_gpr[rB(ctx->opcode)]); + TCGv_i64 t0 = tcg_temp_new_i64(); + TCGv_i64 t1 = tcg_temp_new_i64(); + + tcg_gen_muls2_i64(t0, t1, cpu_gpr[rA(ctx->opcode)], + cpu_gpr[rB(ctx->opcode)]); + tcg_gen_mov_i64(cpu_gpr[rD(ctx->opcode)], t0); + + tcg_gen_sari_i64(t0, t0, 63); + tcg_gen_setcond_i64(TCG_COND_NE, cpu_ov, t0, t1); + tcg_gen_or_tl(cpu_so, cpu_so, cpu_ov); + + tcg_temp_free_i64(t0); + tcg_temp_free_i64(t1); + if (unlikely(Rc(ctx->opcode) != 0)) { gen_set_Rc0(ctx, cpu_gpr[rD(ctx->opcode)]); }