With IBM z14 officially announced we can add support for z14 as
preferred CPU name.  We still pass arch12 to Binutils in order to keep
older Binutils versions supported.

Bootstrapped and regression-tested on s390x.

Committed to mainline and GCC 7 branch.

Bye,

-Andreas-


gcc/ChangeLog:

2017-07-31  Andreas Krebbel  <kreb...@linux.vnet.ibm.com>

        * config.gcc: Add z14.
        * config/s390/driver-native.c (s390_host_detect_local_cpu): Add
        CPU model numbers for z13s and z14.
        * config/s390/s390-c.c (s390_resolve_overloaded_builtin): Replace
        arch12 with z14.
        * config/s390/s390-opts.h (enum processor_type): Rename
        PROCESSOR_ARCH12 to PROCESSOR_3906_Z14.
        * config/s390/s390.c (processor_table): Add field for CPU name to
        be passed to Binutils.
        (s390_asm_output_machine_for_arch): Use the new field in
        processor_table for Binutils.
        (s390_expand_builtin): Replace arch12 with z14.
        (s390_issue_rate): Rename PROCESSOR_ARCH12 to PROCESSOR_3906_Z14.
        (s390_get_sched_attrmask): Likewise.
        (s390_get_unit_mask): Likewise.
        * config/s390/s390.opt: Add z14 to processor_type enum.
---
 gcc/config.gcc                  |  2 +-
 gcc/config/s390/driver-native.c |  6 +++++-
 gcc/config/s390/s390-c.c        |  4 ++--
 gcc/config/s390/s390-opts.h     |  2 +-
 gcc/config/s390/s390.c          | 38 +++++++++++++++++++++-----------------
 gcc/config/s390/s390.opt        |  5 ++++-
 6 files changed, 34 insertions(+), 23 deletions(-)

diff --git a/gcc/config.gcc b/gcc/config.gcc
index 9196843..a9196cd 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -4336,7 +4336,7 @@ case "${target}" in
                for which in arch tune; do
                        eval "val=\$with_$which"
                        case ${val} in
-                       "" | native | g5 | g6 | z900 | z990 | z9-109 | z9-ec | 
z10 | z196 | zEC12 | z13 | arch3 | arch5 | arch6 | arch7 | arch8 | arch9 | 
arch10 | arch11 | arch12)
+                       "" | native | g5 | g6 | z900 | z990 | z9-109 | z9-ec | 
z10 | z196 | zEC12 | z13 | z14 | arch3 | arch5 | arch6 | arch7 | arch8 | arch9 
| arch10 | arch11 | arch12)
                                # OK
                                ;;
                        *)
diff --git a/gcc/config/s390/driver-native.c b/gcc/config/s390/driver-native.c
index 4bcddb4..acb9836 100644
--- a/gcc/config/s390/driver-native.c
+++ b/gcc/config/s390/driver-native.c
@@ -112,10 +112,14 @@ s390_host_detect_local_cpu (int argc, const char **argv)
              cpu = "zEC12";
              break;
            case 0x2964:
+           case 0x2965:
              cpu = "z13";
              break;
+           case 0x3906:
+             cpu = "z14";
+             break;
            default:
-             cpu = "arch12";
+             cpu = "z14";
              break;
            }
        }
