From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:37729) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QNB7p-0000Af-0R for qemu-devel@nongnu.org; Thu, 19 May 2011 17:51:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QNB7o-0000BQ-2q for qemu-devel@nongnu.org; Thu, 19 May 2011 17:51:20 -0400 Received: from mail-yw0-f45.google.com ([209.85.213.45]:43808) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QNB7n-0000BG-T1 for qemu-devel@nongnu.org; Thu, 19 May 2011 17:51:20 -0400 Received: by ywl41 with SMTP id 41so1275210ywl.4 for ; Thu, 19 May 2011 14:51:19 -0700 (PDT) Sender: Richard Henderson Message-ID: <4DD590D4.4070307@twiddle.net> Date: Thu, 19 May 2011 14:51:16 -0700 From: Richard Henderson MIME-Version: 1.0 References: <1305671572-5899-1-git-send-email-jcmvbkbc@gmail.com> <1305671572-5899-20-git-send-email-jcmvbkbc@gmail.com> In-Reply-To: <1305671572-5899-20-git-send-email-jcmvbkbc@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 19/26] target-xtensa: implement loop option List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Filippov Cc: qemu-devel@nongnu.org On 05/17/2011 03:32 PM, Max Filippov wrote: > + if (env->sregs[LEND] != v) { > + tb_invalidate_phys_page_range( > + env->sregs[LEND] - 1, env->sregs[LEND], 0); > + env->sregs[LEND] = v; > + tb_invalidate_phys_page_range( > + env->sregs[LEND] - 1, env->sregs[LEND], 0); > + } Why are you invalidating twice? > +static void gen_check_loop_end(DisasContext *dc, int slot) > +{ > + if (option_enabled(dc, XTENSA_OPTION_LOOP) && > + !(dc->tb->flags & XTENSA_TBFLAG_EXCM) && > + dc->next_pc == dc->lend) { > + int label = gen_new_label(); > + > + tcg_gen_brcondi_i32(TCG_COND_NE, cpu_SR[LEND], dc->next_pc, label); > + tcg_gen_brcondi_i32(TCG_COND_EQ, cpu_SR[LCOUNT], 0, label); > + tcg_gen_subi_i32(cpu_SR[LCOUNT], cpu_SR[LCOUNT], 1); > + gen_jump(dc, cpu_SR[LBEG]); > + gen_set_label(label); > + gen_jumpi(dc, dc->next_pc, slot); If you're going to pretend that LEND is a constant, you might as well pretend that LBEG is also a constant, so that you get to chain the TB's around the loop. > +static void gen_jumpi_check_loop_end(DisasContext *dc, int slot) > +{ > + gen_check_loop_end(dc, slot); > + gen_jumpi(dc, dc->next_pc, slot); You're generating duplicate jumpi's here; that can probably be avoided fairly easily. r~