mbox series

[v3,0/8] target/sparc: Use tcg_gen_lookup_and_goto_ptr

Message ID 20230628071202.230991-1-richard.henderson@linaro.org
Headers show
Series target/sparc: Use tcg_gen_lookup_and_goto_ptr | expand

Message

Richard Henderson June 28, 2023, 7:11 a.m. UTC
Changes from v2:
  * Patch 4 relaxes the checking on NPC:
    (1) save_npc has just asserted that if the low 2 bits are non-zero,
        then we have exactly one of our 3 special cases.
    (2) The difference between DYNAMIC_PC_LOOKUP and DYNAMIC_PC within
        NPC are not relevant to chaining, only those two values within PC.
    Therefore simplify the test in sparc_tr_tb_stop.


r~


Richard Henderson (8):
  target/sparc: Use tcg_gen_lookup_and_goto_ptr in gen_goto_tb
  target/sparc: Fix npc comparison in sparc_tr_insn_start
  target/sparc: Drop inline markers from translate.c
  target/sparc: Introduce DYNAMIC_PC_LOOKUP
  target/sparc: Use DYNAMIC_PC_LOOKUP for conditional branches
  target/sparc: Use DYNAMIC_PC_LOOKUP for JMPL
  target/sparc: Use DYNAMIC_PC_LOOKUP for v9 RETURN
  target/sparc: Use tcg_gen_lookup_and_goto_ptr for v9 WRASI

 target/sparc/translate.c | 402 ++++++++++++++++++++++-----------------
 1 file changed, 225 insertions(+), 177 deletions(-)

Comments

Philippe Mathieu-Daudé June 28, 2023, 7:50 a.m. UTC | #1
On 28/6/23 09:11, Richard Henderson wrote:
> Changes from v2:
>    * Patch 4 relaxes the checking on NPC:
>      (1) save_npc has just asserted that if the low 2 bits are non-zero,
>          then we have exactly one of our 3 special cases.
>      (2) The difference between DYNAMIC_PC_LOOKUP and DYNAMIC_PC within
>          NPC are not relevant to chaining, only those two values within PC.
>      Therefore simplify the test in sparc_tr_tb_stop.

$ git diff v2..v3
-- >8 --
diff --git a/target/sparc/translate.c b/target/sparc/translate.c
index fcc1054943..bd877a5e4a 100644
--- a/target/sparc/translate.c
+++ b/target/sparc/translate.c
@@ -5683,14 +5683,6 @@ static void sparc_tr_tb_stop(DisasContextBase 
*dcbase, CPUState *cs)
          save_npc(dc);
-        switch (dc->npc) {
-        case DYNAMIC_PC_LOOKUP:
-            if (may_lookup) {
-                tcg_gen_lookup_and_goto_ptr();
-                break;
-            }
-            /* fall through */
-        case DYNAMIC_PC:
+        if (may_lookup) {
+            tcg_gen_lookup_and_goto_ptr();
+        } else {
              tcg_gen_exit_tb(NULL, 0);
-            break;
-        default:
-            g_assert_not_reached();
          }
---

OK, this makes sense.
Mark Cave-Ayland June 28, 2023, 9:48 a.m. UTC | #2
On 28/06/2023 08:11, Richard Henderson wrote:

> Changes from v2:
>    * Patch 4 relaxes the checking on NPC:
>      (1) save_npc has just asserted that if the low 2 bits are non-zero,
>          then we have exactly one of our 3 special cases.
>      (2) The difference between DYNAMIC_PC_LOOKUP and DYNAMIC_PC within
>          NPC are not relevant to chaining, only those two values within PC.
>      Therefore simplify the test in sparc_tr_tb_stop.
> 
> 
> r~
> 
> 
> Richard Henderson (8):
>    target/sparc: Use tcg_gen_lookup_and_goto_ptr in gen_goto_tb
>    target/sparc: Fix npc comparison in sparc_tr_insn_start
>    target/sparc: Drop inline markers from translate.c
>    target/sparc: Introduce DYNAMIC_PC_LOOKUP
>    target/sparc: Use DYNAMIC_PC_LOOKUP for conditional branches
>    target/sparc: Use DYNAMIC_PC_LOOKUP for JMPL
>    target/sparc: Use DYNAMIC_PC_LOOKUP for v9 RETURN
>    target/sparc: Use tcg_gen_lookup_and_goto_ptr for v9 WRASI
> 
>   target/sparc/translate.c | 402 ++++++++++++++++++++++-----------------
>   1 file changed, 225 insertions(+), 177 deletions(-)

This fixes the issue seen with the real PROM and a run of my OpenBIOS boot tests 
shows all is still well, so I'll get this queued to qemu-sparc and send a PR shortly.


ATB,

Mark.