From owner-svn-src-projects@FreeBSD.ORG Fri Aug 16 00:24:34 2013 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id DD82E677; Fri, 16 Aug 2013 00:24:34 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id CAE8B2263; Fri, 16 Aug 2013 00:24:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7G0OYF1089154; Fri, 16 Aug 2013 00:24:34 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7G0OY74089153; Fri, 16 Aug 2013 00:24:34 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201308160024.r7G0OY74089153@svn.freebsd.org> From: Jung-uk Kim Date: Fri, 16 Aug 2013 00:24:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r254394 - projects/atomic64/sys/i386/include X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Aug 2013 00:24:34 -0000 Author: jkim Date: Fri Aug 16 00:24:34 2013 New Revision: 254394 URL: http://svnweb.freebsd.org/changeset/base/254394 Log: Micro-optimize atomic_cmpset_64_i386(). Modified: projects/atomic64/sys/i386/include/atomic.h Modified: projects/atomic64/sys/i386/include/atomic.h ============================================================================== --- projects/atomic64/sys/i386/include/atomic.h Fri Aug 16 00:14:52 2013 (r254393) +++ projects/atomic64/sys/i386/include/atomic.h Fri Aug 16 00:24:34 2013 (r254394) @@ -297,6 +297,7 @@ static __inline int atomic_cmpset_64_i386(volatile uint64_t *dst, uint64_t expect, uint64_t src) { volatile uint32_t *p; + u_char res; p = (volatile uint32_t *)dst; __asm __volatile( @@ -305,21 +306,21 @@ atomic_cmpset_64_i386(volatile uint64_t " xorl %1, %%eax ; " " xorl %2, %%edx ; " " orl %%edx, %%eax ; " - " sete %%al ; " - " movzbl %%al, %%eax ; " " jne 1f ; " - " movl %3, %1 ; " - " movl %4, %2 ; " + " movl %4, %1 ; " + " movl %5, %2 ; " "1: " + " sete %3 ; " " popfl" : "+A" (expect), /* 0 */ "+m" (*p), /* 1 */ - "+m" (*(p + 1)) /* 2 */ - : "r" ((uint32_t)src), /* 3 */ - "r" ((uint32_t)(src >> 32)) /* 4 */ + "+m" (*(p + 1)), /* 2 */ + "=q" (res) /* 3 */ + : "r" ((uint32_t)src), /* 4 */ + "r" ((uint32_t)(src >> 32)) /* 5 */ : "memory", "cc"); - return (expect); + return (res); } static __inline uint64_t