The usage volatile and memory in this case have very little to do with the asm block itself, inputs/outputs or its side-effects, it's mainly about the context in which it is used. If the atomic intrinsic is being used to implement a locking primitive (e.g. a spinlock), which is the case in MySQL, it's is important to prevent the compiler from reordering across the locked region and to synchronize memory access around it.
Laurynas,
The usage volatile and memory in this case have very little to do with the asm block itself, inputs/outputs or its side-effects, it's mainly about the context in which it is used. If the atomic intrinsic is being used to implement a locking primitive (e.g. a spinlock), which is the case in MySQL, it's is important to prevent the compiler from reordering across the locked region and to synchronize memory access around it.