]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
config.gcc [...]: Support --with-arch, --with-tune, and --with-mode configure options.
authorUlrich Weigand <uweigand@de.ibm.com>
Mon, 30 Jun 2003 19:47:22 +0000 (19:47 +0000)
committerUlrich Weigand <uweigand@gcc.gnu.org>
Mon, 30 Jun 2003 19:47:22 +0000 (19:47 +0000)
* config.gcc [s390*-*-*]: Support --with-arch, --with-tune, and
--with-mode configure options.
* config/s390/s390.h (OPTION_DEFAULT_SPECS): Define.
(DRIVER_SELF_SPECS): Define.
* config/s390/linux.h (ASM_SPEC): Pass architecture mode and cpu
architecture to assembler.
(LINK_SPEC): Merge 31-bit and 64-bit variants.
(LINK_ARCH31_SPEC, LINK_ARCH64_SPEC, EXTRA_SPECS): Remove.
* config/s390/s390.c (override_options): New default rules for
architecture mode and cpu architecture selection.
* doc/invoke.texi (-mesa, -mzarch, -march, -mtune): Document
new default rules.

* config/s390/s390.h (enum processor_type): Add PROCESSOR_2084_Z990.
* config/s390/s390.md (attr "cpu"): Add "z990" processor type.
* config/s390/s390.c (override_options): Add "z990" to
processor_alias_table.
* doc/invoke.texi (-march): Document "z990" processor type.

* config/s390/s390.c (s390_tune_flags, s390_arch_flags): New variables.
* config/s390/s390.h (s390_tune_flags, s390_arch_flags): Declare.
(enum processor_flags, TARGET_CPU_IEEE_FLOAT, TARGET_CPU_ZARCH,
TARGET_CPU_LONG_DISPLACEMENT, TARGET_LONG_DISPLACEMENT): New.
* config/s390/s390.c (override_options): Replace enum pta_flags by
enum processor_flags.  Fill in s390_tune_flags and s390_arch_flags.

* config/s390/s390.c (s390_cpu): Rename to ...
(s390_tune): ... this.
* config/s390/s390.h (s390_cpu, s390_tune): Likewise.
* config/s390/s390.c (s390_issue_rate, override_options): Likewise.
* config/s390/s390.md (attr "cpu"): Likewise.

From-SVN: r68736

gcc/ChangeLog
gcc/config.gcc
gcc/config/s390/linux.h
gcc/config/s390/s390.c
gcc/config/s390/s390.h
gcc/config/s390/s390.md
gcc/doc/invoke.texi

index b94a8713fe1174507fe9f68e34d31894956c1a54..08be63ed9f5bd665a93ff0c6b20a75bb82459d71 100644 (file)
@@ -1,3 +1,37 @@
+2003-06-30  Ulrich Weigand  <uweigand@de.ibm.com>
+
+       * config.gcc [s390*-*-*]: Support --with-arch, --with-tune, and
+       --with-mode configure options.
+       * config/s390/s390.h (OPTION_DEFAULT_SPECS): Define.
+       (DRIVER_SELF_SPECS): Define.
+       * config/s390/linux.h (ASM_SPEC): Pass architecture mode and cpu
+       architecture to assembler.
+       (LINK_SPEC): Merge 31-bit and 64-bit variants.
+       (LINK_ARCH31_SPEC, LINK_ARCH64_SPEC, EXTRA_SPECS): Remove.
+       * config/s390/s390.c (override_options): New default rules for 
+       architecture mode and cpu architecture selection.
+       * doc/invoke.texi (-mesa, -mzarch, -march, -mtune): Document
+       new default rules.
+       
+       * config/s390/s390.h (enum processor_type): Add PROCESSOR_2084_Z990.
+       * config/s390/s390.md (attr "cpu"): Add "z990" processor type.
+       * config/s390/s390.c (override_options): Add "z990" to 
+       processor_alias_table.
+       * doc/invoke.texi (-march): Document "z990" processor type.
+
+       * config/s390/s390.c (s390_tune_flags, s390_arch_flags): New variables.
+       * config/s390/s390.h (s390_tune_flags, s390_arch_flags): Declare.
+       (enum processor_flags, TARGET_CPU_IEEE_FLOAT, TARGET_CPU_ZARCH,
+       TARGET_CPU_LONG_DISPLACEMENT, TARGET_LONG_DISPLACEMENT): New.
+       * config/s390/s390.c (override_options): Replace enum pta_flags by 
+       enum processor_flags.  Fill in s390_tune_flags and s390_arch_flags.
+
+       * config/s390/s390.c (s390_cpu): Rename to ...
+       (s390_tune): ... this.
+       * config/s390/s390.h (s390_cpu, s390_tune): Likewise.
+       * config/s390/s390.c (s390_issue_rate, override_options): Likewise.
+       * config/s390/s390.md (attr "cpu"): Likewise.
+
 2003-06-30  Neil Booth  <neil@daikokuya.co.uk>
 
        * c-common.c (enum c_language_kind, flag_objc): Remove.
