From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933038AbdBVRaw (ORCPT ); Wed, 22 Feb 2017 12:30:52 -0500 Received: from mail-pf0-f195.google.com ([209.85.192.195]:34511 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932523AbdBVRao (ORCPT ); Wed, 22 Feb 2017 12:30:44 -0500 Subject: Re: [OpenRISC] [PATCH v3 08/25] openrisc: add cmpxchg and xchg implementations To: Stafford Horne , Peter Zijlstra References: <58010da3ed6e62743cc99674349f91022b41e92a.1487702890.git.shorne@gmail.com> <20170222111940.GR6500@twins.programming.kicks-ass.net> <20170222142007.GB2449@lianli.shorne-pla.net> Cc: Jonas Bonn , openrisc@lists.librecores.org, linux-kernel@vger.kernel.org, linux@roeck-us.net From: Richard Henderson Message-ID: Date: Thu, 23 Feb 2017 04:30:35 +1100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <20170222142007.GB2449@lianli.shorne-pla.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/23/2017 01:20 AM, Stafford Horne wrote: > On Wed, Feb 22, 2017 at 12:19:40PM +0100, Peter Zijlstra wrote: >> On Wed, Feb 22, 2017 at 04:11:37AM +0900, Stafford Horne wrote: >>> + __asm__ __volatile__( >>> + "1: l.lwa %0, 0(%1) \n" >>> + " l.sfeq %0, %2 \n" >>> + " l.bnf 1f \n" >>> + " l.nop \n" >>> + " l.swa 0(%1), %3 \n" >>> + " l.bnf 1b \n" >>> + "1: l.nop \n" >>> + : "=&r"(old) >>> + : "r"(ptr), "r"(old), "r"(new) >>> + : "cc", "memory"); >> >> I just noticed this, but having both labels have the same name is >> somewhat confusing. > > Right, better to use '2' for the second one. Better still to put the second label after the delay-slot nop. You don't need to execute that on the way out. r~