This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: asm as "memory barrier"
- From: Richard Henderson <rth at redhat dot com>
- To: Paul Koning <pkoning at equallogic dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 23 Apr 2003 15:36:56 -0700
- Subject: Re: asm as "memory barrier"
- References: <16038.61389.9170.410713@pkoning.dev.equallogic.com>
On Wed, Apr 23, 2003 at 03:55:57PM -0400, Paul Koning wrote:
> But it also (as documented) causes the compiler to assume that memory
> has changed since then, i.e., anything it loaded before is no longer
> valid. That's NOT what I want.
There doesn't appear to be any way to do this. I'd have expected
int x;
int foo()
{
int r = x;
{
char *p;
asm ("" : "=X"(p));
asm volatile ("" : : "X"(*p));
}
return x + r;
}
to work (as an observed read from a pointer with unknown value),
but it would seem that CSE doesn't want to combine the two loads
across the volatile asm.
r~