index 78e20e659f5d524d986cb994aaf1473c7fe5e384..688604cda323376ca0bcfccd0cd0c3553676915a 100644 (file)
@@ -2444,6 +2444,35 @@ then
                done
                ;;
 
+       s390*-*-*)
+               supported_defaults="arch mode tune"
+
+               for which in arch tune; do
+                       eval "val=\$with_$which"
+                       case x$val in
+                       x \
+                       | xg5 | xg6 | xz900 | xz990)
+                               # OK
+                               ;;
+                       *)
+                               echo "Unknown cpu used in --with-$which=$val." 1>&2
+                               exit 1
+                               ;;
+                       esac
+               done
+
+               case "x$with_mode" in
+               x \
+               | xesa | xzarch)
+                       # OK
+                       ;;
+               *)
+                       echo "Unknown architecture mode used in --with-mode=$with_mode." 1>&2
+                       exit 1
+                       ;;
+               esac
+               ;;
+
        sparc*-*-*)
                supported_defaults="cpu float tune"
 
@@ -2608,7 +2637,7 @@ then
        esac
 
        t=
-       all_defaults="abi cpu arch tune schedule float"
+       all_defaults="abi cpu arch tune schedule float mode"
        for option in $all_defaults
        do
                eval "val=\$with_$option"
index 83c8247e2f36a6c0fa8d6a8fdace394bebd94850..511ede559df43dcf72e220c1d633e7accc341321 100644 (file)
@@ -69,13 +69,8 @@ Boston, MA 02111-1307, USA.  */
 
 /* Target specific assembler settings.  */
 
-#ifdef DEFAULT_TARGET_64BIT
-#undef  ASM_SPEC
-#define ASM_SPEC "%{m31:-m31 -Aesa}"
-#else
 #undef  ASM_SPEC
-#define ASM_SPEC "%{m64:-m64 -Aesame}"
-#endif
+#define ASM_SPEC "%{m31&m64}%{mesa&mzarch}%{march=*}"
 
 
 /* Target specific linker settings.  */
@@ -86,40 +81,18 @@ Boston, MA 02111-1307, USA.  */
 #define MULTILIB_DEFAULTS { "m31" }
 #endif
 
-#define LINK_ARCH31_SPEC \
-  "-m elf_s390 \
-   %{shared:-shared} \
-   %{!shared: \
-      %{static:-static} \
-      %{!static: \
-       %{rdynamic:-export-dynamic} \
-       %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}}}"
-
-#define LINK_ARCH64_SPEC \
-  "-m elf64_s390 \
+#undef  LINK_SPEC
+#define LINK_SPEC \
+  "%{m31:-m elf_s390}%{m64:-m elf64_s390} \
    %{shared:-shared} \
    %{!shared: \
       %{static:-static} \
       %{!static: \
        %{rdynamic:-export-dynamic} \
-       %{!dynamic-linker:-dynamic-linker /lib/ld64.so.1}}}"
-
-#ifdef DEFAULT_TARGET_64BIT
-#undef  LINK_SPEC
-#define LINK_SPEC "%{m31:%(link_arch31)} %{!m31:%(link_arch64)}"
-#else
-#undef  LINK_SPEC
-#define LINK_SPEC "%{m64:%(link_arch64)} %{!m64:%(link_arch31)}"
-#endif
-
-
-/* This macro defines names of additional specifications to put in the specs
-   that can be used in various specifications like CC1_SPEC.  Its definition
-   is an initializer with a subgrouping for each command option.  */
+       %{!dynamic-linker: \
+          %{m31:-dynamic-linker /lib/ld.so.1} \
+          %{m64:-dynamic-linker /lib/ld64.so.1}}}}"
 