diff --git a/gcc/config/s390/s390-c.c b/gcc/config/s390/s390-c.c
index 35c3545..07224ad 100644
--- a/gcc/config/s390/s390-c.c
+++ b/gcc/config/s390/s390-c.c
@@ -886,7 +886,7 @@ s390_resolve_overloaded_builtin (location_t loc,
 
   if (!TARGET_VXE && (ob_flags & B_VXE))
     {
-      error_at (loc, "%qF requires -march=arch12 or higher", ob_fndecl);
+      error_at (loc, "%qF requires z14 or higher", ob_fndecl);
       return error_mark_node;
     }
 
@@ -963,7 +963,7 @@ s390_resolve_overloaded_builtin (location_t loc,
   if (!TARGET_VXE
       && bflags_overloaded_builtin_var[last_match_index] & B_VXE)
     {
-      error_at (loc, "%qs matching variant requires -march=arch12 or higher",
+      error_at (loc, "%qs matching variant requires z14 or higher",
                IDENTIFIER_POINTER (DECL_NAME (ob_fndecl)));
       return error_mark_node;
     }
diff --git a/gcc/config/s390/s390-opts.h b/gcc/config/s390/s390-opts.h
index 65ac4f8..6d506e2 100644
--- a/gcc/config/s390/s390-opts.h
+++ b/gcc/config/s390/s390-opts.h
@@ -38,7 +38,7 @@ enum processor_type
   PROCESSOR_2817_Z196,
   PROCESSOR_2827_ZEC12,
   PROCESSOR_2964_Z13,
-  PROCESSOR_ARCH12,
+  PROCESSOR_3906_Z14,
   PROCESSOR_NATIVE,
   PROCESSOR_max
 };
diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index 7be22d9..c408d59 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -318,24 +318,27 @@ struct processor_costs zEC12_cost =
 
 static struct
 {
+  /* The preferred name to be used in user visible output.  */
   const char *const name;
+  /* CPU name as it should be passed to Binutils via .machine  */
+  const char *const binutils_name;
   const enum processor_type processor;
   const struct processor_costs *cost;
 }
 const processor_table[] =
 {
-  { "g5",     PROCESSOR_9672_G5,     &z900_cost },
-  { "g6",     PROCESSOR_9672_G6,     &z900_cost },
-  { "z900",   PROCESSOR_2064_Z900,   &z900_cost },
-  { "z990",   PROCESSOR_2084_Z990,   &z990_cost },
-  { "z9-109", PROCESSOR_2094_Z9_109, &z9_109_cost },
-  { "z9-ec",  PROCESSOR_2094_Z9_EC,  &z9_109_cost },
-  { "z10",    PROCESSOR_2097_Z10,    &z10_cost },
-  { "z196",   PROCESSOR_2817_Z196,   &z196_cost },
-  { "zEC12",  PROCESSOR_2827_ZEC12,  &zEC12_cost },
-  { "z13",    PROCESSOR_2964_Z13,    &zEC12_cost },
-  { "arch12", PROCESSOR_ARCH12,      &zEC12_cost },
-  { "native", PROCESSOR_NATIVE,      NULL }
+  { "g5",     "g5",     PROCESSOR_9672_G5,     &z900_cost },
+  { "g6",     "g6",     PROCESSOR_9672_G6,     &z900_cost },
+  { "z900",   "z900",   PROCESSOR_2064_Z900,   &z900_cost },
+  { "z990",   "z990",   PROCESSOR_2084_Z990,   &z990_cost },
+  { "z9-109", "z9-109", PROCESSOR_2094_Z9_109, &z9_109_cost },
+  { "z9-ec",  "z9-ec",  PROCESSOR_2094_Z9_EC,  &z9_109_cost },
+  { "z10",    "z10",    PROCESSOR_2097_Z10,    &z10_cost },
+  { "z196",   "z196",   PROCESSOR_2817_Z196,   &z196_cost },
+  { "zEC12",  "zEC12",  PROCESSOR_2827_ZEC12,  &zEC12_cost },
+  { "z13",    "z13",    PROCESSOR_2964_Z13,    &zEC12_cost },
+  { "z14",    "arch12", PROCESSOR_3906_Z14,    &zEC12_cost },
+  { "native", "",       PROCESSOR_NATIVE,      NULL }
 };
 
 extern int reload_completed;
@@ -847,7 +850,7 @@ s390_expand_builtin (tree exp, rtx target, rtx subtarget 
ATTRIBUTE_UNUSED,
 
       if ((bflags & B_VXE) && !TARGET_VXE)
        {
-         error ("Builtin %qF requires arch12 or higher.", fndecl);
+         error ("Builtin %qF requires z14 or higher.", fndecl);
          return const0_rtx;
        }
     }
@@ -7282,7 +7285,8 @@ s390_asm_output_machine_for_arch (FILE *asm_out_file)
 {
   fprintf (asm_out_file, "\t.machinemode %s\n",
           (TARGET_ZARCH) ? "zarch" : "esa");
-  fprintf (asm_out_file, "\t.machine \"%s", processor_table[s390_arch].name);
+  fprintf (asm_out_file, "\t.machine \"%s",
+          processor_table[s390_arch].binutils_name);
   if (S390_USE_ARCHITECTURE_MODIFIERS)
     {
       int cpu_flags;
@@ -8016,7 +8020,7 @@ s390_issue_rate (void)
         instruction gets issued per cycle.  */
     case PROCESSOR_2827_ZEC12:
     case PROCESSOR_2964_Z13:
-    case PROCESSOR_ARCH12:
+    case PROCESSOR_3906_Z14:
     default:
       return 1;
     }
@@ -14237,7 +14241,7 @@ s390_get_sched_attrmask (rtx_insn *insn)
        mask |= S390_SCHED_ATTR_MASK_GROUPALONE;
       break;
     case PROCESSOR_2964_Z13:
-    case PROCESSOR_ARCH12:
+    case PROCESSOR_3906_Z14:
       if (get_attr_z13_cracked (insn))
        mask |= S390_SCHED_ATTR_MASK_CRACKED;
       if (get_attr_z13_expanded (insn))
@@ -14261,7 +14265,7 @@ s390_get_unit_mask (rtx_insn *insn, int *units)
   switch (s390_tune)
     {
     case PROCESSOR_2964_Z13:
-    case PROCESSOR_ARCH12:
+    case PROCESSOR_3906_Z14:
       *units = 3;
       if (get_attr_z13_unit_lsu (insn))
        mask |= 1 << 0;
diff --git a/gcc/config/s390/s390.opt b/gcc/config/s390/s390.opt
index d0a0d46..28ba631 100644
--- a/gcc/config/s390/s390.opt
+++ b/gcc/config/s390/s390.opt
@@ -113,7 +113,10 @@ EnumValue
 Enum(processor_type) String(arch11) Value(PROCESSOR_2964_Z13)
 
 EnumValue
-Enum(processor_type) String(arch12) Value(PROCESSOR_ARCH12)
+Enum(processor_type) String(z14) Value(PROCESSOR_3906_Z14)
+
+EnumValue
+Enum(processor_type) String(arch12) Value(PROCESSOR_3906_Z14)
 
 EnumValue
 Enum(processor_type) String(native) Value(PROCESSOR_NATIVE) DriverOnly
-- 
2.9.1

Reply via email to