diff options
author | Tamar Christina <tamar.christina@arm.com> | 2023-11-21 13:21:39 +0000 |
---|---|---|
committer | Tamar Christina <tamar.christina@arm.com> | 2023-11-21 13:25:25 +0000 |
commit | da332ce109451c8965cb64847934da154d7dcf94 (patch) | |
tree | 640907a715bc52b5eed2c2da9c16b7563a291517 /ltsugar.m4 | |
parent | c187fe4bceb90643b88a55a54c4040ab9e40e659 (diff) | |
download | gcc-da332ce109451c8965cb64847934da154d7dcf94.zip gcc-da332ce109451c8965cb64847934da154d7dcf94.tar.gz gcc-da332ce109451c8965cb64847934da154d7dcf94.tar.bz2 |
AArch64: only emit mismatch error when features would be disabled.
At the moment we emit a warning whenever you specify both -march and -mcpu
and the architecture of them differ. The idea originally was that the user may
not be aware of this change.
However this has a few problems:
1. Architecture revisions is not an observable part of the architecture,
extensions are. Starting with GCC 14 we have therefore relaxed the rule that
all extensions can be enabled at any architecture level. Therefore it's
incorrect, or at least not useful to keep the check on architecture.
2. It's problematic in Makefiles and other build systems, where you want to
for certain files enable CPU specific builds. i.e. you may be by default
building for -march=armv8-a but for some file for -mcpu=neoverse-n1. Since
there's no easy way to remove the earlier options we end up warning and
there's no way to disable just this warning. Build systems compiling with
-Werror face an issue in this case that compiling with GCC is needlessly
hard.
3. It doesn't actually warn for cases that may lead to issues, so e.g.
-march=armv8.2-a+sve -mcpu=neoverse-n1 does not give a warning that SVE would
be disabled.
For this reason I have one of two proposals:
1. Just remove this warning all together.
2. Rework the warning based on extensions and only warn when features would be
disabled by the presence of the -mcpu. This is the approach this patch has
taken.
As examples:
> aarch64-none-linux-gnu-gcc -march=armv8.2-a+sve -mcpu=neoverse-n1
cc1: warning: switch ‘-mcpu=neoverse-n1’ conflicts with ‘-march=armv8.2-a+sve’ switch and resulted in options +crc+sve+norcpc+nodotprod being added .arch armv8.2-a+crc+sve
> aarch64-none-linux-gnu-gcc -march=armv8.2-a -mcpu=neoverse-n1
> aarch64-none-linux-gnu-gcc -march=armv8.2-a+dotprod -mcpu=neoverse-n1
> aarch64-none-linux-gnu-gcc -march=armv8.2-a+dotprod -mcpu=neoverse-n2
<no warning>
The one remaining issue here is that if both -march and -mcpu are specified we
pick the -march. This is not particularly obvious and for the use case to be
more useful I think it makes sense to pick the CPU's arch?
I did not make that change in the patch as it changes semantics.
Note that I can't write a test for this because dg-warning expects warnings to
be at a particular line and doesn't support warnings at the "global" level.
gcc/ChangeLog:
* config/aarch64/aarch64.cc (aarch64_override_options): Rework warnings.
Diffstat (limited to 'ltsugar.m4')
0 files changed, 0 insertions, 0 deletions