-#define EXTRA_SPECS \
-  { "link_arch31",     LINK_ARCH31_SPEC },     \
-  { "link_arch64",     LINK_ARCH64_SPEC },     \
 
 #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
 
index dc02d229153318cdb114ca7d280e5822de353e89..7e26ecf661f773ddc6edd076c20ea29da175f608 100644 (file)
@@ -157,9 +157,11 @@ struct s390_address
 };
 
 /* Which cpu are we tuning for.  */
-enum processor_type s390_cpu;
+enum processor_type s390_tune;
+enum processor_flags s390_tune_flags;
 /* Which instruction set architecture to use.  */
 enum processor_type s390_arch;
+enum processor_flags s390_arch_flags;
 
 /* Strings to hold which cpu and instruction set architecture  to use.  */
 const char *s390_tune_string;          /* for -mtune=<xxx> */
@@ -925,22 +927,19 @@ void
 override_options ()
 {
   int i;
-  static const char * const cpu_names[] = TARGET_CPU_DEFAULT_NAMES;
   static struct pta
     {
       const char *const name;          /* processor name or nickname.  */
       const enum processor_type processor;
-      const enum pta_flags
-       {
-         PTA_IEEE_FLOAT = 1,
-         PTA_ZARCH = 2
-       } flags;
+      const enum processor_flags flags;
     }
   const processor_alias_table[] =
     {
-      {"g5", PROCESSOR_9672_G5, PTA_IEEE_FLOAT},
-      {"g6", PROCESSOR_9672_G6, PTA_IEEE_FLOAT},
-      {"z900", PROCESSOR_2064_Z900, PTA_IEEE_FLOAT | PTA_ZARCH},
+      {"g5", PROCESSOR_9672_G5, PF_IEEE_FLOAT},
+      {"g6", PROCESSOR_9672_G6, PF_IEEE_FLOAT},
+      {"z900", PROCESSOR_2064_Z900, PF_IEEE_FLOAT | PF_ZARCH},
+      {"z990", PROCESSOR_2084_Z990, PF_IEEE_FLOAT | PF_ZARCH 
+                                   | PF_LONG_DISPLACEMENT},
     };
 
   int const pta_size = ARRAY_SIZE (processor_alias_table);
@@ -950,59 +949,55 @@ override_options ()
 
   /* Set up function hooks.  */
   init_machine_status = s390_init_machine_status;
-  /* Set cpu and arch, if only partially given.  */
-  if (!s390_tune_string && s390_arch_string)
-    s390_tune_string = s390_arch_string;
-  if (!s390_tune_string)
-    s390_tune_string = cpu_names [TARGET_64BIT ? TARGET_CPU_DEFAULT_2064
-                                              :        TARGET_CPU_DEFAULT_9672];
+
+  /* Architecture mode defaults according to ABI.  */
+  if (!(target_flags_explicit & MASK_ZARCH))
+    {
+      if (TARGET_64BIT)
+       target_flags |= MASK_ZARCH;
+      else
+       target_flags &= ~MASK_ZARCH;
+    }
+
+  /* Determine processor architectural level.  */
   if (!s390_arch_string)
-#ifdef DEFAULT_TARGET_64BIT
-    s390_arch_string = "z900";
-#else
-    s390_arch_string = "g5";
-#endif
+    s390_arch_string = TARGET_ZARCH? "z900" : "g5";
 
   for (i = 0; i < pta_size; i++)
     if (! strcmp (s390_arch_string, processor_alias_table[i].name))
       {
        s390_arch = processor_alias_table[i].processor;
-       /* Default cpu tuning to the architecture.  */
-       s390_cpu = s390_arch;
-     
-       if (!(processor_alias_table[i].flags & PTA_ZARCH) 
-            && TARGET_64BIT)
-          error ("64-bit ABI not supported on %s", s390_arch_string);
-
-       if (!(processor_alias_table[i].flags & PTA_ZARCH) 
-            && TARGET_ZARCH)
-          error ("z/Architecture not supported on %s", s390_arch_string);
-
+       s390_arch_flags = processor_alias_table[i].flags;
        break;
       }
-
   if (i == pta_size)
-    error ("bad value (%s) for -march= switch", s390_arch_string);
+    error ("Unknown cpu used in -march=%s.", s390_arch_string);
 
-  /* ESA implies 31 bit mode.  */
-  if ((target_flags_explicit & MASK_ZARCH) && !TARGET_ZARCH)
+  /* Determine processor to tune for.  */
+  if (!s390_tune_string)
     {
-      if ((target_flags_explicit & MASK_64BIT) && TARGET_64BIT)
-       error ("64-bit ABI not possible in ESA/390 mode");
-      else
-       target_flags &= ~MASK_64BIT;
+      s390_tune = s390_arch;
+      s390_tune_flags = s390_arch_flags;
+      s390_tune_string = s390_arch_string;
+    }
+  else
+    {
+      for (i = 0; i < pta_size; i++)
+       if (! strcmp (s390_tune_string, processor_alias_table[i].name))
+         {
+           s390_tune = processor_alias_table[i].processor;
+           s390_tune_flags = processor_alias_table[i].flags;
+           break;
+         }
+      if (i == pta_size)
+       error ("Unknown cpu used in -mtune=%s.", s390_tune_string);
     }
 
-  for (i = 0; i < pta_size; i++)
-    if (! strcmp (s390_tune_string, processor_alias_table[i].name))
-      {
-       s390_cpu = processor_alias_table[i].processor;
-       break;
-      }
-
-  if (i == pta_size)
-    error ("bad value (%s) for -mtune= switch", s390_tune_string);
+  /* Sanity checks.  */
+  if (TARGET_ZARCH && !(s390_arch_flags & PF_ZARCH))
+    error ("z/Architecture mode not supported on %s.", s390_arch_string);
+  if (TARGET_64BIT && !TARGET_ZARCH)
+    error ("64-bit ABI not supported in ESA/390 mode.");
 }
 
 /* Map for smallest class containing reg regno.  */
