[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 10/16] tcg-arm: Define TCG_TARGET_INSN_UNIT_S
From: |
Peter Maydell |
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 |
On 28 April 2014 20:28, Richard Henderson <address@hidden> wrote:
> And use tcg pointer differencing functions as appropriate.
>
> Cc: Peter Maydell <address@hidden>
> Signed-off-by: Richard Henderson <address@hidden>
> ---
> @@ -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
- Re: [Qemu-devel] [PATCH v3 10/16] tcg-arm: Define TCG_TARGET_INSN_UNIT_SIZE,
Peter Maydell <=