I'm confused about the clang --target, -mcpu, -marchCan someone give a clear explanation on what is the difference between them?
Originally I thought need to specify -mcpu (which I assume means CPU) and -march but then I can't figure out how --target fits into the picture. Sometimes it tells me that -march or -mcpu options is not used. I would really appreciate any help on this.
-Most- targets use -march.-eric
Yes and no. By target here I just mean the architecture being targeted and that most of them use the -march option rather than -mcpu. Which makes what you said a consequence of that. :)
_______________________________________________
LLVM Developers mailing list
llvm...@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
From what I remember, the meaning of march/mcpu differs between clang
and LLVM's utilities (llc, etc.) In clang, mcpu and march have a lot of
overlap in terms of usage, and it seems to differ from one target to the
next. What you say would make sense, but, for example, we have legacy
code that used -march=hexagonv5, where "hexagonv5" is actually a CPU
version, something that intuitively should belong in "mcpu". Hexagon
doesn't seem to be the only one where "march" and "mcpu" are treated
almost identically, I saw what looked like CPU names in the march string
in other toolchains as well.
The clang documentation states:
Target Selection Options
~~~~~~~~~~~~~~~~~~~~~~~~
[...]
.. option:: -arch <architecture>
Specify the architecture to build for.
[...]
.. option:: -march=<cpu>
Specify that Clang should generate code for a specific processor
family
member and later. For example, if you specify -march=i486, the
compiler is
allowed to generate instructions that are valid on i486 and later
processors,
but which may not exist on earlier ones.
mcpu is not mentioned at all.
For better or worse, clang is trying to emulate GCC's options, which
have a long history behind them. There is some general idea there, but
I think the target/processor selection scheme has evolved beyond the
point where it makes sense on all levels.
-Krzysztof
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation