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
On Wed, Aug 14, 2002 at 12:41:04PM -0700, H. Peter Anvin wrote:
> Rogier Wolff wrote:
> >>
> >>Bullsh*t. It can legitimately transform it into:
> >>
> >> i = N;
> >
> >
> >Right! But people are confusing "practise", "published interface", and
> >"spec" again.
> >
> >Published interface in this case is that gcc will not optimize an empty
> >loop away, as it is often used to generate a timing loop.
> >
>
> Yes. This is a gcc-specific wart, a bad idea from the start, and
> apparently one which has caught up with them to the point that they've
> had to abandon it.

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.

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/

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