GCC extension proposal (loop unswitching)

Nils Pipenbrinck n.pipenbrinck@cubic.org
Sun Mar 30 16:08:00 GMT 2008


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



More information about the Gcc mailing list