Re: Questions about optimisation options

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

 



Hi. Thanks for your help.

To give you some context, I'm compiling code that forwards packets on an
embedded network device. The code accesses the hardware directly, there is
no operating system. The speed of network traffic is limited by the CPU and
I'm experimenting with different GCC optimisation options, and seeing how
fast I can get the same code to forward network traffic.

I don't have my actual results to hand now, but the following example shows
the pattern that I see... (in real life, the differences are relatively not
so drastic, but the specific values aren't important)

-fno-align-functions	 60 Mbps

-falign-functions=64:1	 40 Mbps
-falign-functions=64:2	 70 Mbps
-falign-functions=64:3	 70 Mbps
-falign-functions=64:4	 70 Mbps

-falign-functions=64:5	 90 Mbps
-falign-functions=64:6	 90 Mbps
-falign-functions=64:7	 90 Mbps
-falign-functions=64:8	 90 Mbps

-falign-functions=64:9	 100 Mbps
-falign-functions=64:10	 100 Mbps
-falign-functions=64:11	 100 Mbps
-falign-functions=64:12	 100 Mbps

-falign-functions=64:13	 50 Mbps
-falign-functions=64:14	 50 Mbps
-falign-functions=64:15	 50 Mbps
-falign-functions=64:16	 50 Mbps

-falign-functions=64:17	 40 Mbps
-falign-functions=64:18	 40 Mbps
-falign-functions=64:19	 40 Mbps
-falign-functions=64:20	 40 Mbps

etc...


On 03/06/2025 17:02, Segher Boessenkool wrote:
> I have no idea what you are seeing, and what about that confuses you,
> because you told us neither.

I hope the example above shows you what I'm seeing. I think it makes sense that
every 4 values of m produces the same code - because all ARM32 instructions are
4 bytes long, and would be aligned at a minimum on 4-byte boundaries. I am
confused why m=1,2,3,4 doesn't fit this pattern even though all other values do.

And I'm confused why neither m=1 nor m=2,3,4 produce the same code as
-fno-align-functions.


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

Yes. So I don't understand why "do not skip anything at all" is different to
-fno-align-functions. And also why m=2,3,4 also doesn't mean "do not skip
anything at all". All instructions are 4 bytes long, so shouldn't they also mean
don't skip anything?

Kind regards,
Tim



[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