MCPcopy Create free account
hub / github.com/F-Stack/f-stack / atomic_fcmpset_64

Function atomic_fcmpset_64

freebsd/mips/include/atomic.h:527–548  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

525}
526
527static __inline int
528atomic_fcmpset_64(__volatile uint64_t *p, uint64_t *cmpval, uint64_t newval)
529{
530 int ret;
531
532 __asm __volatile (
533 "lld %0, %1\n\t" /* load old value */
534 "bne %0, %4, 1f\n\t" /* compare */
535 "move %0, %3\n\t" /* value to store */
536 "scd %0, %1\n\t" /* attempt to store */
537 "j 2f\n\t" /* exit regardless of success */
538 "nop\n\t" /* avoid delay slot accident */
539 "1:\n\t"
540 "sd %0, %2\n\t" /* save old value */
541 "li %0, 0\n\t"
542 "2:\n"
543 : "=&r" (ret), "+m" (*p), "=m" (*cmpval)
544 : "r" (newval), "r" (*cmpval)
545 : "memory");
546
547 return ret;
548}
549
550/*
551 * Atomically compare the value stored at *p with cmpval and if the

Callers 2

atomic_swap_64Function · 0.70
atomic_swap_longFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected