aarch64 feature modifiers
Richard Sandiford
richard.sandiford@arm.com
Mon Feb 21 11:35:44 GMT 2022
Christer Solskogen via Gcc-help <gcc-help@gcc.gnu.org> writes:
> On https://gcc.gnu.org/onlinedocs/gcc/AArch64-Options.html there's a
> list of feature modifiers to -march and -mcpu. Is there a way to check
> or detect what features are available on a particular CPU?
If you want to compile for a specific CPU then it's better to use
-mcpu=<that-cpu> with no feature modifiers, and leave out -march.
GCC will then make full use of the available features.
E.g. -mcpu=neoverse-n1 (on its own) will enable all features
available on Neoverse N1 and optimise code for Neoverse N1.
If you're just curious which features a given CPU implements,
you can find that out by compiling a dummy file with -mcpu. E.g.:
echo | gcc -mcpu=neoverse-n1 -xc - -o - -S | grep '\.arch'
will print out:
.arch armv8.2-a+crc+fp16+rcpc+dotprod+profile
But it should never be necessary to convert that back into an
-march option. Using -mcpu with no feature modifiers is better.
-march is really for the case in which you don't know which CPU
the code will run on, but you instead have a baseline set of
requirements.
Thanks,
Richard
More information about the Gcc-help
mailing list