This is the mail archive of the gcc-help@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: Is there any other optimization for memory?


Parmenides <mobile.parmenides@gmail.com> writes:

> Gcc manual describes "memory" clobber in a inline assembly as follows:
>
> If your assembler instructions access memory in an unpredictable
> fashion, add `memory' to the list of clobbered registers. This will
> cause GCC to not keep memory values cached in registers across the
> assembler instruction and not optimize stores or loads to that memory.
>
> I have two questions about it.
>
> 1. "This will cause GCC to not keep memory values cached in registers
> ***across*** the assembler instruction"
> What's the exact meaning of "across"? I think that the gcc will reload
> a memory value into a register ***after*** the assembler instruction.
> Is that the case?

That is the case.  Perhaps this is a language issue as I think the
English is clear.  GCC will not keep a memory value cached in a register
from before to asm instruction to after the asm instruction--or, in
other words, across the instruction.


> 2.  "and not optimize stores or loads to that memory"
> Except caching memory values in registers, is there any other
> optimizaiton for stores or loads to memory?

Not in this case, I think it's just another way of saying the same
thing.

Ian


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