This is the mail archive of the gcc-patches@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]

Re: doc patch for memory clobbers in ASM



  In message <200006262018.NAA00408@localhost.cygnus.com>you write:
  > 
  > At present, gcc will still perform folding, loop hoisting, etc. on
  > asm statements which clobber "memory" but are not volatile; for
  > instance,
  > 
  > int main(void)
  > {          
  >   int t, i, z = 1;
  >   for (i = 0; i < 10; i++)
  >     asm ("# do something with memory and %0" : "=r"(t) : "r"(&z) : "memory"
  > );
  >   return z;
  > }
  > 
  > gets folded down to an empty loop.  This patch documents this
  > behaviour. The alternative would be to change it, but it needs to be
  > changed in lots of places; for instance, single_set needs to be taught
  > that the asm above isn't a single set, and so on.
  > 
  > Is this OK?
  > 
  > -- 
  > - Geoffrey Keating <geoffk@cygnus.com>
  > 
  > ===File ~/patches/cygnus/asm-memclobberdoc.patch============
  > 2000-06-26  Geoff Keating  <geoffk@cygnus.com>
  > 
  > 	* extend.texi (Extended Asm): Mention that a memory clobber
  > 	does not count as a side-effect.
This is fine by me.
jeff


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