I'm trying to make some optimized builds on several ARM SBCs, where each build will have compatability only on the target platform I'm building on.
I've heard that -march is more preferable here compared to -mtune as it will break break backwards compatability with other cpus in the architecture family by generating instructions that are only compatile with the host cpu. -mtune on the other hand will keep this compatabiliy.
However, I've read that -mcpu is possibly the best flag to set instead of -march or -mtune as -mcpu is specific to the very processor, not just the more common architecture specified by -marm (a difference of something like -mcpu=cortex-a8 over -march=armv7-a).
Now the tricky thing is I'm also reading that -mcpu is deprecated and its functionality is taken over by -mtune, which conflicts with my previous comments regarding the use of -mtune being undesirable when compared to -march and -marm being undesirable when compared to -mcpu.
Essentially, which flag will give me the best performance for the host machine when I don't care to maintain compatability with other cpus at all.
-mcpu
unfortunately has different semantics for different targets. It's deprecated for x86 (being a synonym for -mtune
) but not for ARM, where it's a sum of -march
and -mtune
.
So to answer your question - on ARM, always use -mcpu
for best performance, unless you care for backwards compatibility.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With