@@ -3707,7 +3702,7 @@ s390_issue_rate ()
 static int
 s390_use_dfa_pipeline_interface ()
 {
-  if (s390_cpu == PROCESSOR_2064_Z900)
+  if (s390_tune == PROCESSOR_2064_Z900)
     return 1;
   return 0;
 
index 7848d7d971f5ac483eda820ba790be31bb8951c7..70128864d59503786e5ae20e236804f41c5e063f 100644 (file)
@@ -37,19 +37,37 @@ enum processor_type
   PROCESSOR_9672_G5,           
   PROCESSOR_9672_G6,           
   PROCESSOR_2064_Z900,         
+  PROCESSOR_2084_Z990,
   PROCESSOR_max
 };
 
-extern enum processor_type s390_cpu;
+/* Optional architectural facilities supported by the processor.  */
+
+enum processor_flags
+{
+  PF_IEEE_FLOAT = 1,
+  PF_ZARCH = 2,
+  PF_LONG_DISPLACEMENT = 4
+};
+
+extern enum processor_type s390_tune;
+extern enum processor_flags s390_tune_flags;
 extern const char *s390_tune_string;
 
 extern enum processor_type s390_arch;
+extern enum processor_flags s390_arch_flags;
 extern const char *s390_arch_string;
 
-#define TARGET_CPU_DEFAULT_9672 0
-#define TARGET_CPU_DEFAULT_2064 2
+#define TARGET_CPU_IEEE_FLOAT \
+       (s390_arch_flags & PF_IEEE_FLOAT)
+#define TARGET_CPU_ZARCH \
+       (s390_arch_flags & PF_ZARCH)
+#define TARGET_CPU_LONG_DISPLACEMENT \
+       (s390_arch_flags & PF_LONG_DISPLACEMENT)
+
+#define TARGET_LONG_DISPLACEMENT \
+       (TARGET_ZARCH && TARGET_CPU_LONG_DISPLACEMENT)
 
