Advertisement
den4ik2003

Untitled

Aug 31st, 2023
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. #if(APPLE)
  2. #define FUNCTION_NAME(name) _##name
  3. #else
  4. #define FUNCTION_NAME(name) name
  5. #endif
  6.  
  7. .globl FUNCTION_NAME(AtomicLoad)
  8. .globl FUNCTION_NAME(AtomicStore)
  9. .globl FUNCTION_NAME(AtomicExchange)
  10.  
  11. FUNCTION_NAME(AtomicLoad):
  12. movq (%rdi), %rax
  13. retq
  14.  
  15. FUNCTION_NAME(AtomicStore):
  16. movq %rsi, (%rdi)
  17. retq
  18.  
  19. FUNCTION_NAME(AtomicExchange):
  20. xchg (%rdi), %rsi # Swap
  21. movq %rsi, %rax # Set prev value to RAX
  22. retq
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement