From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:60508) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QNQTM-0002lH-8Q for qemu-devel@nongnu.org; Fri, 20 May 2011 10:14:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QNQTL-0003ig-8c for qemu-devel@nongnu.org; Fri, 20 May 2011 10:14:36 -0400 Received: from mail-pv0-f173.google.com ([74.125.83.173]:54009) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QNQTL-0003ib-1M for qemu-devel@nongnu.org; Fri, 20 May 2011 10:14:35 -0400 Received: by pvg3 with SMTP id 3so2111881pvg.4 for ; Fri, 20 May 2011 07:14:34 -0700 (PDT) Sender: Richard Henderson Message-ID: <4DD67747.8030604@twiddle.net> Date: Fri, 20 May 2011 07:14:31 -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> <4DD590D4.4070307@twiddle.net> <201105201125.16972.jcmvbkbc@gmail.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 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/20/2011 02:10 AM, Max Filippov wrote: >>> 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. >> >> But there may be three exits from TB at the LEND if its last >> command is a branch: to the LBEG, to the branch target and to the >> next insn. > > Ok, I guess that I need to add gen_wsr_lbeg that invalidates TB at the > current LEND, pretend that LBEG is constant and use given slot to jump > to it. And also to get rid of tcg_gen_brcondi_i32(TCG_COND_NE, > cpu_SR[LEND], dc->next_pc, label); Yes. Consider that the code is written to assume that the loop cycles, so the most likely exit at LEND is LBEG. If we choose to mirror that logic inside TCG, then of the 3 possible exits from the block one of them should be LBEG so that the most likely edge can get chained. r~