[PATCH v2 8/8] target/sparc: Use tcg_gen_lookup_and_goto_ptr for v9 WRASI

Richard Henderson posted 8 patches 2 years, 7 months ago
Maintainers: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>, Artyom Tarasenko <atar4qemu@gmail.com>
There is a newer version of this series
[PATCH v2 8/8] target/sparc: Use tcg_gen_lookup_and_goto_ptr for v9 WRASI
Posted by Richard Henderson 2 years, 7 months ago
We incorporate %asi into tb->flags so that we may generate
inline code for the many ASIs for which it is easy to do so.
Setting %asi is common for e.g. memcpy and memset performing
block copy and clear, so it is worth noticing this case.

We must end the TB but do not need to return to the main loop.

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

diff --git a/target/sparc/translate.c b/target/sparc/translate.c
index ab7054d4eb..fcc1054943 100644
--- a/target/sparc/translate.c
+++ b/target/sparc/translate.c
@@ -4147,10 +4147,14 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn)
                                 tcg_gen_andi_tl(cpu_tmp0, cpu_tmp0, 0xff);
                                 tcg_gen_st32_tl(cpu_tmp0, cpu_env,
                                                 offsetof(CPUSPARCState, asi));
-                                /* End TB to notice changed ASI.  */
+                                /*
+                                 * End TB to notice changed ASI.
+                                 * TODO: Could notice src1 = %g0 and IS_IMM,
+                                 * update DisasContext and not exit the TB.
+                                 */
                                 save_state(dc);
                                 gen_op_next_insn();
-                                tcg_gen_exit_tb(NULL, 0);
+                                tcg_gen_lookup_and_goto_ptr();
                                 dc->base.is_jmp = DISAS_NORETURN;
                                 break;
                             case 0x6: /* V9 wrfprs */
-- 
2.34.1
Re: [PATCH v2 8/8] target/sparc: Use tcg_gen_lookup_and_goto_ptr for v9 WRASI
Posted by Philippe Mathieu-Daudé 2 years, 7 months ago
On 21/6/23 20:06, Richard Henderson wrote:
> We incorporate %asi into tb->flags so that we may generate
> inline code for the many ASIs for which it is easy to do so.
> Setting %asi is common for e.g. memcpy and memset performing
> block copy and clear, so it is worth noticing this case.
> 
> We must end the TB but do not need to return to the main loop.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   target/sparc/translate.c | 8 ++++++--
>   1 file changed, 6 insertions(+), 2 deletions(-)

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