From patchwork Fri Oct 19 13:06:59 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 12372 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 DFDF823F58 for ; Fri, 19 Oct 2012 13:07:08 +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 89ECEA18C30 for ; Fri, 19 Oct 2012 13:07:08 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id e10so529001iej.11 for ; Fri, 19 Oct 2012 06:07:08 -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=cXL84rR9y/6l5zVXiERI5sq0R7PcCO4S2SOPaaejjQ8=; b=YhL4tzuslZk+duyHffssLdRFg0TMD9JbmgQT0wzKmE3/MHc5sQd+TlKov1L3e/S/i8 kv/i2vwwaaZjkPCb5YLMhSBnr0dcxdh92Oi2iKT+wODb+P3erw7dn/KImi2QBpgYjK6m Xt4RwpHQD8cwX9AdvQ6nvQbmzRGZpduTG+EKr6Gl24ELio93mnJgAqXXQgCsPpWmaAxy lDrZxqzjFJMtt5Uok16x2NEmVDLO4n7f0oL3DBEB5sCzCo0ngamhfKceqeddX5wsBoIR 7UgUK6AUqDDmnUAw3hofJEsQzt88B7kJva2Fzx5aGWgSZP+gAdyV/wi4UP6LRUsr/bzr csKw== Received: by 10.42.57.10 with SMTP id b10mr934524ich.54.1350652027964; Fri, 19 Oct 2012 06:07:07 -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 n20csp83103igt; Fri, 19 Oct 2012 06:07:06 -0700 (PDT) Received: by 10.180.82.35 with SMTP id f3mr3190348wiy.6.1350652026192; Fri, 19 Oct 2012 06:07:06 -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 q10si1801300weo.25.2012.10.19.06.07.05 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 19 Oct 2012 06:07:06 -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 1TPCHz-0006kz-Fj; Fri, 19 Oct 2012 14:06:59 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org Subject: [PATCH v2 2/2] target-arm: Implement abs_i32 inline rather than as a helper Date: Fri, 19 Oct 2012 14:06:59 +0100 Message-Id: <1350652019-25946-3-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1350652019-25946-1-git-send-email-peter.maydell@linaro.org> References: <1350652019-25946-1-git-send-email-peter.maydell@linaro.org> X-Gm-Message-State: ALoCoQlIkGXi5J8xip+2WiFUX2HXO9jP/5h5HSLHjODbIow227sZ6DYkZxXA8ug8Z8Y20zUbpxat Implement abs_i32 inline (with movcond) rather than using a helper function. Signed-off-by: Peter Maydell Reviewed-by: Aurelien Jarno --- target-arm/helper.c | 5 ----- target-arm/helper.h | 1 - target-arm/translate.c | 11 +++++++++-- 3 files changed, 9 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..25433da 100644 --- a/target-arm/translate.c +++ b/target-arm/translate.c @@ -462,8 +462,15 @@ 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); + TCGv tmp = tcg_temp_new_i32(); + tcg_gen_neg_i32(tmp, src); + tcg_gen_movcond_i32(TCG_COND_GT, dest, src, c0, src, tmp); + tcg_temp_free_i32(c0); + tcg_temp_free_i32(tmp); +} static void shifter_out_im(TCGv var, int shift) {