qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: qemu-devel@nongnu.org
Cc: "Marek Vasut" <marex@denx.de>, "Chris Wulff" <crwulff@gmail.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>
Subject: [PATCH 2/3] target/nios2: Use DisasContext::zero constant instead of temporary
Date: Sun,  3 Oct 2021 01:30:53 +0200	[thread overview]
Message-ID: <20211002233054.3575646-3-f4bug@amsat.org> (raw)
In-Reply-To: <20211002233054.3575646-1-f4bug@amsat.org>

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



  parent reply	other threads:[~2021-10-02 23:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-02 23:30 [PATCH 0/3] target/nios2: Use tcg_constant_* Philippe Mathieu-Daudé
2021-10-02 23:30 ` [PATCH 1/3] target/nios2: Replace load_zero() by zero constant in DisasContext Philippe Mathieu-Daudé
2021-10-03 13:49   ` Richard Henderson
2021-10-02 23:30 ` Philippe Mathieu-Daudé [this message]
2021-10-03 13:50   ` [PATCH 2/3] target/nios2: Use DisasContext::zero constant instead of temporary Richard Henderson
2021-10-02 23:30 ` [PATCH 3/3] target/nios2: Use tcg_constant_* Philippe Mathieu-Daudé
2021-10-02 23:36   ` Philippe Mathieu-Daudé
2021-10-03 13:52   ` Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211002233054.3575646-3-f4bug@amsat.org \
    --to=f4bug@amsat.org \
    --cc=crwulff@gmail.com \
    --cc=marex@denx.de \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).