Date: Mon, 28 May 2018 20:29:03 +0000 (UTC) From: Emmanuel Vadot <manu@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334295 - head/sys/arm64/include Message-ID: <201805282029.w4SKT3io016871@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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) \ { \
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201805282029.w4SKT3io016871>