All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Bruno Larsen (billionai)" <bruno.larsen@eldorado.org.br>
To: qemu-devel@nongnu.org
Cc: farosas@linux.ibm.com, richard.henderson@linaro.org,
	luis.pires@eldorado.org.br, lucas.araujo@eldorado.org.br,
	fernando.valle@eldorado.org.br, qemu-ppc@nongnu.org,
	matheus.ferst@eldorado.org.br, david@gibson.dropbear.id.au
Subject: [PATCH v5 1/4] target/ppc: used ternary operator when registering MAS
Date: Tue, 25 May 2021 08:53:52 -0300	[thread overview]
Message-ID: <20210525115355.8254-2-bruno.larsen@eldorado.org.br> (raw)
In-Reply-To: <20210525115355.8254-1-bruno.larsen@eldorado.org.br>

The write calback decision when registering the MAS SPR has been turned
into a ternary operation, rather than an if-then-else block.

This was done because when building without TCG, even though the
compiler will optimize away the pointers to spr_write_generic*, it
doesn't optimize away the decision and assignment to the local pointer,
creating compiler errors. This cleanup looked better than using ifdefs,
so  we decided to with it.

Signed-off-by: Bruno Larsen (billionai) <bruno.larsen@eldorado.org.br>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/ppc/cpu_init.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c
index b696469d1a..40719f6480 100644
--- a/target/ppc/cpu_init.c
+++ b/target/ppc/cpu_init.c
@@ -1205,15 +1205,12 @@ static void register_BookE206_sprs(CPUPPCState *env, uint32_t mas_mask,
     /* TLB assist registers */
     /* XXX : not implemented */
     for (i = 0; i < 8; i++) {
-        void (*uea_write)(DisasContext *ctx, int sprn, int gprn) =
-            &spr_write_generic32;
-        if (i == 2 && (mas_mask & (1 << i)) && (env->insns_flags & PPC_64B)) {
-            uea_write = &spr_write_generic;
-        }
         if (mas_mask & (1 << i)) {
             spr_register(env, mas_sprn[i], mas_names[i],
                          SPR_NOACCESS, SPR_NOACCESS,
-                         &spr_read_generic, uea_write,
+                         &spr_read_generic,
+                         (i == 2 && (env->insns_flags & PPC_64B))
+                         ? &spr_write_generic : &spr_write_generic32,
                          0x00000000);
         }
     }
-- 
2.17.1



  reply	other threads:[~2021-05-25 11:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-25 11:53 [PATCH v5 0/4] target/ppc: add support to disable-tcg Bruno Larsen (billionai)
2021-05-25 11:53 ` Bruno Larsen (billionai) [this message]
2021-05-27  4:13   ` [PATCH v5 1/4] target/ppc: used ternary operator when registering MAS David Gibson
2021-05-25 11:53 ` [PATCH v5 2/4] target/ppc: added ifdefs around TCG-only code Bruno Larsen (billionai)
2021-05-25 13:02   ` Philippe Mathieu-Daudé
2021-05-26 17:24     ` Bruno Piazera Larsen
2021-05-27  4:18       ` David Gibson
2021-05-25 11:53 ` [PATCH v5 3/4] target/ppc: created tcg-stub.c file Bruno Larsen (billionai)
2021-05-27  4:18   ` David Gibson
2021-05-25 11:53 ` [PATCH v5 4/4] target/ppc: updated meson.build to support disable-tcg Bruno Larsen (billionai)
2021-05-27  5:10   ` David Gibson

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=20210525115355.8254-2-bruno.larsen@eldorado.org.br \
    --to=bruno.larsen@eldorado.org.br \
    --cc=david@gibson.dropbear.id.au \
    --cc=farosas@linux.ibm.com \
    --cc=fernando.valle@eldorado.org.br \
    --cc=lucas.araujo@eldorado.org.br \
    --cc=luis.pires@eldorado.org.br \
    --cc=matheus.ferst@eldorado.org.br \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.