From patchwork Thu Oct 18 17:26:44 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 12357 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 91DF4241AE for ; Thu, 18 Oct 2012 17:26:49 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id 31BE9A186E8 for ; Thu, 18 Oct 2012 17:26:49 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id e10so13647690iej.11 for ; Thu, 18 Oct 2012 10:26:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=fWVjBM/gZAVPJLCKO5Hwe9y3Q8jnUvGFSzlDpAXoCmE=; b=Hc8ce3USjRC+9SDK996T2ZgChKODhT82VPqzXXM8TfxFzXbWxyWwcxJzI/AXharVB0 jzuKBhOdWIor9UxTXz5keL4MUcJGeDvnG+T4oPvfRtUhH7oh3XboPjwP7kv/qvayuwEm KxTiE6Di4O7YTx5yRvhkkG80gIOkXzpS7COfftbMMyOKX/VU+CgyGaRChf/RezOS7S36 ncx1vnfBO7ij6W2aInw03q48PLVLJLc4c0GvQoxr7dCaZgbJUyu6DOhydjcy0F1fbCuP 7cM98R5gVc5AwGsW4qwJia3rEhMa4QTtgL2bNOLq4xp03Cvai6zXjX28eDB1h7fhjo4c 5fHw== Received: by 10.42.57.10 with SMTP id b10mr4150813ich.54.1350581208660; Thu, 18 Oct 2012 10:26:48 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.67.148 with SMTP id n20csp1111563igt; Thu, 18 Oct 2012 10:26:47 -0700 (PDT) Received: by 10.205.135.20 with SMTP id ie20mr6757968bkc.16.1350581206721; Thu, 18 Oct 2012 10:26:46 -0700 (PDT) Received: from mnementh.archaic.org.uk (1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.d.1.0.0.b.8.0.1.0.0.2.ip6.arpa. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id c9si25121246bkw.82.2012.10.18.10.26.46 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 18 Oct 2012 10:26:46 -0700 (PDT) Received-SPF: neutral (google.com: 2001:8b0:1d0::1 is neither permitted nor denied by best guess record for domain of pm215@archaic.org.uk) client-ip=2001:8b0:1d0::1; Authentication-Results: mx.google.com; spf=neutral (google.com: 2001:8b0:1d0::1 is neither permitted nor denied by best guess record for domain of pm215@archaic.org.uk) smtp.mail=pm215@archaic.org.uk Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1TOtro-0006Mx-Iq; Thu, 18 Oct 2012 18:26:44 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org Subject: [PATCH 2/2] target-arm: Implement abs_i32 inline rather than as a helper Date: Thu, 18 Oct 2012 18:26:44 +0100 Message-Id: <1350581204-24456-3-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1350581204-24456-1-git-send-email-peter.maydell@linaro.org> References: <1350581204-24456-1-git-send-email-peter.maydell@linaro.org> X-Gm-Message-State: ALoCoQndo/YisfEkKudlFizDa35K3tXzr8JvprDjaghV9KIcr9eiyhuSZ1fed+c4cFaYgSjEm1OZ Implement abs_i32 inline (with movcond) rather than using a helper function. Signed-off-by: Peter Maydell --- target-arm/helper.c | 5 ----- target-arm/helper.h | 1 - target-arm/translate.c | 10 ++++++++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/target-arm/helper.c b/target-arm/helper.c index 58340bd..0601760 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -1562,11 +1562,6 @@ uint32_t HELPER(rbit)(uint32_t x) return x; } -uint32_t HELPER(abs)(uint32_t x) -{ - return ((int32_t)x < 0) ? -x : x; -} - #if defined(CONFIG_USER_ONLY) void do_interrupt (CPUARMState *env) diff --git a/target-arm/helper.h b/target-arm/helper.h index fa3472f..60812de 100644 --- a/target-arm/helper.h +++ b/target-arm/helper.h @@ -13,7 +13,6 @@ DEF_HELPER_2(double_saturate, i32, env, s32) DEF_HELPER_FLAGS_2(sdiv, TCG_CALL_CONST | TCG_CALL_PURE, s32, s32, s32) DEF_HELPER_FLAGS_2(udiv, TCG_CALL_CONST | TCG_CALL_PURE, i32, i32, i32) DEF_HELPER_FLAGS_1(rbit, TCG_CALL_CONST | TCG_CALL_PURE, i32, i32) -DEF_HELPER_FLAGS_1(abs, TCG_CALL_CONST | TCG_CALL_PURE, i32, i32) #define PAS_OP(pfx) \ DEF_HELPER_3(pfx ## add8, i32, i32, i32, ptr) \ diff --git a/target-arm/translate.c b/target-arm/translate.c index d33f94c..5a7602a 100644 --- a/target-arm/translate.c +++ b/target-arm/translate.c @@ -462,8 +462,14 @@ static void gen_sar(TCGv dest, TCGv t0, TCGv t1) tcg_temp_free_i32(tmp1); } -/* FIXME: Implement this natively. */ -#define tcg_gen_abs_i32(t0, t1) gen_helper_abs(t0, t1) +static void tcg_gen_abs_i32(TCGv dest, TCGv src) +{ + TCGv c0 = tcg_const_i32(0); + printf("tcg_gen_abs_i32\n"); + tcg_gen_neg_i32(dest, src); + tcg_gen_movcond_i32(TCG_COND_GT, dest, src, c0, src, dest); + tcg_temp_free_i32(c0); +} static void shifter_out_im(TCGv var, int shift) {