diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2012-10-18 17:40:41 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2012-10-24 13:33:29 +0100 |
commit | 36c91fd115a5920a35d4cb0e7a1903281469e0db (patch) | |
tree | c1aa6a8733cdc9bb065aaead04d5f6044e25ee21 /target-arm/translate.c | |
parent | ee6fa5593ebfc437cbedaf28de8b66b2e7d44e70 (diff) |
target-arm: Implement abs_i32 inline rather than as a helper
Implement abs_i32 inline (with movcond) rather than using a helper
function.
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'target-arm/translate.c')
-rw-r--r-- | target-arm/translate.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/target-arm/translate.c b/target-arm/translate.c index d33f94c0fd..25433da037 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) { |