-#define TARGET_CPU_DEFAULT_NAMES {"g5", "g6", "z900"}
 
 /* Run-time target specification.  */
 
@@ -119,6 +137,25 @@ extern int target_flags;
     N_("Generate code for given CPU"), 0},                      \
 }
 
+/* Support for configure-time defaults.  */
+#define OPTION_DEFAULT_SPECS                                   \
+  { "mode", "%{!mesa:%{!mzarch:-m%(VALUE)}}" },                        \
+  { "arch", "%{!march=*:-march=%(VALUE)}" },                   \
+  { "tune", "%{!mtune=*:-mtune=%(VALUE)}" }
+
+/* Defaulting rules.  */
+#ifdef DEFAULT_TARGET_64BIT
+#define DRIVER_SELF_SPECS                                      \
+  "%{!m31:%{!m64:-m64}}",                                      \
+  "%{!mesa:%{!mzarch:%{m31:-mesa}%{m64:-mzarch}}}",            \
+  "%{!march=*:%{mesa:-march=g5}%{mzarch:-march=z900}}"
+#else
+#define DRIVER_SELF_SPECS                                      \
+  "%{!m31:%{!m64:-m31}}",                                      \
+  "%{!mesa:%{!mzarch:%{m31:-mesa}%{m64:-mzarch}}}",            \
+  "%{!march=*:%{mesa:-march=g5}%{mzarch:-march=z900}}"
+#endif
+
 /* Target version string.  Overridden by the OS header.  */
 #ifdef DEFAULT_TARGET_64BIT
 #define TARGET_VERSION fprintf (stderr, " (zSeries)");
index b5a222be1269da678521f8694f78fba2327979be..d061d084833148d1fc7a1de1b84ff281681ab7f1 100644 (file)
@@ -76,8 +76,8 @@
 ;; Processor type.  This attribute must exactly match the processor_type
 ;; enumeration in s390.h.
 
-(define_attr "cpu" "g5,g6,z900"
-  (const (symbol_ref "s390_cpu")))
+(define_attr "cpu" "g5,g6,z900,z990"
+  (const (symbol_ref "s390_tune")))
 
 ;; Define an insn type attribute.  This is used in function unit delay
 ;; computations.
index a751d8e419ff889b9f8f54f7ea21887e4e727adb..184a2d2ed2a285a36aa6ab6559392cef794775e7 100644 (file)
@@ -10134,8 +10134,9 @@ instructions available on z/Architecture.
 When @option{-mesa} is specified, generate code using the 
 instructions available on ESA/390. Note that @option{-mesa} is
 not possible with @option{-m64}.
-For the @samp{s390} targets, the default is @option{-mesa}, 
-while the @samp{s390x} targets default to @option{-mzarch}.
+When generating code compliant to the Linux for S/390 ABI,
+the default is @option{-mesa}.  When generating code compliant
+to the Linux for zSeries ABI, the default is @option{-mzarch}.
 
 @item -mmvcle
 @itemx -mno-mvcle
@@ -10152,17 +10153,21 @@ use a @code{mvc} loop instead.  This is the default.
 Print (or do not print) additional debug information when compiling.
 The default is to not print debug information.
 
-@item -march=@var{arch}
+@item -march=@var{cpu-type}
 @opindex march
-Generate code that will run on @var{arch}, which is the name of system
+Generate code that will run on @var{cpu-type}, which is the name of a system
 representing a certain processor type. Possible values for
-@var{cpu-type} are @samp{g5}, @samp{g6} and @samp{z900}. 
+@var{cpu-type} are @samp{g5}, @samp{g6}, @samp{z900}, and @samp{z990}.
+When generating code using the instructions available on z/Architecture,
+the default is @option{-march=z900}.  Otherwise, the default is
+@option{-march=g5}.
 
-@item -mtune=@var{arch}
+@item -mtune=@var{cpu-type}
 @opindex mtune
 Tune to @var{cpu-type} everything applicable about the generated code,
- except for the ABI and the set of available instructions. 
-The list of @var{arch} values is the same as for @option{-march}.
+except for the ABI and the set of available instructions.
+The list of @var{cpu-type} values is the same as for @option{-march}.
+The default is the value used for @option{-march}.
 
 @end table