From owner-svn-src-all@freebsd.org Mon May 28 20:29:04 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 840AEF94D1C; Mon, 28 May 2018 20:29:04 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3619383593; Mon, 28 May 2018 20:29:04 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1810812328; Mon, 28 May 2018 20:29:04 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4SKT3mO016872; Mon, 28 May 2018 20:29:03 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4SKT3io016871; Mon, 28 May 2018 20:29:03 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201805282029.w4SKT3io016871@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Mon, 28 May 2018 20:29:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334295 - head/sys/arm64/include X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/arm64/include X-SVN-Commit-Revision: 334295 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 May 2018 20:29:04 -0000 Author: manu Date: Mon May 28 20:29:03 2018 New Revision: 334295 URL: https://svnweb.freebsd.org/changeset/base/334295 Log: arm64: Add atomic_fcmpset_8 and atomic_fcmpset_16 Reviewed by: cognet Modified: head/sys/arm64/include/atomic.h Modified: head/sys/arm64/include/atomic.h ============================================================================== --- head/sys/arm64/include/atomic.h Mon May 28 20:06:40 2018 (r334294) +++ head/sys/arm64/include/atomic.h Mon May 28 20:29:03 2018 (r334295) @@ -102,6 +102,54 @@ ATOMIC(subtract, sub) #define ATOMIC_FCMPSET(bar, a, l) \ static __inline int \ +atomic_fcmpset_##bar##8(volatile uint8_t *p, uint8_t *cmpval, \ + uint8_t newval) \ +{ \ + uint8_t tmp; \ + uint8_t _cmpval = *cmpval; \ + int res; \ + \ + __asm __volatile( \ + "1: mov %w1, #1 \n" \ + " ld"#a"xrb %w0, [%2] \n" \ + " cmp %w0, %w3 \n" \ + " b.ne 2f \n" \ + " st"#l"xrb %w1, %w4, [%2]\n" \ + "2:" \ + : "=&r"(tmp), "=&r"(res) \ + : "r" (p), "r" (_cmpval), "r" (newval) \ + : "cc", "memory" \ + ); \ + *cmpval = tmp; \ + \ + return (!res); \ +} \ + \ +static __inline int \ +atomic_fcmpset_##bar##16(volatile uint16_t *p, uint16_t *cmpval, \ + uint8_t newval) \ +{ \ + uint16_t tmp; \ + uint16_t _cmpval = *cmpval; \ + int res; \ + \ + __asm __volatile( \ + "1: mov %w1, #1 \n" \ + " ld"#a"xh %w0, [%2] \n" \ + " cmp %w0, %w3 \n" \ + " b.ne 2f \n" \ + " st"#l"xh %w1, %w4, [%2] \n" \ + "2:" \ + : "=&r"(tmp), "=&r"(res) \ + : "r" (p), "r" (_cmpval), "r" (newval) \ + : "cc", "memory" \ + ); \ + *cmpval = tmp; \ + \ + return (!res); \ +} \ + \ +static __inline int \ atomic_fcmpset_##bar##32(volatile uint32_t *p, uint32_t *cmpval, \ uint32_t newval) \ { \