Re: [patch 4/21] fix ARCH_HAS_PREFETCH

From: Willy Tarreau (willy@w.ods.org)
Date: Wed Aug 14 2002 - 16:11:40 EST


On Wed, Aug 14, 2002 at 01:58:41PM -0700, H. Peter Anvin wrote:
> Willy Tarreau wrote:
> > This way, some loops could be optimized, and the developpers could explicitely
> > tell the compiler when they need to prevent any optimization.
> >
>
> #define __nop() asm volatile("")

and if you want to pass arguments, to guarantee that no optimization will
be done, even on loop constants ?
eg:
  for (i = 0; i < N; i++) {
    j++;
    __nop();
  }

-> might be optimized this way :
  j = N;
  for (i = 0; i < N; i++) {
    __nop();
  }

Perhaps using a volatile for j ?

Cheers,
Willy
 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Aug 15 2002 - 22:00:38 EST