aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2020-03-03 10:44:24 +0100
committerJakub Jelinek <jakub@redhat.com>2020-03-03 10:44:24 +0100
commit01eb1bb0237a24fe50ed0631857f3dfc31782f54 (patch)
treee1680867f5d621a6b63db5d30740b6c518b83d44
parent0ab503d34f2a8c22262ceefea6c882ae2ff75230 (diff)
downloadgcc-01eb1bb0237a24fe50ed0631857f3dfc31782f54.zip
gcc-01eb1bb0237a24fe50ed0631857f3dfc31782f54.tar.gz
gcc-01eb1bb0237a24fe50ed0631857f3dfc31782f54.tar.bz2
s390: Fix --with-arch=... --with-tune=... [PR26877]
In Fedora we configure GCC with --with-arch=zEC12 --with-tune=z13 right now and furthermore redhat-rpm-config adds to rpm packages -march=zEC12 -mtune=z13 options (among others). While looking at the git compilation, I've been surprised that -O2 actually behaves differently from -O2 -mtune=z13 in this configuration, and indeed, seems --with-tune= is completely ignored on s390 if --with-arch= is specified. i386 had the same problem, but got that fixed in 2006, see PR26877. The thing is that for tune, we add -mtune=%(VALUE) only if neither -mtune= nor -march= is present, but as arch is processed first, it adds -march=%(VALUE) first and then -march= is always present and so -mtune= is never added. By reordering it in OPTION_DEFAULT_SPECS, we process tune first, add the default -mtune=%(VALUE) if -mtune= or -march= isn't seen, and then add -march=%(VALUE) if -march= isn't seen. It is true that cc1 etc. will be then invoked with -mtune=z13 -march=zEC12, but like if the user specifies it in that order, it should still use z13 tuning and zEC12 ISA set. 2020-03-03 Jakub Jelinek <jakub@redhat.com> PR target/26877 * config/s390/s390.h (OPTION_DEFAULT_SPECS): Reorder.
-rw-r--r--gcc/ChangeLog3
-rw-r--r--gcc/config/s390/s390.h8
2 files changed, 8 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 124a06a..08ce80e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,8 @@
2020-03-03 Jakub Jelinek <jakub@redhat.com>
+ PR target/26877
+ * config/s390/s390.h (OPTION_DEFAULT_SPECS): Reorder.
+
PR rtl-optimization/94002
* explow.c (plus_constant): Punt if cst has VOIDmode and
get_pool_mode is different from mode.
diff --git a/gcc/config/s390/s390.h b/gcc/config/s390/s390.h
index dd3118e..2e29dbe 100644
--- a/gcc/config/s390/s390.h
+++ b/gcc/config/s390/s390.h
@@ -227,11 +227,13 @@ enum processor_flags
#define TARGET_DEFAULT 0
#endif
-/* Support for configure-time defaults. */
+/* Support for configure-time defaults.
+ The order here is important so that -march doesn't squash the
+ tune values. */
#define OPTION_DEFAULT_SPECS \
{ "mode", "%{!mesa:%{!mzarch:-m%(VALUE)}}" }, \
- { "arch", "%{!march=*:-march=%(VALUE)}" }, \
- { "tune", "%{!mtune=*:%{!march=*:-mtune=%(VALUE)}}" }
+ { "tune", "%{!mtune=*:%{!march=*:-mtune=%(VALUE)}}" }, \
+ { "arch", "%{!march=*:-march=%(VALUE)}" }
#ifdef __s390__
extern const char *s390_host_detect_local_cpu (int argc, const char **argv);