From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33398) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bomPW-0001IL-PH for qemu-devel@nongnu.org; Tue, 27 Sep 2016 03:02:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bomPR-0003mV-7D for qemu-devel@nongnu.org; Tue, 27 Sep 2016 03:02:38 -0400 Received: from mailapp02.imgtec.com ([217.156.133.132]:17158 helo=mailapp01.imgtec.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bomPR-0003lW-1N for qemu-devel@nongnu.org; Tue, 27 Sep 2016 03:02:33 -0400 Date: Tue, 27 Sep 2016 08:02:26 +0100 From: Leon Alrae Message-ID: <20160927070226.GA30955@hhmipssw201.hh.imgtec.org> References: <1474445277-3160-1-git-send-email-leon.alrae@imgtec.com> <1474445277-3160-3-git-send-email-leon.alrae@imgtec.com> <7bcb606f-d86c-3213-4d97-e0541eeb4c89@twiddle.net> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <7bcb606f-d86c-3213-4d97-e0541eeb4c89@twiddle.net> Subject: Re: [Qemu-devel] [PATCH 2/2] target-mips: reimplement SC instruction and use cmpxchg List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson Cc: qemu-devel@nongnu.org, aurelien@aurel32.net On Wed, Sep 21, 2016 at 01:16:28PM -0700, Richard Henderson wrote: > On 09/21/2016 01:07 AM, Leon Alrae wrote: > >+ tcg_gen_brcond_tl(TCG_COND_EQ, addr, cpu_lladdr, l1); > >+ tcg_temp_free(addr); > >+ tcg_gen_movi_tl(t0, 0); > >+ tcg_gen_br(done); > >+ > >+ gen_set_label(l1); > >+ /* generate cmpxchg */ > >+ val = tcg_temp_new(); > >+ gen_load_gpr(val, rt); > >+ tcg_gen_atomic_cmpxchg_tl(t0, cpu_lladdr, cpu_llval, val, > >+ ctx->mem_idx, tcg_mo); > >+ tcg_gen_setcond_tl(TCG_COND_EQ, t0, t0, cpu_llval); > >+ tcg_temp_free(val); > >+ > >+ gen_set_label(done); > >+ /* store the result into the register */ > >+ gen_store_gpr(t0, rt); > > tcg_temp_free(t0); > > The only thing I would change is to duplicate the gen_store_gpr into > both branches, so that we don't have to store t0 into the stack > across the blocks. Done in v3. > > Otherwise, > > Reviewed-by: Richard Henderson Thanks for reviewing. Leon