Author: mjg
Date: Tue Jan 10 21:10:20 2017
New Revision: 311898
URL: https://svnweb.freebsd.org/changeset/base/311898

Log:
  sparc64: add atomic_fcmpset
  
  Tested on hardware provided by feld.
  
  Reviewed by:  marius

Modified:
  head/sys/sparc64/include/atomic.h

Modified: head/sys/sparc64/include/atomic.h
==============================================================================
--- head/sys/sparc64/include/atomic.h   Tue Jan 10 20:52:44 2017        
(r311897)
+++ head/sys/sparc64/include/atomic.h   Tue Jan 10 21:10:20 2017        
(r311898)
@@ -219,6 +219,40 @@ atomic_cmpset_rel_ ## name(volatile ptyp
        return (((vtype)atomic_cas_rel((p), (e), (s), sz)) == (e));     \
 }                                                                      \
                                                                        \
+static __inline int                                                    \
+atomic_fcmpset_ ## name(volatile ptype p, vtype *ep, vtype s)          \
+{                                                                      \
+       vtype t;                                                        \
+                                                                       \
+       t = (vtype)atomic_cas((p), (*ep), (s), sz);                     \
+       if (t == (*ep))                                                 \
+               return (1);                                             \
+       *ep = t;                                                        \
+       return (0);                                                     \
+}                                                                      \
+static __inline int                                                    \
+atomic_fcmpset_acq_ ## name(volatile ptype p, vtype *ep, vtype s)      \
+{                                                                      \
+       vtype t;                                                        \
+                                                                       \
+       t = (vtype)atomic_cas_acq((p), (*ep), (s), sz);                 \
+       if (t == (*ep))                                                 \
+               return (1);                                             \
+       *ep = t;                                                        \
+       return (0);                                                     \
+}                                                                      \
+static __inline int                                                    \
+atomic_fcmpset_rel_ ## name(volatile ptype p, vtype *ep, vtype s)      \
+{                                                                      \
+       vtype t;                                                        \
+                                                                       \
+       t = (vtype)atomic_cas_rel((p), (*ep), (s), sz);                 \
+       if (t == (*ep))                                                 \
+               return (1);                                             \
+       *ep = t;                                                        \
+       return (0);                                                     \
+}                                                                      \
+                                                                       \
 static __inline vtype                                                  \
 atomic_load_ ## name(volatile ptype p)                                 \
 {                                                                      \
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to