diff mbox series

[25/38] target/xtensa: Use tcg_gen_abs_i32

Message ID 20190420073442.7488-26-richard.henderson@linaro.org
State Superseded
Headers show
Series tcg vector improvements | expand

Commit Message

Richard Henderson April 20, 2019, 7:34 a.m. UTC
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

---
 target/xtensa/translate.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

-- 
2.17.1

Comments

Philippe Mathieu-Daudé April 23, 2019, 10:14 p.m. UTC | #1
On 4/20/19 9:34 AM, Richard Henderson wrote:
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

> ---

>  target/xtensa/translate.c | 9 +--------

>  1 file changed, 1 insertion(+), 8 deletions(-)

> 

> diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c

> index 65561d2c49..62be8a6f6a 100644

> --- a/target/xtensa/translate.c

> +++ b/target/xtensa/translate.c

> @@ -1707,14 +1707,7 @@ void restore_state_to_opc(CPUXtensaState *env, TranslationBlock *tb,

>  static void translate_abs(DisasContext *dc, const OpcodeArg arg[],

>                            const uint32_t par[])

>  {

> -    TCGv_i32 zero = tcg_const_i32(0);

> -    TCGv_i32 neg = tcg_temp_new_i32();

> -

> -    tcg_gen_neg_i32(neg, arg[1].in);

> -    tcg_gen_movcond_i32(TCG_COND_GE, arg[0].out,

> -                        arg[1].in, zero, arg[1].in, neg);

> -    tcg_temp_free(neg);

> -    tcg_temp_free(zero);

> +    tcg_gen_abs_i32(arg[0].out, arg[1].in);

>  }

>  

>  static void translate_add(DisasContext *dc, const OpcodeArg arg[],

> 


Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
diff mbox series

Patch

diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c
index 65561d2c49..62be8a6f6a 100644
--- a/target/xtensa/translate.c
+++ b/target/xtensa/translate.c
@@ -1707,14 +1707,7 @@  void restore_state_to_opc(CPUXtensaState *env, TranslationBlock *tb,
 static void translate_abs(DisasContext *dc, const OpcodeArg arg[],
                           const uint32_t par[])
 {
-    TCGv_i32 zero = tcg_const_i32(0);
-    TCGv_i32 neg = tcg_temp_new_i32();
-
-    tcg_gen_neg_i32(neg, arg[1].in);
-    tcg_gen_movcond_i32(TCG_COND_GE, arg[0].out,
-                        arg[1].in, zero, arg[1].in, neg);
-    tcg_temp_free(neg);
-    tcg_temp_free(zero);
+    tcg_gen_abs_i32(arg[0].out, arg[1].in);
 }
 
 static void translate_add(DisasContext *dc, const OpcodeArg arg[],