[PATCH 2/3] target/nios2: Use DisasContext::zero constant instead of temporary

Philippe Mathieu-Daudé posted 3 patches 4 years, 4 months ago
[PATCH 2/3] target/nios2: Use DisasContext::zero constant instead of temporary
Posted by Philippe Mathieu-Daudé 4 years, 4 months ago
We already have a register holding the zero value in the constant
pool, use it instead of a temporary.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 target/nios2/translate.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/target/nios2/translate.c b/target/nios2/translate.c
index c398c5320fb..8524a2f6dd8 100644
--- a/target/nios2/translate.c
+++ b/target/nios2/translate.c
@@ -613,17 +613,15 @@ static void divu(DisasContext *dc, uint32_t code, uint32_t flags)
 
     TCGv t0 = tcg_temp_new();
     TCGv t1 = tcg_temp_new();
-    TCGv t2 = tcg_const_tl(0);
     TCGv t3 = tcg_const_tl(1);
 
     tcg_gen_ext32u_tl(t0, load_gpr(dc, instr.a));
     tcg_gen_ext32u_tl(t1, load_gpr(dc, instr.b));
-    tcg_gen_movcond_tl(TCG_COND_EQ, t1, t1, t2, t3, t1);
+    tcg_gen_movcond_tl(TCG_COND_EQ, t1, t1, dc->zero, t3, t1);
     tcg_gen_divu_tl(cpu_R[instr.c], t0, t1);
     tcg_gen_ext32s_tl(cpu_R[instr.c], cpu_R[instr.c]);
 
     tcg_temp_free(t3);
-    tcg_temp_free(t2);
     tcg_temp_free(t1);
     tcg_temp_free(t0);
 }
-- 
2.31.1

Re: [PATCH 2/3] target/nios2: Use DisasContext::zero constant instead of temporary
Posted by Richard Henderson 4 years, 4 months ago
On 10/2/21 7:30 PM, Philippe Mathieu-Daudé wrote:
> We already have a register holding the zero value in the constant
> pool, use it instead of a temporary.
> 
> Signed-off-by: Philippe Mathieu-Daudé<f4bug@amsat.org>
> ---
>   target/nios2/translate.c | 4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~