Re: Questions about optimisation options

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!

On Tue, Jun 03, 2025 at 11:01:11AM +0100, Tim Froggatt via Gcc-help wrote:
> I'm compiling C software for an embedded ARM system with -mcpu=cortex-a8
> Currently my build system uses GCC version 12.2.1.
> 
> I've been investigating the effects of -falign-functions=n:m
> "Align the start of functions to the next power-of-two greater than or equal
> to n, skipping up to m-1 bytes."
> 
> I've set n=64 and I'm trying different values for m...
> -falign-functions=64:5
> -falign-functions=64:6
> -falign-functions=64:7
> -falign-functions=64:8
> etc.
> 
> m=5,6,7,8 all give similar output. The same for m=9,10,11,12. This is what 
> I'd
> expect since all ARM32 instructions are 4 bytes long, so would be aligned 
> at a
> minimum on 4-byte boundaries.
> 
> However I'm confused by m=1,2,3,4. m=1 gives a very different result to 
> 2,3,4
> (and in my case performance is considerably worse for m=1). What is
> -falign-functions=64:1 doing here?

"Skipping up to m-1 bytes" means "do not skip anything at all", for m=1.

I have no idea what you are seeing, and what about that confuses you,
because you told us neither.

> Also, what does it even mean when m=2, 3 or 4? If instructions are 4 bytes 
> long,
> then I thought this wouldn't actually be doing any alignment. But it gives a
> different result to specifying -fno-align-functions, so presumably there is
> something I'm misunderstanding?

Perhaps it rounds it up to a multiple of four here?  I don't know what
you are actually seeing (you didn't tell us), so that's about all I can
say :-(


Segher



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux