qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Richard Henderson <richard.henderson@linaro.org>, qemu-devel@nongnu.org
Cc: qemu-ppc@nongnu.org, "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
Subject: Re: [RFC PATCH 8/9] target/cris: Use tcg_gen_sextract_tl
Date: Tue, 24 Oct 2023 10:53:30 +0200	[thread overview]
Message-ID: <1668b930-e79b-d84a-f0c1-b0fca9b3baaa@linaro.org> (raw)
In-Reply-To: <db537981-e8ee-419c-9bc1-d9092ec60deb@linaro.org>

On 24/10/23 02:26, Richard Henderson wrote:
> On 10/23/23 09:09, Philippe Mathieu-Daudé wrote:
>> Inspired-by: Richard Henderson <richard.henderson@linaro.org>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>> RFC: please double-check bits
>> ---
>>   target/cris/translate.c | 3 +--
>>   1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/target/cris/translate.c b/target/cris/translate.c
>> index 65b07e1d80..3a161f8f73 100644
>> --- a/target/cris/translate.c
>> +++ b/target/cris/translate.c
>> @@ -336,8 +336,7 @@ static void t_gen_cris_mstep(TCGv d, TCGv a, TCGv 
>> b, TCGv ccs)
>>        */
>>       t = tcg_temp_new();
>>       tcg_gen_shli_tl(d, a, 1);
>> -    tcg_gen_shli_tl(t, ccs, 31 - 3);
>> -    tcg_gen_sari_tl(t, t, 31);
>> +    tcg_gen_sextract_tl(t, ccs, 3, 1);
> 
> tcg_gen_sextract_tl(t, ccs, ctz32(N_FLAG), 1);
> 
> Also, it appears t_gen_cris_mstep consumes CCS without making sure that 
> it is up-to-date.

Do you mean we first need to call cris_evaluate_flags?

-- >8 --
diff --git a/target/cris/translate.c b/target/cris/translate.c
index 3a161f8f73..5eb68b8a63 100644
--- a/target/cris/translate.c
+++ b/target/cris/translate.c
@@ -177,6 +177,8 @@ static const int preg_sizes[] = {
  #define t_gen_movi_env_TN(member, c) \
      t_gen_mov_env_TN(member, tcg_constant_tl(c))

+static void cris_evaluate_flags(DisasContext *dc);
+
  static inline void t_gen_mov_TN_preg(TCGv tn, int r)
  {
      assert(r >= 0 && r <= 15);
@@ -325,7 +327,7 @@ static void t_gen_cris_dstep(TCGv d, TCGv a, TCGv b)
      tcg_gen_movcond_tl(TCG_COND_GEU, d, d, b, t, d);
  }

-static void t_gen_cris_mstep(TCGv d, TCGv a, TCGv b, TCGv ccs)
+static void t_gen_cris_mstep(DisasContext *dc, TCGv d, TCGv a, TCGv b, 
TCGv ccs)
  {
      TCGv t;

@@ -335,6 +337,7 @@ static void t_gen_cris_mstep(TCGv d, TCGv a, TCGv b, 
TCGv ccs)
       *    d += s;
       */
      t = tcg_temp_new();
+    cris_evaluate_flags(dc);
      tcg_gen_shli_tl(d, a, 1);
      tcg_gen_sextract_tl(t, ccs, 3, 1);
      tcg_gen_and_tl(t, t, b);
@@ -702,7 +705,7 @@ static void cris_alu_op_exec(DisasContext *dc, int op,
          t_gen_cris_dstep(dst, a, b);
          break;
      case CC_OP_MSTEP:
-        t_gen_cris_mstep(dst, a, b, cpu_PR[PR_CCS]);
+        t_gen_cris_mstep(dc, dst, a, b, cpu_PR[PR_CCS]);
          break;
      case CC_OP_BOUND:
          tcg_gen_movcond_tl(TCG_COND_LEU, dst, a, b, a, b);
---



  parent reply	other threads:[~2023-10-24  8:54 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-23 16:09 [PATCH 0/9] tcg: Use tcg_gen_[s]extract_{i32,i64,tl} Philippe Mathieu-Daudé
2023-10-23 16:09 ` [PATCH 1/9] target/avr: Use tcg_gen_extract_tl Philippe Mathieu-Daudé
2023-10-23 23:32   ` Richard Henderson
2023-10-24  7:21     ` Michael Rolnik
2023-10-23 16:09 ` [PATCH 2/9] target/cris: " Philippe Mathieu-Daudé
2023-10-23 23:36   ` Richard Henderson
2023-10-24  8:44     ` Edgar E. Iglesias
2023-10-23 16:09 ` [PATCH 3/9] target/mips: Use tcg_gen_extract_i32 Philippe Mathieu-Daudé
2023-10-23 23:39   ` Richard Henderson
2023-10-23 16:09 ` [PATCH 4/9] target/ppc: " Philippe Mathieu-Daudé
2023-10-23 23:40   ` Richard Henderson
2023-10-23 16:09 ` [PATCH 5/9] target/sparc: Use tcg_gen_extract_tl Philippe Mathieu-Daudé
2023-10-23 23:41   ` Richard Henderson
2023-10-23 16:09 ` [PATCH 6/9] target/xtensa: Use tcg_gen_extract_i32 Philippe Mathieu-Daudé
2023-10-23 17:56   ` Max Filippov
2023-10-23 16:09 ` [PATCH 7/9] target/mips: Use tcg_gen_sextract_tl Philippe Mathieu-Daudé
2023-10-24  0:14   ` Richard Henderson
2023-10-24  8:57     ` Philippe Mathieu-Daudé
2023-10-24 16:55       ` Philippe Mathieu-Daudé
2023-10-23 16:09 ` [RFC PATCH 8/9] target/cris: " Philippe Mathieu-Daudé
2023-10-24  0:26   ` Richard Henderson
2023-10-24  8:42     ` Edgar E. Iglesias
2023-10-24  8:53     ` Philippe Mathieu-Daudé [this message]
2023-10-24  8:58       ` Philippe Mathieu-Daudé
2023-10-23 16:09 ` [RFC PATCH 9/9] target/ppc: " Philippe Mathieu-Daudé
2023-10-24  1:04   ` Richard Henderson
2023-10-25  7:09     ` Nicholas Piggin
2023-10-25  7:33       ` Philippe Mathieu-Daudé
2023-10-25 20:26         ` Richard Henderson
2023-10-25  7:38       ` 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=1668b930-e79b-d84a-f0c1-b0fca9b3baaa@linaro.org \
    --to=philmd@linaro.org \
    --cc=edgar.iglesias@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@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).