From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933095AbdBVRbw (ORCPT ); Wed, 22 Feb 2017 12:31:52 -0500 Received: from mail-pf0-f194.google.com ([209.85.192.194]:36284 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932498AbdBVRbn (ORCPT ); Wed, 22 Feb 2017 12:31:43 -0500 Subject: Re: [OpenRISC] [PATCH v3 09/25] openrisc: add optimized atomic operations To: Stafford Horne , Peter Zijlstra References: <1479fc4a4a18712003849341affe74b2a0da609a.1487702890.git.shorne@gmail.com> <20170222112737.GM6515@twins.programming.kicks-ass.net> <20170222142246.GC2449@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:31:34 +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: <20170222142246.GC2449@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:22 AM, Stafford Horne wrote: >> static inline int __atomic_add_unless(atomic_t *v, int a, int u) >> { >> int old, tmp; >> >> __asm__ __volatile__( >> "1: l.lwa %0, 0(%2) \n" >> " l.sfeq %0, %4 \n" >> " l.bf 2f \n" >> " l.nop \n" >> " l.add %1, %0, %3 \n" You can move this add into the delay slot and drop the preceding nop. r~ From mboxrd@z Thu Jan 1 00:00:00 1970 From: Richard Henderson Date: Thu, 23 Feb 2017 04:31:34 +1100 Subject: [OpenRISC] [PATCH v3 09/25] openrisc: add optimized atomic operations In-Reply-To: <20170222142246.GC2449@lianli.shorne-pla.net> References: <1479fc4a4a18712003849341affe74b2a0da609a.1487702890.git.shorne@gmail.com> <20170222112737.GM6515@twins.programming.kicks-ass.net> <20170222142246.GC2449@lianli.shorne-pla.net> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: openrisc@lists.librecores.org On 02/23/2017 01:22 AM, Stafford Horne wrote: >> static inline int __atomic_add_unless(atomic_t *v, int a, int u) >> { >> int old, tmp; >> >> __asm__ __volatile__( >> "1: l.lwa %0, 0(%2) \n" >> " l.sfeq %0, %4 \n" >> " l.bf 2f \n" >> " l.nop \n" >> " l.add %1, %0, %3 \n" You can move this add into the delay slot and drop the preceding nop. r~