Received: from eggs.gnu.org ([2001:4830:134:3::10]:35907) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmnwb-0006rN-8R for qemu-devel@nongnu.org; Wed, 21 Sep 2016 16:16:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bmnwW-0003Qz-Pa for qemu-devel@nongnu.org; Wed, 21 Sep 2016 16:16:36 -0400 Received: from mail-yw0-x22b.google.com ([2607:f8b0:4002:c05::22b]:33656) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmnwW-0003QZ-IB for qemu-devel@nongnu.org; Wed, 21 Sep 2016 16:16:32 -0400 Received: by mail-yw0-x22b.google.com with SMTP id i129so73448240ywb.0 for ; Wed, 21 Sep 2016 13:16:32 -0700 (PDT) Sender: Richard Henderson References: <1474445277-3160-1-git-send-email-leon.alrae@imgtec.com> <1474445277-3160-3-git-send-email-leon.alrae@imgtec.com> From: Richard Henderson Message-ID: <7bcb606f-d86c-3213-4d97-e0541eeb4c89@twiddle.net> Date: Wed, 21 Sep 2016 13:16:28 -0700 MIME-Version: 1.0 In-Reply-To: <1474445277-3160-3-git-send-email-leon.alrae@imgtec.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit 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: Leon Alrae , qemu-devel@nongnu.org Cc: aurelien@aurel32.net 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. Otherwise, Reviewed-by: Richard Henderson r~