Re: GCC extension proposal (loop unswitching)

2008-03-30 Thread Andi Kleen
Nils Pipenbrinck <[EMAIL PROTECTED]> writes:

> Most of the stuff I write is performance critical, and I always find
> myself in the same situation: I spend counter less hours to unswitch
> loops by hand because the built-in loop unswitcher is not always smart
> when multiple variables can be unswitched. 

I'm sure the developers would appreciate simple test cases in bugzilla
demonstrating the problem. That would not help you immediately 
(because it would only be fixed in some future gcc version), but long term.

> Also you can not
> enable/disable loop unswitching on a per-function basis.

I often wished for a way to enable/disable loop unrolling on a per 
loop basis. Some way to annotate loops similar to what OpenMP
does would be quite nice.

-Andi


GCC extension proposal (loop unswitching)

2008-03-30 Thread Nils Pipenbrinck
Hi there. I'm a long mailing-list lurker, and I use GCC quite a bit for 
embedded software development.


Most of the stuff I write is performance critical, and I always find 
myself in the same situation: I spend counter less hours to unswitch 
loops by hand because the built-in loop unswitcher is not always smart 
when multiple variables can be unswitched. Also you can not 
enable/disable loop unswitching on a per-function basis.


I like to structure my source by function (so you find related stuff in 
the same source). Therefore I always have uncritical control-code and 
critical inner loop functions in the same translation unit. This is bad 
because I can't simply enable the optimization without sacrificing 
code-space (and as such performance due to instruction cache misses).


Some kind of pragma/attribute to hint the compiler into making a better 
decision and enabling/disabling unswitching for entire functions would 
be great help for my work. I have no real idea how such a pragma should 
look like because I'm not familiar with the gcc internals.



I hope it's ok to place requests like this onto the mailinglist.

Cheers, and keep up the good work,

   Nils