From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44706) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WgFG5-0006c9-Gu for qemu-devel@nongnu.org; Fri, 02 May 2014 11:20:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WgFG1-0000Bv-3C for qemu-devel@nongnu.org; Fri, 02 May 2014 11:20:17 -0400 Received: from mail-lb0-f177.google.com ([209.85.217.177]:65387) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WgFG0-0000Bf-Rt for qemu-devel@nongnu.org; Fri, 02 May 2014 11:20:13 -0400 Received: by mail-lb0-f177.google.com with SMTP id z11so3126480lbi.22 for ; Fri, 02 May 2014 08:20:11 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <1398713302-29657-11-git-send-email-rth@twiddle.net> References: <1398713302-29657-1-git-send-email-rth@twiddle.net> <1398713302-29657-11-git-send-email-rth@twiddle.net> From: Peter Maydell Date: Fri, 2 May 2014 16:19:51 +0100 Message-ID: Content-Type: text/plain; charset=UTF-8 Subject: Re: [Qemu-devel] [PATCH v3 10/16] tcg-arm: Define TCG_TARGET_INSN_UNIT_SIZE List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson Cc: QEMU Developers On 28 April 2014 20:28, Richard Henderson wrote: > And use tcg pointer differencing functions as appropriate. > > Cc: Peter Maydell > Signed-off-by: Richard Henderson > --- > @@ -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