[cfe-dev] Behavior of -mcpu
Stefan Teleman via cfe-dev
cfe-dev at lists.llvm.org
Thu Feb 28 13:34:42 PST 2019
On Thu, Feb 28, 2019 at 3:42 PM David Greene <dag at cray.com> wrote:
>
> This is problematic for users. If clang interprets command-line flags
> differently based on subtarget, how are users to know what to pass to
> clang to get, say, the best performance, or best code size, or whatever?
Yes, clang interprets -mcpu= | -march= | -mtune= differently based on
subtarget. So does GCC. This has been the case for many years.
For example, on X86_64, both clang and GCC complain if you pass -mcpu=
on compile-line. On AArch64 or SPARC, neither of them do.
AArch64 doesn't have the same diversity of sub-arch'es and
micro-arch'es and micro-tuning that X86_64 does. So, fiddling with
-mtune= and -march= on AArch64 is probably not as useful as it is on
X86_64. On AArch64, -mcpu= usually is sufficient. You will get the
most of what that particular CPU can do by default.
--
Stefan Teleman
stefan.teleman at gmail.com
More information about the cfe-dev
mailing list