This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Request for discussion: Rewrite of inline assembler docs
- From: Andrew Haley <aph at redhat dot com>
- To: dw <limegreensocks at yahoo dot com>, Hannes Frederic Sowa <hannes at stressinduktion dot org>, shmeelgutl at shmuelhome dot mine dot nu
- Cc: gcc at gcc dot gnu dot org, rdsandiford at googlemail dot com
- Date: Mon, 31 Mar 2014 09:41:43 +0100
- Subject: Re: Request for discussion: Rewrite of inline assembler docs
- Authentication-results: sourceware.org; auth=none
- References: <5333A135 dot 4060007 at yahoo dot com> <87y4zw138j dot fsf at talisman dot default> <533514C7 dot 3040402 at yahoo dot com> <53353C73 dot 8050708 at redhat dot com> <20140328093031 dot GG29498 at order dot stressinduktion dot org> <533543D5 dot 2000401 at redhat dot com> <20140328104615 dot GH29498 at order dot stressinduktion dot org> <533575FB dot 2070700 at redhat dot com> <20140328144838 dot GI29498 at order dot stressinduktion dot org> <53358F2F dot 3070801 at redhat dot com> <20140328164611 dot GA28495 at order dot stressinduktion dot org> <5338F2AE dot 9090008 at yahoo dot com>
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.