Skip to content

Instantly share code, notes, and snippets.

@gaul
Created April 26, 2013 22:45
Show Gist options
  • Save gaul/5470942 to your computer and use it in GitHub Desktop.
Save gaul/5470942 to your computer and use it in GitHub Desktop.
Atomic loads on x86
$ cat -n atomic.cc
1 #include <atomic>
2
3 int func(std::atomic<int> *x)
4 {
5 return std::atomic_load(x);
6 }
$ g++ -O2 -std=c++0x -S -o - atomic.cc
.file "atomic.cc"
.text
.p2align 4,,15
.globl _Z4funcPSt6atomicIiE
.type _Z4funcPSt6atomicIiE, @function
_Z4funcPSt6atomicIiE:
.LFB382:
.cfi_startproc
mfence
movl (%rdi), %eax
mfence
ret
.cfi_endproc
.LFE382:
.size _Z4funcPSt6atomicIiE, .-_Z4funcPSt6atomicIiE
.ident "GCC: (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3"
.section .note.GNU-stack,"",@progbits
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment