[PATCH] [AArch64] Implement Clang CLI interface proposal about "-march".

Renato Golin renato.golin at linaro.org
Mon Jun 30 04:45:12 PDT 2014


On 30 June 2014 11:34, Kevin Qin <kevinqindev at gmail.com> wrote:
> 2. Get "-mfpu" deprecated.

You can't just remove it. Other tools (and thus build systems) may
have them and we should try to be reasonably compatible.

Adding a warning would be a good first step, though.


> 3. Implement support of "-march". Usage is: "-march=armv8-a+[no]feature". For instance, "-march=armv8-a+neon+crc+nocrypto".  Here "armv8-a" is necessary, and CPU names are not acceptable.  Candidate features are fp, neon,  crc and crypto.

I like this.


> 4. Implement support of "-mtune". Usage is: "-march=CPU_NAME". For instance, "-march=cortex-a57". This option will ONLY get micro-architecture level feature enabled specifying to target CPU, like "zcm" and "zcz" for cyclone. Any architecture features WON'T be modified.

That's not what -mtune is. According to GCC's manual: "Tune to
cpu-type everything applicable about the generated code, except for
the ABI and the set of available instructions."

The difference between -mcup and -mtune is that the former selects ABI
and ISAs supported by the CPU, while the former doesn't. This is
particularly important if you want to run the code on a newer CPU but
doesn't want to break older ones, so you can't use instructions that
the old ones don't have, but you can optimise for the pipeline and
branch decisions of the newer CPU, as long as it just slows down the
older ones.


> 5. Change usage of "-mcpu" to "-mcpu=CPU_NAME+[no]feature", which is an alias to "-march={feature of CPU_NAME}+[no]feature" and "-mtune=CPU_NAME" together. An warning is added to discourage use of this option.

I find this one redundant with -march and don't think we should add
deprecated features. -mcpu is the flag you want for the behaviour
you've done -mtune above. AFAIK, we don't have the infrastructure to
implement -mtune yet. Also, the driver is a bit bonkers when going
from CPU to Arch from a different arch than the host without using
-target (which is the point with -march, I guess).

I don't think -mcpu should be used on its own, only in conjunction
with -target or -march.


> 1. Neon is enabled by default, and "generic" will be used if no CPU type is specified.

Makes sense to me.


> 2. For most scenario, Using "-mtune=CPU" only is recommended as neon is enabled by default and all micro-architecture optimizations are selected, and it would provide great compatibility to run on most of AArch64 devices.

That'd be -mcpu, and we still need -march or -target.


> 3. "-march" is designed to be used only if user wants to use crc and crypto instructions, or disable fp/neon. So "-march" will not be frequently used and won't bring too much finger burden.

I thought the idea was to encourage -march... at least on new targets...

--renato




More information about the llvm-commits mailing list