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: dw <limegreensocks at yahoo dot com>
- To: gcc at gcc dot gnu dot org, rdsandiford at googlemail dot com
- Date: Thu, 27 Mar 2014 23:20:55 -0700
- Subject: Re: Request for discussion: Rewrite of inline assembler docs
- Authentication-results: sourceware.org; auth=none
- References: <530F1C69 dot 5050305 at redhat dot com> <87eh2oah7l dot fsf at sandifor-thinkpad dot stglab dot manchester dot uk dot ibm dot com> <530FE6CE dot 1000001 at yahoo dot com> <87ha7jd75c dot fsf at talisman dot default> <53144EC6 dot 2080600 at yahoo dot com> <87fvmzy0n9 dot fsf at sandifor-thinkpad dot stglab dot manchester dot uk dot ibm dot com> <53181FBE dot 1010306 at yahoo dot com> <87y5024i3m dot fsf at talisman dot default> <532FE0CB dot 6040109 at yahoo dot com> <87ior2ed7s dot fsf at sandifor-thinkpad dot stglab dot manchester dot uk dot ibm dot com> <5332823B dot 10805 at yahoo dot com> <87d2h94cr8 dot fsf at talisman dot default> <5333A135 dot 4060007 at yahoo dot com> <87y4zw138j dot fsf at talisman dot default>
Looks great to me. Just noticed one small nit: in the extended asm
section, "=irm" isn't valid, since you can't assign to an immediate.
Doh! I probably copied this from the Input section. Good catch.
Also, in the section about clobbers:
It causes the compiler to flush all registers to memory before
executing the asm statement.
At first I read this as meaning "all registers are saved somewhere in
memory before the asm". Maybe something like "flush all pending stores"?
Not sure whether that's better or not though.
You are right, and this is an important point. I have re-worked this
whole paragraph. Old:
It causes the compiler to flush all registers to memory before executing
the |asm| statement. Further, the compiler will not assume that any
values read before the |asm| will remain unchanged after the |asm|; it
will reload them as needed. This effectively forms a read/write barrier
for the compiler.
New:
Using this clobber causes the compiler to flush all (modified) registers
being used to store memory-based values to memory before executing the
@code{asm} statement. Further, the compiler will not assume that any
memory-based values read 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. For performance
reasons, some variables only exist in registers and never get written to
memory. The "memory" clobber does not force these values to get written
to memory.
Thanks again for all the work on this.
Anything else?
Richard