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
Subject: Re: [PATCH 05/11] tcg: Move 64-bit expanders out of line
Date: Wed, 13 Dec 2023 15:46:34 +0100	[thread overview]
Message-ID: <93330946-8847-4a7f-b04e-7f7da60298b1@linaro.org> (raw)
In-Reply-To: <20231029210848.78234-6-richard.henderson@linaro.org>

On 29/10/23 22:08, Richard Henderson wrote:
> This one is more complicated, combining 32-bit and 64-bit
> expansion with C if instead of preprocessor #if.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   include/tcg/tcg-op-common.h | 144 +---------------------
>   tcg/tcg-op.c                | 231 +++++++++++++++++++++++++-----------
>   2 files changed, 169 insertions(+), 206 deletions(-)

Easier for me to review changing first:

-- >8 --
diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c
index a8cbad212d..4f3d0b6cec 100644
--- a/tcg/tcg-op.c
+++ b/tcg/tcg-op.c
@@ -1400,10 +1400,14 @@ void tcg_gen_mov_i64(TCGv_i64 ret, TCGv_i64 arg)
  {
-    TCGTemp *ts = tcgv_i64_temp(arg);
-
-    /* Canonicalize TCGv_i64 TEMP_CONST into TCGv_i32 TEMP_CONST. */
-    if (ts->kind == TEMP_CONST) {
-        tcg_gen_movi_i64(ret, ts->val);
+    if (ret == arg) {
+        return;
      } else {
-        tcg_gen_mov_i32(TCGV_LOW(ret), TCGV_LOW(arg));
-        tcg_gen_mov_i32(TCGV_HIGH(ret), TCGV_HIGH(arg));
+        TCGTemp *ts = tcgv_i64_temp(arg);
+
+        /* Canonicalize TCGv_i64 TEMP_CONST into TCGv_i32 TEMP_CONST. */
+        if (ts->kind == TEMP_CONST) {
+            tcg_gen_movi_i64(ret, ts->val);
+        } else {
+            tcg_gen_mov_i32(TCGV_LOW(ret), TCGV_LOW(arg));
+            tcg_gen_mov_i32(TCGV_HIGH(ret), TCGV_HIGH(arg));
+        }
      }
---

and then:

-- >8 --
diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c
index 4f3d0b6cec..bd9288dac0 100644
--- a/tcg/tcg-op.c
+++ b/tcg/tcg-op.c
@@ -1461,9 +1461,9 @@ void tcg_gen_ld_i64(TCGv_i64 ret, TCGv_ptr arg2, 
tcg_target_long offset)
         they cannot be the same temporary */
-#if HOST_BIG_ENDIAN
-    tcg_gen_ld_i32(TCGV_HIGH(ret), arg2, offset);
-    tcg_gen_ld_i32(TCGV_LOW(ret), arg2, offset + 4);
-#else
-    tcg_gen_ld_i32(TCGV_LOW(ret), arg2, offset);
-    tcg_gen_ld_i32(TCGV_HIGH(ret), arg2, offset + 4);
-#endif
+    if (HOST_BIG_ENDIAN) {
+        tcg_gen_ld_i32(TCGV_HIGH(ret), arg2, offset);
+        tcg_gen_ld_i32(TCGV_LOW(ret), arg2, offset + 4);
+    } else {
+        tcg_gen_ld_i32(TCGV_LOW(ret), arg2, offset);
+        tcg_gen_ld_i32(TCGV_HIGH(ret), arg2, offset + 4);
+    }
  }
@@ -1487,9 +1487,9 @@ void tcg_gen_st_i64(TCGv_i64 arg1, TCGv_ptr arg2, 
tcg_target_long offset)
  {
-#if HOST_BIG_ENDIAN
-    tcg_gen_st_i32(TCGV_HIGH(arg1), arg2, offset);
-    tcg_gen_st_i32(TCGV_LOW(arg1), arg2, offset + 4);
-#else
-    tcg_gen_st_i32(TCGV_LOW(arg1), arg2, offset);
-    tcg_gen_st_i32(TCGV_HIGH(arg1), arg2, offset + 4);
-#endif
+    if (HOST_BIG_ENDIAN) {
+        tcg_gen_st_i32(TCGV_HIGH(arg1), arg2, offset);
+        tcg_gen_st_i32(TCGV_LOW(arg1), arg2, offset + 4);
+    } else {
+        tcg_gen_st_i32(TCGV_LOW(arg1), arg2, offset);
+        tcg_gen_st_i32(TCGV_HIGH(arg1), arg2, offset + 4);
+    }
  }
---

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>



  reply	other threads:[~2023-12-13 15:07 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-29 21:08 [PATCH 00/11] tcg: Move tcg expanders out of line Richard Henderson
2023-10-29 21:08 ` [PATCH 01/11] tcg: Mark tcg_gen_op* as noinline Richard Henderson
2023-12-13 14:09   ` Philippe Mathieu-Daudé
2023-10-29 21:08 ` [PATCH 02/11] tcg: Move tcg_gen_op* out of line Richard Henderson
2023-12-13 14:12   ` Philippe Mathieu-Daudé
2023-10-29 21:08 ` [PATCH 03/11] tcg: Move generic expanders " Richard Henderson
2023-12-13 14:21   ` Philippe Mathieu-Daudé
2023-10-29 21:08 ` [PATCH 04/11] tcg: Move 32-bit " Richard Henderson
2023-12-13 14:23   ` Philippe Mathieu-Daudé
2023-10-29 21:08 ` [PATCH 05/11] tcg: Move 64-bit " Richard Henderson
2023-12-13 14:46   ` Philippe Mathieu-Daudé [this message]
2023-10-29 21:08 ` [PATCH 06/11] tcg: Move vec_gen_* declarations to tcg-internal.h Richard Henderson
2023-12-13 14:48   ` Philippe Mathieu-Daudé
2023-10-29 21:08 ` [PATCH 07/11] tcg: Move tcg_gen_opN " Richard Henderson
2023-12-13 14:49   ` Philippe Mathieu-Daudé
2023-10-29 21:08 ` [PATCH 08/11] tcg: Unexport tcg_gen_op*_{i32,i64} Richard Henderson
2023-12-13 17:42   ` Philippe Mathieu-Daudé
2023-10-29 21:08 ` [PATCH 09/11] tcg: Move tcg_constant_* out of line Richard Henderson
2023-10-29 21:08 ` [PATCH 10/11] tcg: Move tcg_temp_new_*, tcg_global_mem_new_* " Richard Henderson
2023-12-13 17:51   ` Philippe Mathieu-Daudé
2023-10-29 21:08 ` [PATCH 11/11] tcg: Move tcg_temp_free_* " Richard Henderson
2023-12-13 15:08   ` 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=93330946-8847-4a7f-b04e-7f7da60298b1@linaro.org \
    --to=philmd@linaro.org \
    --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).