Should __attribute__((optimize("align-loops"))) work ? (for x86_64)

Chris Hall chris@gmch.uk
Wed Jan 24 14:16:00 GMT 2018


The manual suggests that it should be possible to use function 
attributes to set "-falign-loops", "-falign-jumps" etc. on a per 
function basis.

With v7.2.1 I find that:

   __attribute__((optimize("align-loops=32")))

is rejected with a "warning: bad option '-falign-loops=32'"

while:

   __attribute__((optimize("align-loops")))

is accepted.

I can compile with "-falign-loops=32" gcc-command-line option.  This 
appears to align loops (to the requested boundary) for "-O0", "-Og", 
"-O3" and (even) "-Os".

I have a large project, with just a few functions for which 
loop-alignment has any material effect -- for the rest of the project, 
it's a waste of space.



I find that "align-functions" is similarly less than




More information about the Gcc-help mailing list