So, after looking over this discussion, I have updated the text. This time no undefined terms, while still conveying all the points I had in mind:

The "memory" clobber tells the compiler that the assembly code performs memory reads or writes to items other than those listed in the input and output operands (for example accessing the memory pointed to by one of the input parameters). To ensure memory contains correct values, GCC may need to flush specific register values to memory before executing the asm. Further, the compiler will not assume that any values read from memory before the @code{asm} will remain unchanged after the @code{asm}; it will reload them as needed. This effectively forms a read/write memory barrier for the compiler.

Note that this clobber does not prevent the @emph{processor} from doing speculative reads past the @code{asm} statement. To stop that, you need processor-specific fence instructions.

Objections?

dw

Reply via email to