| 525 | } |
| 526 | |
| 527 | static __inline int |
| 528 | atomic_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 |
no outgoing calls
no test coverage detected