diff mbox

[for-2.5,11/30] m68k: improve clr/moveq

Message ID 1439151229-27747-12-git-send-email-laurent@vivier.eu
State New
Headers show

Commit Message

Laurent Vivier Aug. 9, 2015, 8:13 p.m. UTC
Generate the TCG constant and use it twice, instead
of generating the TCG constant twice to use it twice.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 target-m68k/translate.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

Comments

Richard Henderson Aug. 12, 2015, 5:20 a.m. UTC | #1
On 08/09/2015 01:13 PM, Laurent Vivier wrote:
> Generate the TCG constant and use it twice, instead
> of generating the TCG constant twice to use it twice.
>
> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
> ---
>   target-m68k/translate.c | 15 +++++++++------
>   1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/target-m68k/translate.c b/target-m68k/translate.c
> index 359c761..8a3d315 100644
> --- a/target-m68k/translate.c
> +++ b/target-m68k/translate.c
> @@ -1431,10 +1431,13 @@ DISAS_INSN(lea)
>   DISAS_INSN(clr)
>   {
>       int opsize;
> +    TCGv zero;
> +
> +    zero = tcg_const_i32(0);

Ideally, on one line.  And it still needs to be freed.

>   DISAS_INSN(moveq)
>   {
> -    uint32_t val;
> +    TCGv val;
>
> +    val = tcg_const_i32((int8_t)insn);

Likewise.


r~
diff mbox

Patch

diff --git a/target-m68k/translate.c b/target-m68k/translate.c
index 359c761..8a3d315 100644
--- a/target-m68k/translate.c
+++ b/target-m68k/translate.c
@@ -1431,10 +1431,13 @@  DISAS_INSN(lea)
 DISAS_INSN(clr)
 {
     int opsize;
+    TCGv zero;
+
+    zero = tcg_const_i32(0);
 
     opsize = insn_opsize(insn, 6);
-    DEST_EA(env, insn, opsize, tcg_const_i32(0), NULL);
-    gen_logic_cc(s, tcg_const_i32(0), opsize);
+    DEST_EA(env, insn, opsize, zero, NULL);
+    gen_logic_cc(s, zero, opsize);
 }
 
 static TCGv gen_get_ccr(DisasContext *s)
@@ -1776,11 +1779,11 @@  DISAS_INSN(branch)
 
 DISAS_INSN(moveq)
 {
-    uint32_t val;
+    TCGv val;
 
-    val = (int8_t)insn;
-    tcg_gen_movi_i32(DREG(insn, 9), val);
-    gen_logic_cc(s, tcg_const_i32(val), OS_LONG);
+    val = tcg_const_i32((int8_t)insn);
+    tcg_gen_mov_i32(DREG(insn, 9), val);
+    gen_logic_cc(s, val, OS_LONG);
 }
 
 DISAS_INSN(mvzs)