qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	qemu-devel@nongnu.org
Cc: qemu-arm@nongnu.org, laurent@vivier.eu,
	ysato@users.sourceforge.jp, kbastian@mail.uni-paderborn.de,
	jcmvbkbc@gmail.com
Subject: Re: [PATCH 3/7] target/i386: Use tcg_gen_ext_tl
Date: Sat, 21 Oct 2023 09:59:18 +0200	[thread overview]
Message-ID: <03ba02fd-fade-4409-be16-2f81a5690b4c@redhat.com> (raw)
In-Reply-To: <5f54e3e1-1c90-0249-04f4-df522e292abe@linaro.org>

On 10/19/23 23:57, Philippe Mathieu-Daudé wrote:
> On 19/10/23 20:29, Richard Henderson wrote:
>> -    default:
>> +    if (memop_size(size) == TARGET_LONG_BITS) {
>>           return src;
>>       }

Any opinions about adding something like this on top?

------------------------- 8< -------------------------------
From: Paolo Bonzini <pbonzini@redhat.com>
Subject: [PATCH] include, target/i386: define and use MO_TL

This will also come in handy later for "less than" comparisons.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

diff --git a/include/exec/target_long.h b/include/exec/target_long.h
index 93c9472971f..3cd8e26a23f 100644
--- a/include/exec/target_long.h
+++ b/include/exec/target_long.h
@@ -29,12 +29,14 @@ typedef uint32_t target_ulong;
  #define TARGET_FMT_lx "%08x"
  #define TARGET_FMT_ld "%d"
  #define TARGET_FMT_lu "%u"
+#define MO_TL MO_32
  #elif TARGET_LONG_SIZE == 8
  typedef int64_t target_long;
  typedef uint64_t target_ulong;
  #define TARGET_FMT_lx "%016" PRIx64
  #define TARGET_FMT_ld "%" PRId64
  #define TARGET_FMT_lu "%" PRIu64
+#define MO_TL MO_64
  #else
  #error TARGET_LONG_SIZE undefined
  #endif
diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c
index b0d62e83445..7bf7406dd8e 100644
--- a/target/i386/tcg/translate.c
+++ b/target/i386/tcg/translate.c
@@ -701,7 +701,7 @@ static inline void 
gen_op_movl_T0_Dshift(DisasContext *s, MemOp ot)

  static TCGv gen_ext_tl(TCGv dst, TCGv src, MemOp size, bool sign)
  {
-    if (memop_size(size) == TARGET_LONG_BITS) {
+    if (size == MO_TL) {
          return src;
      }
      tcg_gen_ext_tl(dst, src, size | (sign ? MO_SIGN : 0));
-----------------------------------------------------------

I can add it in my x86 series if desirable (I also have an
occurrence of memop_size(ot) < TARGET_LONG_BITS there, and it
can become just "ot < MO_TL").

>> +    tcg_gen_ext_tl(dst, src, size | (sign ? MO_SIGN : 0));
>> +    return dst;
>>   }
> 
> While here, I'd rename 'size' -> 'mop'. Regardless,

Not sure about that, because "size" should be just the low bits of MemOp 
(the MO_SIGN bit is passed separately).

Paolo



  reply	other threads:[~2023-10-21  8:00 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-19 18:29 [PATCH 0/7] tcg: Expose tcg_gen_ext_{i32,i64,tl} Richard Henderson
2023-10-19 18:29 ` [PATCH 1/7] tcg: Export tcg_gen_ext_{i32,i64,tl} Richard Henderson
2023-10-19 21:50   ` Philippe Mathieu-Daudé
2023-10-19 18:29 ` [PATCH 2/7] target/arm: Use tcg_gen_ext_i64 Richard Henderson
2023-10-23 15:09   ` Philippe Mathieu-Daudé
2023-10-19 18:29 ` [PATCH 3/7] target/i386: Use tcg_gen_ext_tl Richard Henderson
2023-10-19 21:57   ` Philippe Mathieu-Daudé
2023-10-21  7:59     ` Paolo Bonzini [this message]
2023-10-22  1:29       ` Richard Henderson
2023-10-22 10:22         ` Paolo Bonzini
2023-10-19 18:29 ` [PATCH 4/7] target/m68k: Use tcg_gen_ext_i32 Richard Henderson
2023-10-19 21:54   ` Philippe Mathieu-Daudé
2023-10-19 18:29 ` [PATCH 5/7] target/rx: " Richard Henderson
2023-10-19 21:54   ` Philippe Mathieu-Daudé
2023-10-21 13:45   ` Yoshinori Sato
2023-10-19 18:29 ` [PATCH 6/7] target/tricore: Use tcg_gen_*extract_tl Richard Henderson
2023-10-20 12:42   ` Bastian Koppelmann
2023-10-23 15:07   ` Philippe Mathieu-Daudé
2023-10-19 18:29 ` [PATCH 7/7] target/xtensa: Use tcg_gen_sextract_i32 Richard Henderson
2023-10-22  2:25   ` Max Filippov
2023-10-23 15:10   ` Philippe Mathieu-Daudé

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=03ba02fd-fade-4409-be16-2f81a5690b4c@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=jcmvbkbc@gmail.com \
    --cc=kbastian@mail.uni-paderborn.de \
    --cc=laurent@vivier.eu \
    --cc=philmd@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=ysato@users.sourceforge.jp \
    /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).