On 14/02/2020 10:41, Andrew Pinski wrote:
On Fri, Feb 14, 2020 at 2:12 AM Richard Earnshaw (lists)
<richard.earns...@arm.com> wrote:

On 14/02/2020 03:18, apin...@marvell.com wrote:
From: Andrew Pinski <apin...@marvell.com>

Right if someone supplies a -mcpu= option and then overrides
that option with -march=*, we get a warning when they conflict.
What we need is a generic cpu for each arch level but that is not
that useful because the only difference would be the arch level.
The best option is to allow -mcpu=generic -march=armv8.5-a not to
warn and that is now a generic armv8.5-a arch.


Then they should use -mtune=generic, rather than -mcpu.

Does it make sense to run:
"make check RUNTESTFLAGS="--target_board=unix/{,-mcpu=octeontx2}"
to make sure there are no latent bugs floating around with slightly
different tuning/scheduling?
The majority of the aarch64.exp failures are due to that warning.
If not how would suggest to test a -mcpu= option?

There is another use case:
A specific object file is to be run only on armv8.5-a processors but
someone sets CFLAGS to include -mcpu=octeontx2.
How would you suggest going about handling this case?

These are the two major cases where having a -mcpu=generic which
overrides a previous -mcpu= option and still able to select a higher
-march= option.


-mcpu=generic should behave *exactly* the same way as specifying the CPU you have, so to take an example, if your cpu is a Cortex-A72, then -mcpu=generic and -mcpu=cortex-a72 should result in exactly the same compiler output and diagnostics should be generated as if you'd specified the latter. Changing the behaviour just for generic therefore does not make sense.

R.

Thanks,
Andrew Pinski



R.
OK?  Bootstrapped and tested on aarch64-linux-gnu with no regressions.

Thanks,
Andrew Pinski

ChangeLog:
* config/aarch64/aarch64.c (aarch64_override_options): Don't
warn when the selected cpu was generic.
---
   gcc/config/aarch64/aarch64.c | 6 ++++--
   1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 4a34dce..9173afe 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -14075,10 +14075,12 @@ aarch64_override_options (void)
       explicit_tune_core = selected_tune->ident;
       }
     /* If both -mcpu and -march are specified check that they are 
architecturally
-     compatible, warn if they're not and prefer the -march ISA flags.  */
+     compatible, warn if they're not and prefer the -march ISA flags.
+     Only warn if not using the generic cpu.  */
     else if (selected_arch)
       {
-      if (selected_arch->arch != selected_cpu->arch)
+      if (selected_cpu->ident != generic
+       && selected_arch->arch != selected_cpu->arch)
       {
         warning (0, "switch %<-mcpu=%s%> conflicts with %<-march=%s%> switch",
                      all_architectures[selected_cpu->arch].name,



Reply via email to