public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Should __attribute__((optimize("align-loops"))) work ? (for x86_64)
@ 2018-01-24 14:16 Chris Hall
  2018-01-28 11:25 ` Should __attribute__((optimize("align-loops=32"))) " Chris Hall
  0 siblings, 1 reply; 4+ messages in thread
From: Chris Hall @ 2018-01-24 14:16 UTC (permalink / raw)
  To: gcc-help

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Should __attribute__((optimize("align-loops=32"))) work ? (for x86_64)
  2018-01-24 14:16 Should __attribute__((optimize("align-loops"))) work ? (for x86_64) Chris Hall
@ 2018-01-28 11:25 ` Chris Hall
  2018-01-28 12:46   ` Jonathan Wakely
  0 siblings, 1 reply; 4+ messages in thread
From: Chris Hall @ 2018-01-28 11:25 UTC (permalink / raw)
  To: gcc-help


With apologies for the noise...

...with v7.2.1, compiling for recent x86_64, the command line option 
"-falign-loops=32" is accepted and has the desired effect.

However I find that both:

     _Pragma("GCC optimize(\"align-loops=32\")")

and:

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

are rejected with a "warning: bad option '-falign-loops=32'" -- reported 
for each and every affected function.

Should I report this as a bug ?

[I have tried optimize("align-loops=x") for x=0, 1, 8 and 16 -- all are 
rejected the same way.]

Thanks,

Chris

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Should __attribute__((optimize("align-loops=32"))) work ? (for x86_64)
  2018-01-28 11:25 ` Should __attribute__((optimize("align-loops=32"))) " Chris Hall
@ 2018-01-28 12:46   ` Jonathan Wakely
  2018-01-29 13:51     ` Chris Hall
  0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Wakely @ 2018-01-28 12:46 UTC (permalink / raw)
  To: Chris Hall; +Cc: gcc-help

On 28 January 2018 at 11:25, Chris Hall wrote:
>
> With apologies for the noise...
>
> ...with v7.2.1, compiling for recent x86_64, the command line option
> "-falign-loops=32" is accepted and has the desired effect.
>
> However I find that both:
>
>     _Pragma("GCC optimize(\"align-loops=32\")")
>
> and:
>
>     __attribute__((optimize("align-loops=32")))
>
> are rejected with a "warning: bad option '-falign-loops=32'" -- reported for
> each and every affected function.
>
> Should I report this as a bug ?

Yes, if you can't find an existing report for it.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Should __attribute__((optimize("align-loops=32"))) work ? (for x86_64)
  2018-01-28 12:46   ` Jonathan Wakely
@ 2018-01-29 13:51     ` Chris Hall
  0 siblings, 0 replies; 4+ messages in thread
From: Chris Hall @ 2018-01-29 13:51 UTC (permalink / raw)
  To: gcc-help

On 28/01/18 12:46, Jonathan Wakely wrote:
> On 28 January 2018 at 11:25, Chris Hall wrote:
>> ...with v7.2.1, compiling for recent x86_64, the command line option
>> "-falign-loops=32" is accepted and has the desired effect.
>>
>> However I find that both:
>>
>>      _Pragma("GCC optimize(\"align-loops=32\")")
>>
>> and:
>>
>>      __attribute__((optimize("align-loops=32")))
>>
>> are rejected with a "warning: bad option '-falign-loops=32'" -- reported for
>> each and every affected function.
>>
>> Should I report this as a bug ?
> Yes, if you can't find an existing report for it.
OK: I have reported it.

FWIW: playing with "Compiler Explorer" suggests that this was broken by 
v7. Compiling with v6.3 does not generate the spurious warning, but the 
requested loop alignment is ignored. Going back to v5.4, I find the 
optimize("align-loops=32") actually works !

Thanks,

Chris

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-01-29 13:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-24 14:16 Should __attribute__((optimize("align-loops"))) work ? (for x86_64) Chris Hall
2018-01-28 11:25 ` Should __attribute__((optimize("align-loops=32"))) " Chris Hall
2018-01-28 12:46   ` Jonathan Wakely
2018-01-29 13:51     ` Chris Hall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).