svn commit: r334295 - head/sys/arm64/include
Emmanuel Vadot
manu at FreeBSD.org
Mon May 28 20:29:04 UTC 2018
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) \
{ \
More information about the svn-src-head
mailing list