lkml.org 
[lkml]   [2002]   [Aug]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch 4/21] fix ARCH_HAS_PREFETCH
Willy Tarreau wrote:
>>>
>>
>>#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 ?
>

OK, what are you trying to accomplish by this?

But if you wanted to, you could do:

for ( i = 0 ; i < N ; i++ ) {
j++;
asm volatile("" : "=g" (j));
}


-
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/

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