From: Peter Maydell <peter.maydell@linaro.org>
To: Richard Henderson <rth@twiddle.net>
Cc: QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH v3 10/16] tcg-arm: Define TCG_TARGET_INSN_UNIT_SIZE
Date: Fri, 2 May 2014 16:19:51 +0100 [thread overview]
Message-ID: <CAFEAcA96B7atQo_mLJofmRBZr_Be-fZUrbmKn2a8CeMbg_R7AQ@mail.gmail.com> (raw)
In-Reply-To: <1398713302-29657-11-git-send-email-rth@twiddle.net>
On 28 April 2014 20:28, Richard Henderson <rth@twiddle.net> wrote:
> And use tcg pointer differencing functions as appropriate.
>
> Cc: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Richard Henderson <rth@twiddle.net>
> ---
> @@ -1670,51 +1651,28 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
>
> switch (opc) {
> case INDEX_op_exit_tb:
> - if (use_armv7_instructions || check_fit_imm(args[0])) {
> - tcg_out_movi32(s, COND_AL, TCG_REG_R0, args[0]);
> - tcg_out_goto(s, COND_AL, (tcg_target_ulong) tb_ret_addr);
> - } else {
> - uint8_t *ld_ptr = s->code_ptr;
> - tcg_out_ld32_12(s, COND_AL, TCG_REG_R0, TCG_REG_PC, 0);
> - tcg_out_goto(s, COND_AL, (tcg_target_ulong) tb_ret_addr);
> - *ld_ptr = (uint8_t) (s->code_ptr - ld_ptr) - 8;
> - tcg_out32(s, args[0]);
> - }
> + tcg_out_movi32(s, COND_AL, TCG_REG_R0, args[0]);
> + tcg_out_goto(s, COND_AL, tb_ret_addr);
Why is it OK not to have the pre-v7/non-fitting-immediate
code now? I guess movi32 will handle it all though probably
in a less efficient way.
> break;
> case INDEX_op_goto_tb:
> if (s->tb_jmp_offset) {
> /* Direct jump method */
> -#if defined(USE_DIRECT_JUMP)
> - s->tb_jmp_offset[args[0]] = s->code_ptr - s->code_buf;
> + s->tb_jmp_offset[args[0]] = tcg_current_code_size(s);
> tcg_out_b_noaddr(s, COND_AL);
> -#else
> - tcg_out_ld32_12(s, COND_AL, TCG_REG_PC, TCG_REG_PC, -4);
> - s->tb_jmp_offset[args[0]] = s->code_ptr - s->code_buf;
> - tcg_out32(s, 0);
> -#endif
> } else {
> /* Indirect jump method */
> -#if 1
> - c = (int) (s->tb_next + args[0]) - ((int) s->code_ptr + 8);
> - if (c > 0xfff || c < -0xfff) {
> - tcg_out_movi32(s, COND_AL, TCG_REG_R0,
> - (tcg_target_long) (s->tb_next + args[0]));
> - tcg_out_ld32_12(s, COND_AL, TCG_REG_PC, TCG_REG_R0, 0);
> - } else
> - tcg_out_ld32_12(s, COND_AL, TCG_REG_PC, TCG_REG_PC, c);
> -#else
> - tcg_out_ld32_12(s, COND_AL, TCG_REG_R0, TCG_REG_PC, 0);
> - tcg_out_ld32_12(s, COND_AL, TCG_REG_PC, TCG_REG_R0, 0);
> - tcg_out32(s, (tcg_target_long) (s->tb_next + args[0]));
> -#endif
> + intptr_t ptr = (intptr_t)(s->tb_next + args[0]);
> + tcg_out_movi32(s, COND_AL, TCG_REG_R0, ptr & ~0xfff);
> + tcg_out_ld32_12(s, COND_AL, TCG_REG_PC, TCG_REG_R0, ptr & 0xfff);
> }
This change also confused me but we're again relying on movi32
generating correct-but-inefficient code now, right?
thanks
-- PMM
next parent reply other threads:[~2014-05-02 15:20 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1398713302-29657-1-git-send-email-rth@twiddle.net>
[not found] ` <1398713302-29657-11-git-send-email-rth@twiddle.net>
2014-05-02 15:19 ` Peter Maydell [this message]
2014-05-02 15:24 ` [Qemu-devel] [PATCH v3 10/16] tcg-arm: Define TCG_TARGET_INSN_UNIT_SIZE Richard Henderson
2014-05-09 14:08 ` Peter Maydell
[not found] ` <1398713302-29657-13-git-send-email-rth@twiddle.net>
2014-05-09 13:35 ` [Qemu-devel] [PATCH v3 12/16] tcg-s390: " Peter Maydell
2014-05-12 17:05 ` Richard Henderson
2014-05-12 20:41 ` Peter Maydell
[not found] ` <1398713302-29657-15-git-send-email-rth@twiddle.net>
2014-05-09 13:39 ` [Qemu-devel] [PATCH v3 14/16] tcg-mips: " Peter Maydell
[not found] ` <1398713302-29657-16-git-send-email-rth@twiddle.net>
2014-05-09 13:52 ` [Qemu-devel] [PATCH v3 15/16] tci: " Peter Maydell
2014-05-12 23:13 ` Richard Henderson
[not found] ` <1398713302-29657-12-git-send-email-rth@twiddle.net>
2014-05-09 14:09 ` [Qemu-devel] [PATCH v3 11/16] tcg-aarch64: " Peter Maydell
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=CAFEAcA96B7atQo_mLJofmRBZr_Be-fZUrbmKn2a8CeMbg_R7AQ@mail.gmail.com \
--to=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).