qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Richard Henderson" <richard.henderson@linaro.org>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: [PATCH 5/8] target/xtensa: Evaluate TARGET_BIG_ENDIAN at compile time
Date: Thu, 17 Apr 2025 15:10:01 +0200	[thread overview]
Message-ID: <20250417131004.47205-6-philmd@linaro.org> (raw)
In-Reply-To: <20250417131004.47205-1-philmd@linaro.org>

Rather than evaluating TARGET_BIG_ENDIAN at preprocessing
time via #ifdef'ry, do it in C at compile time

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 target/xtensa/translate.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c
index 5ebd4a512c9..2af83c07c2e 100644
--- a/target/xtensa/translate.c
+++ b/target/xtensa/translate.c
@@ -1395,11 +1395,11 @@ static void translate_bbi(DisasContext *dc, const OpcodeArg arg[],
                           const uint32_t par[])
 {
     TCGv_i32 tmp = tcg_temp_new_i32();
-#if TARGET_BIG_ENDIAN
-    tcg_gen_andi_i32(tmp, arg[0].in, 0x80000000u >> arg[1].imm);
-#else
-    tcg_gen_andi_i32(tmp, arg[0].in, 0x00000001u << arg[1].imm);
-#endif
+    if (TARGET_BIG_ENDIAN) {
+        tcg_gen_andi_i32(tmp, arg[0].in, 0x80000000u >> arg[1].imm);
+    } else {
+        tcg_gen_andi_i32(tmp, arg[0].in, 0x00000001u << arg[1].imm);
+    }
     gen_brcondi(dc, par[0], tmp, 0, arg[2].imm);
 }
 
-- 
2.47.1



  parent reply	other threads:[~2025-04-17 13:11 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-17 13:09 [PATCH 0/8] misc: Prefer evaluating TARGET_BIG_ENDIAN in C Philippe Mathieu-Daudé
2025-04-17 13:09 ` [PATCH 1/8] linux-user/elfload: Use target_needs_bswap() Philippe Mathieu-Daudé
2025-04-18 17:44   ` Richard Henderson
2025-04-17 13:09 ` [PATCH 2/8] accel/kvm: " Philippe Mathieu-Daudé
2025-04-18 17:47   ` Richard Henderson
2025-04-17 13:09 ` [PATCH 3/8] target/mips: Check CPU endianness at runtime using env_is_bigendian() Philippe Mathieu-Daudé
2025-04-18 17:53   ` Richard Henderson
2025-04-17 13:10 ` [PATCH 4/8] target/ppc: Evaluate TARGET_BIG_ENDIAN at compile time Philippe Mathieu-Daudé
2025-04-17 19:26   ` Pierrick Bouvier
2025-04-18 17:56   ` Richard Henderson
2025-04-17 13:10 ` Philippe Mathieu-Daudé [this message]
2025-04-18 17:56   ` [PATCH 5/8] target/xtensa: " Richard Henderson
2025-04-17 13:10 ` [PATCH 6/8] hw/mips: " Philippe Mathieu-Daudé
2025-04-18 17:57   ` Richard Henderson
2025-04-17 13:10 ` [PATCH 7/8] hw/microblaze: " Philippe Mathieu-Daudé
2025-04-18 17:58   ` Richard Henderson
2025-04-17 13:10 ` [PATCH 8/8] gdbstub/helpers: " Philippe Mathieu-Daudé
2025-04-17 16:18   ` Alex Bennée
2025-04-18 18:01   ` Richard Henderson
2025-04-25 15:17 ` [PATCH 0/8] misc: Prefer evaluating TARGET_BIG_ENDIAN in C 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=20250417131004.47205-6-philmd@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).