[lkml]   [2002]   [Aug]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [patch 4/21] fix ARCH_HAS_PREFETCH
Willy Tarreau wrote:
> There would be a solution to tell gcc not to optimize things, which may
> not require too much work from gcc people. Basically, we would need to
> implement a __builtin_nop() function that would respect dependencies but
> not generate any code. This way, we could have :
> for (i=0; i<N, i++);
> optimized as i=N
> and
> for (i=0; i<N; i++)
> __builtin_nop();
> or even
> for (i=0; i<N; __builtin_nop(i++));
> do the real work.
> 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("")

Since some processors now have "busy wait delay" instructions, this
would also make it possible to do:

#if defined(__i386__) || defined(__x86_64__)

#define __busy_wait() asm volatile("rep;nop")


#define __busy_wait() asm volatile("")


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:28    [W:0.204 / U:0.264 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site