As I understand it, the -mtune flag affects the low-level code generation step, but it has no influence on the optimizations that are applied at a higher level. It won't, for example, turn on or off loop unrolling depending on how memory-bound a particular CPU tends to be.
The wast majority of options can lead to speedup or slowdown depending on the program, not on the CPU.This is certainly true. But most programmers don't want to spend time testing each optimization separately; they tend to just pick -O2 and let the compiler decide. After all the compiler writers know more about optimization, even if I know more about my particular program. If the compiler could be just a bit smarter, that would be a big win.
Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds