qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 4/8] target/sparc: Introduce DYNAMIC_PC_LOOKUP


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH v2 4/8] target/sparc: Introduce DYNAMIC_PC_LOOKUP
Date: Tue, 27 Jun 2023 11:08:16 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.12.0

On 21/6/23 20:06, Richard Henderson wrote:
Create a new artificial "next pc" which also indicates
that nothing has changed within the cpu state which
requires returning to the main loop.

Pipe this new value though all pc/npc checks.
Do not produce this new value yet.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
  target/sparc/translate.c | 155 ++++++++++++++++++++++++++++-----------
  1 file changed, 111 insertions(+), 44 deletions(-)


@@ -5608,20 +5649,46 @@ static void sparc_tr_translate_insn(DisasContextBase 
*dcbase, CPUState *cs)
  static void sparc_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs)
  {
      DisasContext *dc = container_of(dcbase, DisasContext, base);
+    bool may_lookup;
switch (dc->base.is_jmp) {
      case DISAS_NEXT:
      case DISAS_TOO_MANY:
-        if (dc->pc != DYNAMIC_PC &&
-            (dc->npc != DYNAMIC_PC && dc->npc != JUMP_PC)) {
+        if (((dc->pc | dc->npc) & 3) == 0) {
              /* static PC and NPC: we can use direct chaining */
              gen_goto_tb(dc, 0, dc->pc, dc->npc);
-        } else {
-            if (dc->pc != DYNAMIC_PC) {
-                tcg_gen_movi_tl(cpu_pc, dc->pc);
+            break;
+        }
+
+        if (dc->pc & 3) {
+            switch (dc->pc) {
+            case DYNAMIC_PC_LOOKUP:
+                may_lookup = true;
+                break;
+            case DYNAMIC_PC:
+                may_lookup = false;
+                break;
+            default:
+                g_assert_not_reached();
              }
-            save_npc(dc);
+        } else {
+            tcg_gen_movi_tl(cpu_pc, dc->pc);
+            may_lookup = true;
+        }
+
+        save_npc(dc);
+        switch (dc->npc) {

switch (dc->npc & 3)?

+        case DYNAMIC_PC_LOOKUP:
+            if (may_lookup) {
+                tcg_gen_lookup_and_goto_ptr();
+                break;
+            }
+            /* fall through */
+        case DYNAMIC_PC:
              tcg_gen_exit_tb(NULL, 0);
+            break;
+        default:
+            g_assert_not_reached();
          }
          break;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]