From patchwork Wed Feb 20 07:52:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 222017 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id DEAF42C0086 for ; Wed, 20 Feb 2013 20:26:33 +1100 (EST) Received: from localhost ([::1]:53403 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U85we-0006NY-1I for incoming@patchwork.ozlabs.org; Wed, 20 Feb 2013 04:26:32 -0500 Received: from eggs.gnu.org ([208.118.235.92]:43939) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U84UY-0001ml-MA for qemu-devel@nongnu.org; Wed, 20 Feb 2013 02:53:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U84UV-0002Iz-GQ for qemu-devel@nongnu.org; Wed, 20 Feb 2013 02:53:26 -0500 Received: from mail-pa0-f53.google.com ([209.85.220.53]:52718) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U84UV-0002Ib-9u for qemu-devel@nongnu.org; Wed, 20 Feb 2013 02:53:23 -0500 Received: by mail-pa0-f53.google.com with SMTP id bg4so3852497pad.12 for ; Tue, 19 Feb 2013 23:53:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references; bh=cQMATeRIIZEinyxze8QJCz+tW1U6Bq1F78X4omwhEXY=; b=gFQEDAQBuRSTn7MAD9NyjAL8ChZCsS3H38xAQG6MjfggF8Iq6vPfYbzPcepfRfA4Yf KU+USY90DBHk2w5hUk3pUfpsUwbg9rdh09+iaFTK6yCCE0PNcbwNRBudWf1yVKgD2aN8 WsTWbizaXX96Wxjp09AE9XzGsUsCDfw9wdeZOSxkuAphZa7pk4rHrHIYx8wQ1zVYNeH4 V4e6EAH79L6r6LTUiaoLvQ8/smh+5bvDFO+uPsYH7NFavjDaE4B7UVlvEVEVpSgStJD1 jcandGZ9snm1NlFpHS6lwZ+Vmczds1x+rm2mveJlMNjbVXNofX7yrAFLrbuQ1RrG2zAk fF+A== X-Received: by 10.68.129.229 with SMTP id nz5mr1068834pbb.193.1361346802407; Tue, 19 Feb 2013 23:53:22 -0800 (PST) Received: from anchor.twiddle.net (50-194-63-110-static.hfc.comcastbusiness.net. [50.194.63.110]) by mx.google.com with ESMTPS id c8sm20826347pbq.10.2013.02.19.23.53.20 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 19 Feb 2013 23:53:21 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 19 Feb 2013 23:52:15 -0800 Message-Id: <1361346746-8511-28-git-send-email-rth@twiddle.net> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1361346746-8511-1-git-send-email-rth@twiddle.net> References: <1361346746-8511-1-git-send-email-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.220.53 Cc: blauwirbel@gmail.com, Alexander Graf , aurelien@aurel32.net Subject: [Qemu-devel] [PATCH 27/38] target-ppc: Compute addition overflow without branches 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 Cc: Alexander Graf Signed-off-by: Richard Henderson --- target-ppc/translate.c | 46 +++++++++++++--------------------------------- 1 file changed, 13 insertions(+), 33 deletions(-) diff --git a/target-ppc/translate.c b/target-ppc/translate.c index 7aab6ae..116cf12 100644 --- a/target-ppc/translate.c +++ b/target-ppc/translate.c @@ -746,35 +746,23 @@ static void gen_isel(DisasContext *ctx) static inline void gen_op_arith_compute_ov(DisasContext *ctx, TCGv arg0, TCGv arg1, TCGv arg2, int sub) { - int l1; - TCGv t0; + TCGv t0 = tcg_temp_new(); - l1 = gen_new_label(); - /* Start with XER OV disabled, the most likely case */ - tcg_gen_movi_tl(cpu_ov, 0); - t0 = tcg_temp_local_new(); - tcg_gen_xor_tl(t0, arg0, arg1); -#if defined(TARGET_PPC64) - if (!ctx->sf_mode) - tcg_gen_ext32s_tl(t0, t0); -#endif - if (sub) - tcg_gen_brcondi_tl(TCG_COND_LT, t0, 0, l1); - else - tcg_gen_brcondi_tl(TCG_COND_GE, t0, 0, l1); + tcg_gen_xor_tl(cpu_ov, arg0, arg1); tcg_gen_xor_tl(t0, arg1, arg2); + if (sub) { + tcg_gen_and_tl(cpu_ov, cpu_ov, t0); + } else { + tcg_gen_andc_tl(cpu_ov, cpu_ov, t0); + } + tcg_temp_free(t0); #if defined(TARGET_PPC64) - if (!ctx->sf_mode) - tcg_gen_ext32s_tl(t0, t0); + if (!ctx->sf_mode) { + tcg_gen_ext32s_tl(cpu_ov, cpu_ov); + } #endif - if (sub) - tcg_gen_brcondi_tl(TCG_COND_GE, t0, 0, l1); - else - tcg_gen_brcondi_tl(TCG_COND_LT, t0, 0, l1); - tcg_gen_movi_tl(cpu_ov, 1); - tcg_gen_movi_tl(cpu_so, 1); - gen_set_label(l1); - tcg_temp_free(t0); + tcg_gen_shri_tl(cpu_ov, cpu_ov, TARGET_LONG_BITS - 1); + tcg_gen_or_tl(cpu_so, cpu_so, cpu_ov); } static inline void gen_op_arith_compute_ca(DisasContext *ctx, TCGv arg1, @@ -837,10 +825,6 @@ static inline void gen_op_arith_add(DisasContext *ctx, TCGv ret, TCGv arg1, /* Start with XER CA disabled, the most likely case */ tcg_gen_movi_tl(cpu_ca, 0); } - if (compute_ov) { - /* Start with XER OV disabled, the most likely case */ - tcg_gen_movi_tl(cpu_ov, 0); - } tcg_gen_add_tl(t0, arg1, arg2); @@ -1261,10 +1245,6 @@ static inline void gen_op_arith_subf(DisasContext *ctx, TCGv ret, TCGv arg1, /* Start with XER CA disabled, the most likely case */ tcg_gen_movi_tl(cpu_ca, 0); } - if (compute_ov) { - /* Start with XER OV disabled, the most likely case */ - tcg_gen_movi_tl(cpu_ov, 0); - } if (add_ca) { tcg_gen_not_tl(t0, arg1);