From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:55034) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOtrs-0002O6-Ct for qemu-devel@nongnu.org; Thu, 18 Oct 2012 13:26:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TOtrr-0002Zx-Ba for qemu-devel@nongnu.org; Thu, 18 Oct 2012 13:26:48 -0400 Received: from 38.0.169.217.in-addr.arpa ([217.169.0.38]:32886 helo=mnementh.archaic.org.uk) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOtrr-0002ZW-0X for qemu-devel@nongnu.org; Thu, 18 Oct 2012 13:26:47 -0400 From: Peter Maydell Date: Thu, 18 Oct 2012 18:26:44 +0100 Message-Id: <1350581204-24456-3-git-send-email-peter.maydell@linaro.org> In-Reply-To: <1350581204-24456-1-git-send-email-peter.maydell@linaro.org> References: <1350581204-24456-1-git-send-email-peter.maydell@linaro.org> Subject: [Qemu-devel] [PATCH 2/2] target-arm: Implement abs_i32 inline rather than as a helper List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: patches@linaro.org 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) { -- 1.7.9.5