This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Request for discussion: Rewrite of inline assembler docs


On 03/31/2014 05:44 AM, dw wrote:
> 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?

No, none.  That's fine.

Andrew.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]