> -----Original Message-----
> From: Matheus Tavares Bernardino <quic_mathb...@quicinc.com>
> Sent: Thursday, October 20, 2022 10:25 AM
> To: Taylor Simpson <tsimp...@quicinc.com>
> Cc: a...@rev.ng; a...@rev.ng; Brian Cain <bc...@quicinc.com>;
> phi...@linaro.org; qemu-devel@nongnu.org; Matheus Bernardino (QUIC)
> <quic_mathb...@quicinc.com>; richard.hender...@linaro.org
> Subject: Re: [PATCH 7/8] Hexagon (target/hexagon) Use direct block chaining
> for direct jump/branch
>
>
> Do we want to perform this logic at gen_write_new_pc_addr() as well?
>
> Although, in that case, we would need a separate ctx->branch_dest to hold a
> TCGv instead of target_ulong...
>
> Or have a single variable (TCGv) but add an extra tcg_gen_addi(ctx-
> >branch_dest, tcg_gen_constant_tl(pkt->pc), pc_off) call to
> gen_write_new_pc_pcrel(). (In which case, we could also unify the two
> gen_write_new_pc_* functions and have one as a thin wrapper around the
> other.) IDK about the extra overhead from tcg_gen_addi(), though.
We get the best performance from direct block chaining when the destination is
a constant at translation time (i.e., a direct branch) because we can use
goto_tb + exit_tb.
Take a look at gen_end_tb in translate.c to see how this is ultimately done.
For a single direct branch and a tight loop, we get the best performance.
Otherwise, we use tcg_gen_lookup_and_goto_ptr which is still better than what
we were doing before.
Thanks,
Taylor