atomic_arch.h 297 B

1234567891011121314
  1. #define a_cas a_cas
  2. static inline int a_cas(volatile int *p, int t, int s)
  3. {
  4. __asm__("1: l.lwa %0, %1\n"
  5. " l.sfeq %0, %2\n"
  6. " l.bnf 1f\n"
  7. " l.nop\n"
  8. " l.swa %1, %3\n"
  9. " l.bnf 1b\n"
  10. " l.nop\n"
  11. "1: \n"
  12. : "=&r"(t), "+m"(*p) : "r"(t), "r"(s) : "cc", "memory" );
  13. return t;
  14. }