public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 7/7] S/390: Tune scheduling parameters.
  2019-03-11 12:53 [PATCH 0/7] S/390: Rework instruction scheduling Robin Dapp
@ 2019-03-11 12:53 ` Robin Dapp
  2019-03-11 12:53 ` [PATCH 4/7] S/390: Change handling of group end Robin Dapp
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Robin Dapp @ 2019-03-11 12:53 UTC (permalink / raw)
  To: gcc-patches; +Cc: krebbel, iii, rdapp

This patch adapts some scheduling-related parameters.

---
 gcc/config/s390/s390.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index 78a707267e8..901807e7833 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -358,12 +358,12 @@ static int fpd_longrunning[NUM_SIDES];
    in use for MAX_SCHED_MIX_DISTANCE steps.  Increase this value to
    give instruction mix scheduling more priority over instruction
    grouping.  */
-#define MAX_SCHED_MIX_SCORE      8
+#define MAX_SCHED_MIX_SCORE      2
 
 /* The maximum distance up to which individual scores will be
    calculated.  Everything beyond this gives MAX_SCHED_MIX_SCORE.
    Increase this with the OOO windows size of the machine.  */
-#define MAX_SCHED_MIX_DISTANCE 100
+#define MAX_SCHED_MIX_DISTANCE 70
 
 /* Structure used to hold the components of a S/390 memory
    address.  A legitimate address on S/390 is of the general
@@ -14238,7 +14238,7 @@ s390_z10_prevent_earlyload_conflicts (rtx_insn **ready, int *nready_p)
 }
 
 /* Returns TRUE if BB is entered via a fallthru edge and all other
-   incoming edges are less than unlikely.  */
+   incoming edges are less than likely.  */
 static bool
 s390_bb_fallthru_entry_likely (basic_block bb)
 {
@@ -14254,7 +14254,7 @@ s390_bb_fallthru_entry_likely (basic_block bb)
 
   FOR_EACH_EDGE (e, ei, bb->preds)
     if (e != fallthru_edge
-	&& e->probability >= profile_probability::unlikely ())
+	&& e->probability >= profile_probability::likely ())
       return false;
 
   return true;
@@ -14390,7 +14390,7 @@ s390_sched_score (rtx_insn *insn)
 	score += 5;
       if ((mask & S390_SCHED_ATTR_MASK_GROUPALONE) != 0)
 	score += 10;
-      /* fallthrough */
+      break;
     case 1:
       /* Prefer not cracked insns while trying to put together a
 	 group.  */
-- 
2.17.0

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 3/7] S/390: Change handling of long-running instructions.
  2019-03-11 12:53 [PATCH 0/7] S/390: Rework instruction scheduling Robin Dapp
                   ` (3 preceding siblings ...)
  2019-03-11 12:53 ` [PATCH 2/7] S/390: Add z14 pipeline description Robin Dapp
@ 2019-03-11 12:53 ` Robin Dapp
  2019-03-11 12:53 ` [PATCH 1/7] S/390: Change z13 pipeline description Robin Dapp
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Robin Dapp @ 2019-03-11 12:53 UTC (permalink / raw)
  To: gcc-patches; +Cc: krebbel, iii, rdapp

This patch makes the detection of long-running instructions
independent of their latency and checks the execution unit
instead.

---
 gcc/config/s390/s390.c | 73 +++++++++++++++++++++++++++++++-----------
 1 file changed, 55 insertions(+), 18 deletions(-)

diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index 95a4460dcf5..15926ec88cd 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -349,12 +349,11 @@ static int last_scheduled_unit_distance[MAX_SCHED_UNITS];
 
 #define NUM_SIDES 2
 static int current_side = 1;
-#define LONGRUNNING_THRESHOLD 20
 
 /* Estimate of number of cycles a long-running insn occupies an
    execution unit.  */
-static unsigned fxd_longrunning[NUM_SIDES];
-static unsigned fpd_longrunning[NUM_SIDES];
+static int fxd_longrunning[NUM_SIDES];
+static int fpd_longrunning[NUM_SIDES];
 
 /* The maximum score added for an instruction whose unit hasn't been
    in use for MAX_SCHED_MIX_DISTANCE steps.  Increase this value to
@@ -14357,6 +14356,17 @@ s390_get_unit_mask (rtx_insn *insn, int *units)
   return mask;
 }
 
+/* Returns TRUE if INSN is a long-running instruction.  */
+static bool
+s390_is_longrunning (rtx_insn *insn)
+{
+  if (insn == NULL_RTX)
+    return false;
+
+  return get_attr_z13_unit_fxd (insn) || get_attr_z13_unit_fpd (insn)
+    || get_attr_z14_unit_fxd (insn) || get_attr_z14_unit_fpd (insn);
+}
+
 /* Return the scheduling score for INSN.  The higher the score the
    better.  The score is calculated from the OOO scheduling attributes
    of INSN and the scheduling state s390_sched_state.  */
@@ -14432,20 +14442,48 @@ s390_sched_score (rtx_insn *insn)
 	  score += (last_scheduled_unit_distance[i] * MAX_SCHED_MIX_SCORE /
 		    MAX_SCHED_MIX_DISTANCE);
 
-      unsigned latency = insn_default_latency (insn);
-
       int other_side = 1 - current_side;
 
       /* Try to delay long-running insns when side is busy.  */
-      if (latency > LONGRUNNING_THRESHOLD)
+      if (s390_is_longrunning (insn))
 	{
-	  if (get_attr_z13_unit_fxu (insn) && fxd_longrunning[current_side]
-	      && fxd_longrunning[other_side] <= fxd_longrunning[current_side])
-	    score = MAX (0, score - 10);
+	  if (s390_tune == PROCESSOR_2964_Z13)
+	    {
+	      if (get_attr_z13_unit_fxd (insn) && fxd_longrunning[current_side]
+		  && fxd_longrunning[other_side] <= fxd_longrunning[current_side])
+		score = MAX (0, score - 10);
 
-	  if (get_attr_z13_unit_vfu (insn) && fpd_longrunning[current_side]
-	      && fpd_longrunning[other_side] <= fpd_longrunning[current_side])
-	    score = MAX (0, score - 10);
+	      if (get_attr_z13_unit_fxd (insn)
+		  && fxd_longrunning[other_side] >= fxd_longrunning[current_side])
+		score += 10;
+
+	      if (get_attr_z13_unit_fpd (insn) && fpd_longrunning[current_side]
+		  && fpd_longrunning[other_side] <= fpd_longrunning[current_side])
+		score = MAX (0, score - 10);
+
+	      if (get_attr_z13_unit_fpd (insn)
+		  && fpd_longrunning[other_side] >= fpd_longrunning[current_side])
+		score += 10;
+	    }
+
+	  if (s390_tune == PROCESSOR_3906_Z14)
+	    {
+	      if (get_attr_z14_unit_fxd (insn) && fxd_longrunning[current_side]
+		  && fxd_longrunning[other_side] <= fxd_longrunning[current_side])
+		score = MAX (0, score - 10);
+
+	      if (get_attr_z14_unit_fxd (insn)
+		  && fxd_longrunning[other_side] >= fxd_longrunning[current_side])
+		score += 10;
+
+	      if (get_attr_z14_unit_fpd (insn) && fpd_longrunning[current_side]
+		  && fpd_longrunning[other_side] <= fpd_longrunning[current_side])
+		score = MAX (0, score - 10);
+
+	      if (get_attr_z14_unit_fpd (insn)
+		  && fpd_longrunning[other_side] >= fpd_longrunning[current_side])
+		score += 10;
+	    }
 	}
     }
 
@@ -14629,16 +14667,15 @@ s390_sched_variable_issue (FILE *file, int verbose, rtx_insn *insn, int more)
 
       for (int i = 0; i < 2; i++)
 	{
-	  if (fxd_longrunning[i] >= 1)
-	    fxd_longrunning[i] -= 1;
-	  if (fpd_longrunning[i] >= 1)
-	    fpd_longrunning[i] -= 1;
+	  fxd_longrunning[i] = MAX (0, fxd_longrunning[i] - 1);
+	  fpd_longrunning[i] = MAX (0, fpd_longrunning[i] - 1);
 	}
 
       unsigned latency = insn_default_latency (insn);
-      if (latency > LONGRUNNING_THRESHOLD)
+      if (s390_is_longrunning (insn))
 	{
-	  if (get_attr_z13_unit_fxu (insn))
+	  if (get_attr_z13_unit_fxd (insn)
+	      || get_attr_z14_unit_fxd (insn))
 	    fxd_longrunning[current_side] = latency;
 	  else
 	    fpd_longrunning[current_side] = latency;
-- 
2.17.0

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 0/7] S/390: Rework instruction scheduling.
@ 2019-03-11 12:53 Robin Dapp
  2019-03-11 12:53 ` [PATCH 7/7] S/390: Tune scheduling parameters Robin Dapp
                   ` (7 more replies)
  0 siblings, 8 replies; 13+ messages in thread
From: Robin Dapp @ 2019-03-11 12:53 UTC (permalink / raw)
  To: gcc-patches; +Cc: krebbel, iii, rdapp

Hi,

this patch set adds new pipeline descriptions for z13 and z14.  Based
on that, the scoring and some properties are handled differently in
the scheduler hooks.

Regards
 Robin

Robin Dapp (7):
  S/390: Change z13 pipeline description.
  S/390: Add z14 pipeline description.
  S/390: Change handling of long-running instructions.
  S/390: Change handling of group end.
  S/390: Add side to schedule-mix calculations.
  S/390: Add handling for group-of-two instructions.
  S/390: Tune scheduling parameters.

 gcc/config/s390/2964.md | 373 ++++++++++++++++++++++------------------
 gcc/config/s390/3906.md | 281 ++++++++++++++++++++++++++++++
 gcc/config/s390/s390.c  | 303 +++++++++++++++++++-------------
 gcc/config/s390/s390.h  |   2 +-
 gcc/config/s390/s390.md |   3 +
 5 files changed, 679 insertions(+), 283 deletions(-)
 create mode 100644 gcc/config/s390/3906.md

-- 
2.17.0

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 4/7] S/390: Change handling of group end.
  2019-03-11 12:53 [PATCH 0/7] S/390: Rework instruction scheduling Robin Dapp
  2019-03-11 12:53 ` [PATCH 7/7] S/390: Tune scheduling parameters Robin Dapp
@ 2019-03-11 12:53 ` Robin Dapp
  2019-03-11 12:53 ` [PATCH 6/7] S/390: Add handling for group-of-two instructions Robin Dapp
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Robin Dapp @ 2019-03-11 12:53 UTC (permalink / raw)
  To: gcc-patches; +Cc: krebbel, iii, rdapp

This patch adds a scheduling state struct and changes
the handling of end-group conditions.

---
 gcc/config/s390/s390.c | 158 ++++++++++++++++++-----------------------
 1 file changed, 68 insertions(+), 90 deletions(-)

diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index 15926ec88cd..249df00268a 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -348,7 +348,6 @@ static rtx_insn *last_scheduled_insn;
 static int last_scheduled_unit_distance[MAX_SCHED_UNITS];
 
 #define NUM_SIDES 2
-static int current_side = 1;
 
 /* Estimate of number of cycles a long-running insn occupies an
    execution unit.  */
@@ -14261,17 +14260,15 @@ s390_bb_fallthru_entry_likely (basic_block bb)
   return true;
 }
 
-/* The s390_sched_state variable tracks the state of the current or
-   the last instruction group.
-
-   0,1,2 number of instructions scheduled in the current group
-   3     the last group is complete - normal insns
-   4     the last group was a cracked/expanded insn */
-
-static int s390_sched_state = 0;
+struct s390_sched_state
+{
+  /* Number of insns in the group.  */
+  int group_state;
+  /* Execution side of the group.  */
+  int side;
+} s390_sched_state;
 
-#define S390_SCHED_STATE_NORMAL  3
-#define S390_SCHED_STATE_CRACKED 4
+static struct s390_sched_state sched_state = {0, 1};
 
 #define S390_SCHED_ATTR_MASK_CRACKED    0x1
 #define S390_SCHED_ATTR_MASK_EXPANDED   0x2
@@ -14369,14 +14366,14 @@ s390_is_longrunning (rtx_insn *insn)
 
 /* Return the scheduling score for INSN.  The higher the score the
    better.  The score is calculated from the OOO scheduling attributes
-   of INSN and the scheduling state s390_sched_state.  */
+   of INSN and the scheduling state sched_state.  */
 static int
 s390_sched_score (rtx_insn *insn)
 {
   unsigned int mask = s390_get_sched_attrmask (insn);
   int score = 0;
 
-  switch (s390_sched_state)
+  switch (sched_state.group_state)
     {
     case 0:
       /* Try to put insns into the first slot which would otherwise
@@ -14408,21 +14405,6 @@ s390_sched_score (rtx_insn *insn)
       if ((mask & S390_SCHED_ATTR_MASK_ENDGROUP) != 0)
 	score += 10;
       break;
-    case S390_SCHED_STATE_NORMAL:
-      /* Prefer not cracked insns if the last was not cracked.  */
-      if ((mask & S390_SCHED_ATTR_MASK_CRACKED) == 0
-	  && (mask & S390_SCHED_ATTR_MASK_EXPANDED) == 0)
-	score += 5;
-      if ((mask & S390_SCHED_ATTR_MASK_GROUPALONE) != 0)
-	score += 10;
-      break;
-    case S390_SCHED_STATE_CRACKED:
-      /* Try to keep cracked insns together to prevent them from
-	 interrupting groups.  */
-      if ((mask & S390_SCHED_ATTR_MASK_CRACKED) != 0
-	  || (mask & S390_SCHED_ATTR_MASK_EXPANDED) != 0)
-	score += 5;
-      break;
     }
 
   if (s390_tune >= PROCESSOR_2964_Z13)
@@ -14442,46 +14424,46 @@ s390_sched_score (rtx_insn *insn)
 	  score += (last_scheduled_unit_distance[i] * MAX_SCHED_MIX_SCORE /
 		    MAX_SCHED_MIX_DISTANCE);
 
-      int other_side = 1 - current_side;
+      int other_side = 1 - sched_state.side;
 
       /* Try to delay long-running insns when side is busy.  */
       if (s390_is_longrunning (insn))
 	{
 	  if (s390_tune == PROCESSOR_2964_Z13)
 	    {
-	      if (get_attr_z13_unit_fxd (insn) && fxd_longrunning[current_side]
-		  && fxd_longrunning[other_side] <= fxd_longrunning[current_side])
+	      if (get_attr_z13_unit_fxd (insn) && fxd_longrunning[sched_state.side]
+		  && fxd_longrunning[other_side] <= fxd_longrunning[sched_state.side])
 		score = MAX (0, score - 10);
 
 	      if (get_attr_z13_unit_fxd (insn)
-		  && fxd_longrunning[other_side] >= fxd_longrunning[current_side])
+		  && fxd_longrunning[other_side] >= fxd_longrunning[sched_state.side])
 		score += 10;
 
-	      if (get_attr_z13_unit_fpd (insn) && fpd_longrunning[current_side]
-		  && fpd_longrunning[other_side] <= fpd_longrunning[current_side])
+	      if (get_attr_z13_unit_fpd (insn) && fpd_longrunning[sched_state.side]
+		  && fpd_longrunning[other_side] <= fpd_longrunning[sched_state.side])
 		score = MAX (0, score - 10);
 
 	      if (get_attr_z13_unit_fpd (insn)
-		  && fpd_longrunning[other_side] >= fpd_longrunning[current_side])
+		  && fpd_longrunning[other_side] >= fpd_longrunning[sched_state.side])
 		score += 10;
 	    }
 
 	  if (s390_tune == PROCESSOR_3906_Z14)
 	    {
-	      if (get_attr_z14_unit_fxd (insn) && fxd_longrunning[current_side]
-		  && fxd_longrunning[other_side] <= fxd_longrunning[current_side])
+	      if (get_attr_z14_unit_fxd (insn) && fxd_longrunning[sched_state.side]
+		  && fxd_longrunning[other_side] <= fxd_longrunning[sched_state.side])
 		score = MAX (0, score - 10);
 
 	      if (get_attr_z14_unit_fxd (insn)
-		  && fxd_longrunning[other_side] >= fxd_longrunning[current_side])
+		  && fxd_longrunning[other_side] >= fxd_longrunning[sched_state.side])
 		score += 10;
 
-	      if (get_attr_z14_unit_fpd (insn) && fpd_longrunning[current_side]
-		  && fpd_longrunning[other_side] <= fpd_longrunning[current_side])
+	      if (get_attr_z14_unit_fpd (insn) && fpd_longrunning[sched_state.side]
+		  && fpd_longrunning[other_side] <= fpd_longrunning[sched_state.side])
 		score = MAX (0, score - 10);
 
 	      if (get_attr_z14_unit_fpd (insn)
-		  && fpd_longrunning[other_side] >= fpd_longrunning[current_side])
+		  && fpd_longrunning[other_side] >= fpd_longrunning[sched_state.side])
 		score += 10;
 	    }
 	}
@@ -14554,7 +14536,7 @@ s390_sched_reorder (FILE *file, int verbose,
       if (verbose > 5)
 	{
 	  fprintf (file, "ready list ooo attributes - sched state: %d\n",
-		   s390_sched_state);
+		   sched_state.group_state);
 
 	  for (i = last_index; i >= 0; i--)
 	    {
@@ -14605,7 +14587,7 @@ s390_sched_variable_issue (FILE *file, int verbose, rtx_insn *insn, int more)
 {
   last_scheduled_insn = insn;
 
-  bool starts_group = false;
+  bool ends_group = false;
 
   if (s390_tune >= PROCESSOR_2827_ZEC12
       && reload_completed
@@ -14613,37 +14595,21 @@ s390_sched_variable_issue (FILE *file, int verbose, rtx_insn *insn, int more)
     {
       unsigned int mask = s390_get_sched_attrmask (insn);
 
-      if ((mask & S390_SCHED_ATTR_MASK_CRACKED) != 0
-	  || (mask & S390_SCHED_ATTR_MASK_EXPANDED) != 0
-	  || (mask & S390_SCHED_ATTR_MASK_GROUPALONE) != 0)
-	starts_group = true;
+      /* Longrunning and side bookkeeping.  */
+      for (int i = 0; i < 2; i++)
+	{
+	  fxd_longrunning[i] = MAX (0, fxd_longrunning[i] - 1);
+	  fpd_longrunning[i] = MAX (0, fpd_longrunning[i] - 1);
+	}
 
-      if ((mask & S390_SCHED_ATTR_MASK_CRACKED) != 0
-	  || (mask & S390_SCHED_ATTR_MASK_EXPANDED) != 0)
-	s390_sched_state = S390_SCHED_STATE_CRACKED;
-      else if ((mask & S390_SCHED_ATTR_MASK_ENDGROUP) != 0
-	       || (mask & S390_SCHED_ATTR_MASK_GROUPALONE) != 0)
-	s390_sched_state = S390_SCHED_STATE_NORMAL;
-      else
+      unsigned latency = insn_default_latency (insn);
+      if (s390_is_longrunning (insn))
 	{
-	  /* Only normal insns are left (mask == 0).  */
-	  switch (s390_sched_state)
-	    {
-	    case 0:
-	      starts_group = true;
-	      /* fallthrough */
-	    case 1:
-	    case 2:
-	      s390_sched_state++;
-	      break;
-	    case S390_SCHED_STATE_NORMAL:
-	      starts_group = true;
-	      s390_sched_state = 1;
-	      break;
-	    case S390_SCHED_STATE_CRACKED:
-	      s390_sched_state = S390_SCHED_STATE_NORMAL;
-	      break;
-	    }
+	  if (get_attr_z13_unit_fxd (insn)
+	      || get_attr_z14_unit_fxd (insn))
+	    fxd_longrunning[sched_state.side] = latency;
+	  else
+	    fpd_longrunning[sched_state.side] = latency;
 	}
 
       if (s390_tune >= PROCESSOR_2964_Z13)
@@ -14661,24 +14627,29 @@ s390_sched_variable_issue (FILE *file, int verbose, rtx_insn *insn, int more)
 	      last_scheduled_unit_distance[i]++;
 	}
 
-      /* If this insn started a new group, the side flipped.  */
-      if (starts_group)
-	current_side = current_side ? 0 : 1;
-
-      for (int i = 0; i < 2; i++)
+      if ((mask & S390_SCHED_ATTR_MASK_CRACKED) != 0
+	  || (mask & S390_SCHED_ATTR_MASK_EXPANDED) != 0
+	  || (mask & S390_SCHED_ATTR_MASK_GROUPALONE) != 0
+	  || (mask & S390_SCHED_ATTR_MASK_ENDGROUP) != 0)
 	{
-	  fxd_longrunning[i] = MAX (0, fxd_longrunning[i] - 1);
-	  fpd_longrunning[i] = MAX (0, fpd_longrunning[i] - 1);
+	  sched_state.group_state = 0;
+	  ends_group = true;
 	}
-
-      unsigned latency = insn_default_latency (insn);
-      if (s390_is_longrunning (insn))
+      else
 	{
-	  if (get_attr_z13_unit_fxd (insn)
-	      || get_attr_z14_unit_fxd (insn))
-	    fxd_longrunning[current_side] = latency;
-	  else
-	    fpd_longrunning[current_side] = latency;
+	  switch (sched_state.group_state)
+	    {
+	    case 0:
+	      sched_state.group_state++;
+	      break;
+	    case 1:
+	      sched_state.group_state++;
+	      break;
+	    case 2:
+	      sched_state.group_state++;
+	      ends_group = true;
+	      break;
+	    }
 	}
 
       if (verbose > 5)
@@ -14707,7 +14678,7 @@ s390_sched_variable_issue (FILE *file, int verbose, rtx_insn *insn, int more)
 		  fprintf (file, " %d", j);
 	      fprintf (file, ")");
 	    }
-	  fprintf (file, " sched state: %d\n", s390_sched_state);
+	  fprintf (file, " sched state: %d\n", sched_state.group_state);
 
 	  if (s390_tune >= PROCESSOR_2964_Z13)
 	    {
@@ -14721,6 +14692,13 @@ s390_sched_variable_issue (FILE *file, int verbose, rtx_insn *insn, int more)
 	      fprintf (file, "\n");
 	    }
 	}
+
+      /* If this insn ended a group, the next will be on the other side.  */
+      if (ends_group)
+	{
+	  sched_state.group_state = 0;
+	  sched_state.side = sched_state.side ? 0 : 1;
+	}
     }
 
   if (GET_CODE (PATTERN (insn)) != USE
@@ -14741,7 +14719,7 @@ s390_sched_init (FILE *file ATTRIBUTE_UNUSED,
   /* If the next basic block is most likely entered via a fallthru edge
      we keep the last sched state.  Otherwise we start a new group.
      The scheduler traverses basic blocks in "instruction stream" ordering
-     so if we see a fallthru edge here, s390_sched_state will be of its
+     so if we see a fallthru edge here, sched_state will be of its
      source block.
 
      current_sched_info->prev_head is the insn before the first insn of the
@@ -14751,7 +14729,7 @@ s390_sched_init (FILE *file ATTRIBUTE_UNUSED,
     ? NEXT_INSN (current_sched_info->prev_head) : NULL;
   basic_block bb = insn ? BLOCK_FOR_INSN (insn) : NULL;
   if (s390_tune < PROCESSOR_2964_Z13 || !s390_bb_fallthru_entry_likely (bb))
-    s390_sched_state = 0;
+    sched_state.group_state = 0;
 }
 
 /* This target hook implementation for TARGET_LOOP_UNROLL_ADJUST calculates
-- 
2.17.0

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 6/7] S/390: Add handling for group-of-two instructions.
  2019-03-11 12:53 [PATCH 0/7] S/390: Rework instruction scheduling Robin Dapp
  2019-03-11 12:53 ` [PATCH 7/7] S/390: Tune scheduling parameters Robin Dapp
  2019-03-11 12:53 ` [PATCH 4/7] S/390: Change handling of group end Robin Dapp
@ 2019-03-11 12:53 ` Robin Dapp
  2019-03-11 12:53 ` [PATCH 2/7] S/390: Add z14 pipeline description Robin Dapp
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Robin Dapp @ 2019-03-11 12:53 UTC (permalink / raw)
  To: gcc-patches; +Cc: krebbel, iii, rdapp

This patch adds handling of group-of-two instructions.

---
 gcc/config/s390/s390.c | 36 +++++++++++++++++++++++++++++++++++-
 1 file changed, 35 insertions(+), 1 deletion(-)

diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index 4dcf1be4445..78a707267e8 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -14266,14 +14266,17 @@ struct s390_sched_state
   int group_state;
   /* Execution side of the group.  */
   int side;
+  /* Group can only hold two insns.  */
+  bool group_of_two;
 } s390_sched_state;
 
-static struct s390_sched_state sched_state = {0, 1};
+static struct s390_sched_state sched_state = {0, 1, false};
 
 #define S390_SCHED_ATTR_MASK_CRACKED    0x1
 #define S390_SCHED_ATTR_MASK_EXPANDED   0x2
 #define S390_SCHED_ATTR_MASK_ENDGROUP   0x4
 #define S390_SCHED_ATTR_MASK_GROUPALONE 0x8
+#define S390_SCHED_ATTR_MASK_GROUPOFTWO 0x10
 
 static unsigned int
 s390_get_sched_attrmask (rtx_insn *insn)
@@ -14301,6 +14304,8 @@ s390_get_sched_attrmask (rtx_insn *insn)
 	mask |= S390_SCHED_ATTR_MASK_ENDGROUP;
       if (get_attr_z13_groupalone (insn))
 	mask |= S390_SCHED_ATTR_MASK_GROUPALONE;
+      if (get_attr_z13_groupoftwo (insn))
+	mask |= S390_SCHED_ATTR_MASK_GROUPOFTWO;
       break;
     case PROCESSOR_3906_Z14:
       if (get_attr_z14_cracked (insn))
@@ -14311,6 +14316,8 @@ s390_get_sched_attrmask (rtx_insn *insn)
 	mask |= S390_SCHED_ATTR_MASK_ENDGROUP;
       if (get_attr_z14_groupalone (insn))
 	mask |= S390_SCHED_ATTR_MASK_GROUPALONE;
+      if (get_attr_z14_groupoftwo (insn))
+	mask |= S390_SCHED_ATTR_MASK_GROUPOFTWO;
       break;
     default:
       gcc_unreachable ();
@@ -14393,6 +14400,11 @@ s390_sched_score (rtx_insn *insn)
 	score += 10;
       if ((mask & S390_SCHED_ATTR_MASK_ENDGROUP) == 0)
 	score += 5;
+      /* If we are in a group of two already, try to schedule another
+	 group-of-two insn to avoid shortening another group.  */
+      if (sched_state.group_of_two
+	  && (mask & S390_SCHED_ATTR_MASK_GROUPOFTWO) != 0)
+	score += 15;
       break;
     case 2:
       /* Prefer not cracked insns while trying to put together a
@@ -14404,6 +14416,10 @@ s390_sched_score (rtx_insn *insn)
       /* Prefer endgroup insns in the last slot.  */
       if ((mask & S390_SCHED_ATTR_MASK_ENDGROUP) != 0)
 	score += 10;
+      /* Try to avoid group-of-two insns in the last slot as they will
+	 shorten this group as well as the next one.  */
+      if ((mask & S390_SCHED_ATTR_MASK_GROUPOFTWO) != 0)
+	score = MAX (0, score - 15);
       break;
     }
 
@@ -14595,6 +14611,17 @@ s390_sched_variable_issue (FILE *file, int verbose, rtx_insn *insn, int more)
     {
       unsigned int mask = s390_get_sched_attrmask (insn);
 
+      if ((mask & S390_SCHED_ATTR_MASK_GROUPOFTWO) != 0)
+	sched_state.group_of_two = true;
+
+      /* If this is a group-of-two insn, we actually ended the last group
+	 and this insn is the first one of the new group.  */
+      if (sched_state.group_state == 2 && sched_state.group_of_two)
+	{
+	  sched_state.side = sched_state.side ? 0 : 1;
+	  sched_state.group_state = 0;
+	}
+
       /* Longrunning and side bookkeeping.  */
       for (int i = 0; i < 2; i++)
 	{
@@ -14645,6 +14672,11 @@ s390_sched_variable_issue (FILE *file, int verbose, rtx_insn *insn, int more)
 	      break;
 	    case 1:
 	      sched_state.group_state++;
+	      if (sched_state.group_of_two)
+		{
+		  sched_state.group_state = 0;
+		  ends_group = true;
+		}
 	      break;
 	    case 2:
 	      sched_state.group_state++;
@@ -14700,6 +14732,7 @@ s390_sched_variable_issue (FILE *file, int verbose, rtx_insn *insn, int more)
 	{
 	  sched_state.group_state = 0;
 	  sched_state.side = sched_state.side ? 0 : 1;
+	  sched_state.group_of_two = false;
 	}
     }
 
@@ -14733,6 +14766,7 @@ s390_sched_init (FILE *file ATTRIBUTE_UNUSED,
       memset (last_scheduled_unit_distance, 0,
 	  MAX_SCHED_UNITS * NUM_SIDES * sizeof (int));
       sched_state.group_state = 0;
+      sched_state.group_of_two = false;
     }
 }
 
-- 
2.17.0

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 2/7] S/390: Add z14 pipeline description.
  2019-03-11 12:53 [PATCH 0/7] S/390: Rework instruction scheduling Robin Dapp
                   ` (2 preceding siblings ...)
  2019-03-11 12:53 ` [PATCH 6/7] S/390: Add handling for group-of-two instructions Robin Dapp
@ 2019-03-11 12:53 ` Robin Dapp
  2019-03-11 12:53 ` [PATCH 3/7] S/390: Change handling of long-running instructions Robin Dapp
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Robin Dapp @ 2019-03-11 12:53 UTC (permalink / raw)
  To: gcc-patches; +Cc: krebbel, iii, rdapp

This patch adds the z14 pipeline description.

---
 gcc/config/s390/3906.md | 282 ++++++++++++++++++++++++++++++++++++++++
 gcc/config/s390/s390.c  |  23 +++-
 gcc/config/s390/s390.h  |   2 +-
 gcc/config/s390/s390.md |   3 +
 4 files changed, 307 insertions(+), 3 deletions(-)
 create mode 100644 gcc/config/s390/3906.md

diff --git a/gcc/config/s390/3906.md b/gcc/config/s390/3906.md
new file mode 100644
index 00000000000..b2090e2dcf3
--- /dev/null
+++ b/gcc/config/s390/3906.md
@@ -0,0 +1,282 @@
+;; Scheduling description for z14.
+;;   Copyright (C) 2016-2019 Free Software Foundation, Inc.
+;;   Contributed by Andreas Krebbel (Andreas.Krebbel@de.ibm.com)
+
+;; This file is part of GCC.
+
+;; GCC is free software; you can redistribute it and/or modify it under
+;; the terms of the GNU General Public License as published by the Free
+;; Software Foundation; either version 3, or (at your option) any later
+;; version.
+
+;; GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+;; WARRANTY; without even the implied warranty of MERCHANTABILITY or
+;; FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+;; for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GCC; see the file COPYING3.  If not see
+;; <http://www.gnu.org/licenses/>.
+
+(define_attr "z14_unit_fpd" ""
+(cond [(eq_attr "mnemonic" "ddb,ddbr,deb,debr,dxbr,sqdb,sqdbr,sqeb,\
+sqebr,sqxbr,vfddb,vfdsb,vfsqdb,vfsqsb,wfddb,wfdsb,wfdxb,wfsqdb,wfsqxb")
+ (const_int 1)] (const_int 0)))
+
+(define_attr "z14_unit_fxa" ""
+(cond [(eq_attr "mnemonic" "a,afi,ag,agf,agfi,agfr,agh,aghi,aghik,\
+agr,agrk,ahi,ahik,al,alc,alcg,alcgr,alcr,alfi,alg,algf,algfi,algfr,\
+alghsik,algr,alhsik,alr,alrk,aly,ark,ay,bras,brasl,etnd,exrl,flogr,ic,icm,\
+icmh,icmy,icy,iihf,iilf,ipm,la,larl,lay,lb,lbr,lcgr,lcr,lgb,lgbr,lgf,lgfi,\
+lgfr,lgfrl,lgh,lghi,lghr,lghrl,lgr,lh,lhi,lhr,lhrl,lhy,llcr,llgfr,llghr,\
+llgtr,llhr,llihf,llihh,llihl,llilf,llilh,llill,lngr,lnr,loc,locg,locghi,\
+locgr,lochi,locr,lpgr,lpr,lr,lrv,lrvg,lrvgr,lrvh,lrvr,lt,ltg,ltgf,ltgfr,\
+ltgr,ltr,m,mfy,mg,mgh,mghi,mgrk,mh,mhi,mhy,ml,mlg,mlgr,mlr,mr,ms,msfi,msg,\
+msgf,msgfi,msgfr,msgr,msgrkc,msr,msrkc,msy,n,ng,ngr,ngrk,nihf,nihh,nihl,\
+nilf,nilh,nill,nr,nrk,ny,o,og,ogr,ogrk,oihf,oihh,oihl,oilf,oilh,oill,or,\
+ork,oy,pfpo,popcnt,risbg,risbgn,rll,rllg,s,sg,sgf,sgfr,sgh,sgr,sgrk,sh,\
+shy,sl,slb,slbg,slbgr,slbr,slfi,slg,slgf,slgfi,slgfr,slgr,slgrk,sll,sllg,\
+sllk,slr,slrk,sly,sr,sra,srag,srak,srl,srlg,srlk,sy,x,xg,xgr,xgrk,xihf,\
+xilf,xr,xrk,xy")
+ (const_int 1)] (const_int 0)))
+
+(define_attr "z14_unit_fxb" ""
+(cond [(eq_attr "mnemonic" "agsi,algsi,alsi,asi,b,bc,bcr,bi,br,brcl,\
+c,cfi,cg,cgf,cgfi,cgfr,cgfrl,cgh,cghi,cghrl,cghsi,cgit,cgr,cgrl,cgrt,ch,\
+chi,chrl,chsi,chy,cit,cl,clfhsi,clfi,clfit,clg,clgf,clgfi,clgfr,clgfrl,\
+clghsi,clgit,clgr,clgrl,clgrt,clgt,clhhsi,clhrl,cli,cliy,clm,clmy,clr,clrl,\
+clrt,clt,cly,cr,crl,crt,cy,j,jg,laa,laag,lan,lang,lao,laog,lat,lax,laxg,\
+lcdfr,ldgr,ldr,lgat,lgdr,lndfr,lpdfr,lzdr,lzer,mvghi,mvhhi,mvhi,mvi,mviy,ni,\
+niy,nop,nopr,ntstg,oi,oiy,ppa,st,stc,stcy,std,stdy,ste,stey,stg,stgrl,sth,\
+sthrl,sthy,stoc,stocg,strl,strv,strvg,strvh,sty,tend,tm,tmh,tmhh,tmhl,tml,\
+tmlh,tmll,tmy,vlgvf,vlgvg,vlgvh,vlr,vlvgb,vlvgf,vlvgg,vlvgh,vlvgp,vst,vstl,\
+vstrl,vstrlr,xi,xiy")
+ (const_int 1)] (const_int 0)))
+
+(define_attr "z14_unit_fxd" ""
+(cond [(eq_attr "mnemonic" "dlgr,dlr,dr,dsgfr,dsgr")
+ (const_int 1)] (const_int 0)))
+
+(define_attr "z14_unit_lsu" ""
+(cond [(eq_attr "mnemonic" "a,adb,aeb,ag,agf,agh,agsi,al,alc,alcg,\
+alg,algf,algsi,alsi,aly,asi,ay,c,cdb,cg,cgf,cgfrl,cgh,cghrl,cghsi,cgrl,ch,\
+chrl,chsi,chy,cl,clc,clfhsi,clg,clgf,clgfrl,clghsi,clgrl,clgt,clhhsi,clhrl,\
+cli,cliy,clm,clmy,clrl,clt,cly,crl,cy,ddb,deb,ear,ic,icm,icmh,icmy,icy,l,\
+laa,laag,lan,lang,lao,laog,lat,lax,laxg,lb,lcbb,ld,lde,ldeb,ldy,le,ley,lg,\
+lgat,lgb,lgf,lgfrl,lgh,lghrl,lgrl,lh,lhrl,lhy,llc,llgc,llgf,llgfrl,llgh,\
+llghrl,llgt,llh,llhrl,loc,locg,lrl,lrv,lrvg,lrvh,lt,ltg,ltgf,ly,m,madb,maeb,\
+meeb,mfy,mg,mgh,mh,mhy,ml,mlg,ms,msdb,mseb,msg,msgf,msy,mvghi,mvhhi,mvhi,\
+mvi,mviy,n,ng,ni,niy,ntstg,ny,o,og,oi,oiy,oy,s,sar,sdb,seb,sfpc,sg,sgf,\
+sgh,sh,shy,sl,slb,slbg,slg,slgf,sly,sqdb,sqeb,st,stc,stcy,std,stdy,ste,\
+stey,stg,stgrl,sth,sthrl,sthy,stoc,stocg,strl,strv,strvg,strvh,sty,sy,\
+tabort,tm,tmy,vl,vlbb,vleb,vlef,vleg,vleh,vll,vllezb,vllezf,vllezg,vllezh,\
+vllezlf,vlrepb,vlrepf,vlrepg,vlreph,vlrl,vlrlr,vst,vstl,vstrl,vstrlr,x,xg,xi,\
+xiy,xy")
+ (const_int 1)] (const_int 0)))
+
+(define_attr "z14_unit_vfu" ""
+(cond [(eq_attr "mnemonic" "adb,adbr,adtr,aeb,aebr,axbr,axtr,cdb,\
+cdbr,cdtr,cebr,cpsdr,cxbr,cxtr,ddtr,dxtr,fidbr,fidbra,fidtr,fiebr,fiebra,\
+fixbr,fixbra,fixtr,lcdbr,lcebr,lcxbr,ldeb,ldebr,ldetr,le,ledbr,ledtr,ler,\
+ley,lndbr,lnebr,lnxbr,lpdbr,lpebr,lpxbr,ltdbr,ltebr,ltxbr,ltxtr,lxdb,\
+lxdbr,lxdtr,lxeb,lxebr,madb,madbr,maeb,maebr,mdbr,mdtr,meeb,meebr,msdb,\
+msdbr,mseb,msebr,mxbr,mxtr,sdb,sdbr,sdtr,seb,sebr,sxbr,sxtr,tcdb,tceb,tcxb,\
+tdcdt,tdcet,tdcxt,vab,vaccb,vacccq,vaccf,vaccg,vacch,vaccq,vacq,vaf,vag,vah,\
+vaq,vavgb,vavgf,vavgg,vavgh,vavglb,vavglf,vavglg,vavglh,vbperm,vcdgb,\
+vcdlgb,vceqb,vceqbs,vceqf,vceqfs,vceqg,vceqgs,vceqh,vceqhs,vcgdb,vchb,vchbs,\
+vchf,vchfs,vchg,vchgs,vchh,vchhs,vchlb,vchlbs,vchlf,vchlfs,vchlg,vchlgs,\
+vchlh,vchlhs,vcksm,vclgdb,vclzf,vctzb,vctzf,vctzg,vctzh,verimb,verimf,\
+verimg,verimh,verllb,verllf,verllg,verllh,verllvb,verllvf,verllvg,verllvh,\
+veslb,veslf,veslg,veslh,veslvb,veslvf,veslvg,veslvh,vesrab,vesraf,vesrag,\
+vesrah,vesravb,vesravf,vesravg,vesravh,vesrlb,vesrlf,vesrlg,vesrlh,vesrlvb,\
+vesrlvf,vesrlvg,vesrlvh,vfadb,vfasb,vfcedb,vfcedbs,vfcesb,vfcesbs,vfchdb,\
+vfchdbs,vfchedb,vfchedbs,vfchesb,vfchesbs,vfchsb,vfchsbs,vfeeb,vfeef,vfeeh,\
+vfeezbs,vfeezhs,vfeneb,vfenef,vfeneh,vfenezb,vfenezf,vfenezh,vfidb,vfisb,\
+vflcdb,vflcsb,vflndb,vflnsb,vflpdb,vfmadb,vfmasb,vfmaxdb,vfmaxsb,vfmdb,\
+vfmindb,vfminsb,vfmsb,vfmsdb,vfmssb,vfnmadb,vfnmsdb,vfnmssb,vfsdb,vfssb,\
+vftcidb,vftcisb,vgbm,vgfmab,vgfmaf,vgfmag,vgfmah,vgfmb,vgfmf,vgfmg,vgfmh,vgm,\
+vgmb,vgmf,vgmg,vgmh,vistrb,vistrbs,vistrf,vistrfs,vistrh,vlcb,vlcf,vlcg,\
+vlch,vldeb,vleb,vledb,vlef,vleg,vleh,vleib,vleif,vleig,vleih,vlpb,vlpf,\
+vlpg,vlph,vmaeb,vmaef,vmaeh,vmahb,vmahf,vmahh,vmalb,vmaleb,vmalef,vmaleh,\
+vmalf,vmalhb,vmalhf,vmalhh,vmalhw,vmalob,vmalof,vmaloh,vmaob,vmaof,vmaoh,\
+vmeb,vmef,vmeh,vmhb,vmhf,vmhh,vmlb,vmleb,vmlef,vmleh,vmlf,vmlhb,vmlhf,\
+vmlhh,vmlhw,vmlob,vmlof,vmloh,vmnb,vmnf,vmng,vmnh,vmnlb,vmnlf,vmnlg,vmnlh,\
+vmob,vmof,vmoh,vmrhb,vmrhf,vmrhg,vmrhh,vmrlb,vmrlf,vmrlg,vmrlh,vmxb,vmxf,\
+vmxg,vmxh,vn,vnc,vnn,vno,vnot,vnx,vo,voc,vone,vpdi,vperm,vpkf,vpkg,vpkh,\
+vpklsf,vpklsfs,vpklsg,vpklsgs,vpklsh,vpklshs,vpksf,vpksfs,vpksg,vpksgs,vpksh,\
+vpkshs,vpopct,vpopctb,vpopctf,vpopctg,vpopcth,vrepb,vrepf,vrepg,vreph,vrepib,\
+vrepif,vrepig,vrepih,vsb,vsbiq,vscbib,vscbif,vscbig,vscbih,vscbiq,vsegb,\
+vsegf,vsegh,vsel,vsf,vsg,vsh,vsl,vslb,vsldb,vsq,vsra,vsrab,vsrl,vsrlb,vsumb,\
+vsumgf,vsumgh,vsumh,vsumqf,vsumqg,vtm,vuphb,vuphf,vuphh,vuplb,vuplf,vuplhb,\
+vuplhf,vuplhh,vuplhw,vupllb,vupllf,vupllh,vx,vzero,wcdgb,wcdlgb,wcgdb,wclgdb,\
+wfadb,wfasb,wfaxb,wfcdb,wfcedb,wfcesb,wfcexbs,wfchdb,wfchedb,wfchesb,\
+wfchexb,wfchexbs,wfchsb,wfchxb,wfchxbs,wfcsb,wfisb,wfixb,wflcdb,wflcsb,wflcxb,\
+wflld,wflndb,wflnsb,wflnxb,wflpdb,wflpsb,wflpxb,wfmadb,wfmasb,wfmaxb,\
+wfmaxxb,wfmdb,wfminxb,wfmsb,wfmsdb,wfmssb,wfmsxb,wfmxb,wfnmaxb,wfnmsxb,wfsdb,\
+wfssb,wfsxb,wldeb,wledb")
+ (const_int 1)] (const_int 0)))
+
+(define_attr "z14_cracked" ""
+(cond [(eq_attr "mnemonic" "bas,basr,cdfbr,cdftr,cdgbr,cdgtr,cdlfbr,\
+cdlftr,cdlgbr,cdlgtr,cefbr,cegbr,celfbr,celgbr,cfdbr,cfebr,cfxbr,cgdbr,cgdtr,\
+cgebr,cgxbr,cgxtr,chhsi,clfdbr,clfebr,clfxbr,clfxtr,clgdbr,clgdtr,clgebr,\
+clgxbr,clgxtr,cs,csg,csy,d,efpc,ex,lcgfr,lngfr,lpgfr,lpq,lxr,lzxr,rxsbg,stpq,\
+vgef,vgeg,vscef,vsceg,vsteb")
+ (const_int 1)] (const_int 0)))
+
+(define_attr "z14_expanded" ""
+(cond [(eq_attr "mnemonic" "cds,cdsg,cdsy,cxfbr,cxftr,cxgbr,cxgtr,\
+cxlftr,cxlgbr,cxlgtr,dl,dlg,dsg,dsgf,lam,lm,lmg,lmy,sldl,srda,srdl,stam,stm,\
+stmg,stmy,tbegin,tbeginc")
+ (const_int 1)] (const_int 0)))
+
+(define_attr "z14_groupalone" ""
+(cond [(eq_attr "mnemonic" "alc,alcg,alcgr,alcr,axbr,axtr,clc,cxbr,\
+cxtr,dlgr,dlr,dr,dsgfr,dsgr,dxbr,dxtr,fixbr,fixbra,fixtr,flogr,lcxbr,lnxbr,\
+lpxbr,ltxbr,ltxtr,lxdb,lxdbr,lxdtr,lxeb,lxebr,m,madb,maeb,maebr,mfy,mg,mgrk,\
+ml,mlg,mlgr,mlr,mr,msdb,mseb,msebr,mvc,mxbr,mxtr,oc,ppa,sfpc,slb,slbg,\
+slbgr,slbr,sqxbr,sxbr,sxtr,tabort,tcxb,tdcxt,tend,xc")
+ (const_int 1)] (const_int 0)))
+
+(define_attr "z14_endgroup" ""
+(cond [(eq_attr "mnemonic" "bras,brasl,exrl,ipm")
+ (const_int 1)] (const_int 0)))
+
+(define_attr "z14_groupoftwo" ""
+(cond [(eq_attr "mnemonic" "vacccq,vacq,vfmadb,vfmasb,vfmsdb,vfmssb,\
+vfnmadb,vfnmsdb,vfnmssb,vgfmab,vgfmaf,vgfmag,vgfmah,vmaeb,vmaef,vmaeh,vmahb,\
+vmahf,vmahh,vmalb,vmaleb,vmalef,vmaleh,vmalf,vmalhb,vmalhf,vmalhh,vmalhw,\
+vmalob,vmalof,vmaloh,vmaob,vmaof,vmaoh,vperm,vsbiq,vsel,wfmadb,wfmasb,wfmaxb,\
+wfmsdb,wfmssb,wfmsxb,wfnmaxb,wfnmsxb")
+ (const_int 1)] (const_int 0)))
+
+(define_insn_reservation "z14_0" 0
+  (and (eq_attr "cpu" "z14")
+(eq_attr "mnemonic" "a,afi,ag,agfi,aghi,aghik,agr,agrk,ahi,ahik,al,\
+alfi,alg,algf,algfi,algfr,alghsik,algr,alhsik,alr,alrk,aly,ark,ay,b,bc,bcr,\
+bi,br,bras,brasl,brcl,c,cfi,cg,cgfi,cghi,cghsi,cgit,cgr,cgrl,cgrt,chi,\
+chsi,cit,cl,clfhsi,clfi,clfit,clg,clgf,clgfi,clgfr,clgfrl,clghsi,clgit,\
+clgr,clgrl,clgrt,clgt,clhhsi,clhrl,cli,cliy,clr,clrl,clrt,clt,cly,cr,crl,\
+crt,cy,etnd,exrl,ic,icm,icmh,icmy,icy,iihf,iilf,j,jg,la,larl,lat,lay,lb,\
+lbr,lcdfr,lcgr,lcr,ldgr,ldr,lgat,lgb,lgbr,lgf,lgfi,lgfr,lgfrl,lgh,lghi,\
+lghr,lghrl,lgr,lh,lhi,lhr,lhrl,lhy,llcr,llgfr,llghr,llgtr,llhr,llihf,llihh,\
+llihl,llilf,llilh,llill,lndfr,lngr,lnr,lpdfr,lpgr,lpr,lr,lrv,lrvg,lrvgr,\
+lrvh,lrvr,lt,ltg,ltgf,ltgfr,ltgr,ltr,lzdr,lzer,n,ng,ngr,ngrk,nihf,nihh,\
+nihl,nilf,nilh,nill,nop,nopr,nr,nrk,ny,o,og,ogr,ogrk,oihf,oihh,oihl,oilf,\
+oilh,oill,or,ork,oy,pfpo,risbg,risbgn,rll,rllg,rnsbg,rosbg,s,sg,sgr,sgrk,\
+sl,sldl,slfi,slg,slgf,slgfi,slgfr,slgr,slgrk,sll,sllg,sllk,slr,slrk,sly,\
+sr,sra,srag,srak,srda,srdl,srl,srlg,srlk,sy,tm,tmh,tmhh,tmhl,tml,tmlh,\
+tmll,tmy,vlr,vlvgb,vlvgf,vlvgg,vlvgh,x,xg,xgr,xgrk,xihf,xilf,xr,xrk,xy")) "nothing")
+
+(define_insn_reservation "z14_1" 1
+  (and (eq_attr "cpu" "z14")
+(eq_attr "mnemonic" "agf,agfr,agh,agsi,algsi,alsi,asi,cgf,cgfr,cgfrl,\
+cgh,cghrl,ch,chrl,chy,clm,clmy,cpsdr,laa,laag,lan,lang,lao,laog,lax,laxg,\
+le,ler,ley,loc,locg,locghi,locgr,lochi,locr,mvghi,mvhhi,mvhi,mvi,mviy,ni,\
+niy,ntstg,oi,oiy,sgf,sgfr,sgh,sh,shy,st,stc,stcy,stg,stgrl,sth,sthrl,sthy,\
+stoc,stocg,strl,strv,strvg,strvh,sty,vab,vaccb,vacccq,vaccf,vaccg,vacch,\
+vaccq,vacq,vaf,vag,vah,vaq,vavgb,vavgf,vavgg,vavgh,vavglb,vavglf,vavglg,\
+vavglh,vbperm,vceqb,vceqf,vceqg,vceqh,vchb,vchf,vchg,vchh,vchlb,vchlf,vchlg,\
+vchlh,vclzf,vctzb,vctzf,vctzg,vctzh,verimb,verimf,verimg,verimh,verllb,\
+verllf,verllg,verllh,verllvb,verllvf,verllvg,verllvh,veslb,veslf,veslg,veslh,\
+veslvb,veslvf,veslvg,veslvh,vesrab,vesraf,vesrag,vesrah,vesravb,vesravf,\
+vesravg,vesravh,vesrlb,vesrlf,vesrlg,vesrlh,vesrlvb,vesrlvf,vesrlvg,vesrlvh,\
+vfcedb,vfcesb,vfchdb,vfchedb,vfchesb,vfchsb,vflcdb,vflcsb,vflndb,vflnsb,\
+vflpdb,vfmaxdb,vfmaxsb,vfmindb,vfminsb,vgbm,vgm,vgmb,vgmf,vgmg,vgmh,vlcb,\
+vlcf,vlcg,vlch,vleb,vlef,vleg,vleh,vleib,vleif,vleig,vleih,vlpb,vlpf,vlpg,\
+vlph,vmnb,vmnf,vmng,vmnh,vmnlb,vmnlf,vmnlg,vmnlh,vmrhb,vmrhf,vmrhg,vmrhh,\
+vmrlb,vmrlf,vmrlg,vmrlh,vmxb,vmxf,vmxg,vmxh,vn,vnc,vnn,vno,vnot,vnx,vo,voc,\
+vone,vpdi,vperm,vpkf,vpkg,vpkh,vpklsf,vpklsg,vpklsh,vpksf,vpksg,vpksh,\
+vpopct,vpopctb,vpopctf,vpopctg,vpopcth,vrepb,vrepf,vrepg,vreph,vrepib,vrepif,\
+vrepig,vrepih,vsb,vsbiq,vscbib,vscbif,vscbig,vscbih,vscbiq,vsegb,vsegf,vsegh,\
+vsel,vsf,vsg,vsh,vsl,vslb,vsldb,vsq,vsra,vsrab,vsrl,vsrlb,vuphb,vuphf,\
+vuphh,vuplb,vuplf,vuplhb,vuplhf,vuplhh,vuplhw,vupllb,vupllf,vupllh,vx,vzero,\
+wfcedb,wfcesb,wfchdb,wfchedb,wfchesb,wfchexb,wfchsb,wfchxb,wflcdb,wflcsb,\
+wflcxb,wflndb,wflnsb,wflnxb,wflpdb,wflpsb,wflpxb,wfmaxxb,wfminxb,xi,xiy")) "nothing")
+
+(define_insn_reservation "z14_2" 2
+  (and (eq_attr "cpu" "z14")
+(eq_attr "mnemonic" "cdb,cdbr,cebr,ear,ipm,l,lcbb,lcdbr,lcebr,ld,lde,\
+ldy,lg,lgdr,lgrl,llc,llgc,llgf,llgfrl,llgh,llghrl,llgt,llh,llhrl,lm,lmg,\
+lmy,lndbr,lnebr,lpdbr,lpebr,lrl,ltdbr,ltebr,ly,popcnt,sar,tcdb,tceb,\
+vceqbs,vceqfs,vceqgs,vceqhs,vchbs,vchfs,vchgs,vchhs,vchlbs,vchlfs,vchlgs,\
+vchlhs,vfcedbs,vfcesbs,vfchdbs,vfchedbs,vfchesbs,vfchsbs,vfeeb,vfeef,vfeeh,\
+vfeneb,vfenef,vfeneh,vfenezb,vfenezf,vfenezh,vftcidb,vftcisb,vistrb,vistrf,\
+vistrh,vlgvf,vlgvg,vlgvh,vllezb,vllezf,vllezg,vllezh,vllezlf,vlrepb,vlrepf,\
+vlrepg,vlreph,vlrl,vlvgp,vpklsfs,vpklsgs,vpklshs,vpksfs,vpksgs,vpkshs,wfcdb,\
+wfcexbs,wfchexbs,wfchxbs,wfcsb")) "nothing")
+
+(define_insn_reservation "z14_3" 3
+  (and (eq_attr "cpu" "z14")
+(eq_attr "mnemonic" "cds,cdsy,mgh,mghi,mh,mhi,mhy,std,stdy,ste,stey,\
+vcksm,vfeezbs,vfeezhs,vgfmab,vgfmaf,vgfmag,vgfmah,vgfmb,vgfmf,vgfmg,vgfmh,\
+vistrbs,vistrfs,vl,vlbb,vll,vlrlr,vmaeb,vmaef,vmaeh,vmahb,vmahf,vmahh,vmalb,\
+vmaleb,vmalef,vmaleh,vmalf,vmalhb,vmalhf,vmalhh,vmalhw,vmalob,vmalof,vmaloh,\
+vmaob,vmaof,vmaoh,vmeb,vmef,vmeh,vmhb,vmhf,vmhh,vmlb,vmleb,vmlef,vmleh,vmlf,\
+vmlhb,vmlhf,vmlhh,vmlhw,vmlob,vmlof,vmloh,vmob,vmof,vmoh,vsumb,vsumgf,\
+vsumgh,vsumh,vsumqf,vsumqg,vtm")) "nothing")
+
+(define_insn_reservation "z14_4" 4
+  (and (eq_attr "cpu" "z14")
+(eq_attr "mnemonic" "bas,basr,chhsi,clc,ex,lam,lcgfr,lngfr,lpgfr,lxr,\
+lzxr,ms,msfi,msgf,msgfi,msgfr,msr,msy,mvc,oc,ppa,rxsbg,tabort,tbegin,\
+tbeginc,tend,vst,vstl,vstrl,vstrlr,xc")) "nothing")
+
+(define_insn_reservation "z14_5" 5
+  (and (eq_attr "cpu" "z14")
+(eq_attr "mnemonic" "alc,alcg,alcgr,alcr,cs,csg,csy,msrkc,slb,slbg,\
+slbgr,slbr,stm,stmg,stmy")) "nothing")
+
+(define_insn_reservation "z14_6" 6
+  (and (eq_attr "cpu" "z14")
+(eq_attr "mnemonic" "adb,adbr,aeb,aebr,fidbr,fidbra,fiebr,fiebra,\
+ldeb,ldebr,ledbr,madbr,mdbr,meeb,meebr,msdbr,msg,msgr,sdb,sdbr,seb,sebr,\
+sfpc,vcdgb,vcdlgb,vcgdb,vclgdb,vfadb,vfidb,vfmadb,vfmdb,vfmsdb,vfnmadb,\
+vfnmsdb,vfsdb,vldeb,vledb,wcdgb,wcdlgb,wcgdb,wclgdb,wfadb,wfasb,wfisb,wfmadb,\
+wfmasb,wfmdb,wfmsb,wfmsdb,wfmssb,wfsdb,wfssb,wldeb,wledb")) "nothing")
+
+(define_insn_reservation "z14_7" 7
+  (and (eq_attr "cpu" "z14")
+(eq_attr "mnemonic" "adtr,cdtr,fidtr,ldetr,msgrkc,sdtr,tdcdt,tdcet,\
+vfasb,vfisb,vfmasb,vfmsb,vfmssb,vfnmssb,vfssb,vgef,vgeg,wflld")) "nothing")
+
+(define_insn_reservation "z14_8" 8
+  (and (eq_attr "cpu" "z14")
+(eq_attr "mnemonic" "cdsg,flogr,lpq,stpq,vsteb")) "nothing")
+
+(define_insn_reservation "z14_9" 9
+  (and (eq_attr "cpu" "z14")
+(eq_attr "mnemonic" "cxfbr,cxgbr,cxlgbr,m,mfy,ml,mlr,mr,stam,wfaxb,\
+wfixb,wfsxb")) "nothing")
+
+(define_insn_reservation "z14_10" 10
+  (and (eq_attr "cpu" "z14")
+(eq_attr "mnemonic" "cdfbr,cdgbr,cdlfbr,cdlgbr,cefbr,cegbr,celfbr,\
+celgbr,madb,maeb,maebr,msdb,mseb,msebr,vscef,vsceg")) "nothing")
+
+(define_insn_reservation "z14_11" 11
+  (and (eq_attr "cpu" "z14")
+(eq_attr "mnemonic" "lxdb,lxdbr,lxeb,lxebr,mg,mgrk,mlg,mlgr")) "nothing")
+
+(define_insn_reservation "z14_12" 12
+  (and (eq_attr "cpu" "z14")
+(eq_attr "mnemonic" "cfdbr,cfebr,cgdbr,cgebr,clfdbr,clfebr,clgdbr,\
+clgebr,cxbr,cxtr,tcxb,tdcxt")) "nothing")
+
+(define_insn_reservation "z14_13" 13
+  (and (eq_attr "cpu" "z14")
+(eq_attr "mnemonic" "axbr,axtr,fixbr,fixbra,fixtr,lcxbr,lnxbr,lpxbr,\
+ltxbr,ltxtr,lxdtr,sxbr,sxtr")) "nothing")
+
+(define_insn_reservation "z14_14" 14
+  (and (eq_attr "cpu" "z14")
+(eq_attr "mnemonic" "cfxbr,cgxbr,clfxbr,clgxbr,ledtr")) "nothing")
+
+(define_insn_reservation "z14_20" 20
+  (and (eq_attr "cpu" "z14")
+(eq_attr "mnemonic" "cdftr,cdgtr,cdlftr,cdlgtr,cgdtr,cgxtr,clfxtr,\
+clgdtr,clgxtr,cxftr,cxgtr,cxlftr,cxlgtr,d,ddb,ddbr,ddtr,deb,debr,dl,dlg,dlgr,\
+dlr,dr,dsg,dsgf,dsgfr,dsgr,dxbr,dxtr,efpc,mdtr,mxbr,mxtr,sqdb,sqdbr,sqeb,\
+sqebr,sqxbr,vfddb,vfdsb,vfsqdb,vfsqsb,wfddb,wfdsb,wfdxb,wfmaxb,wfmsxb,wfmxb,\
+wfnmaxb,wfnmsxb,wfsqdb,wfsqxb")) "nothing")
+
diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index ac17e46abf3..95a4460dcf5 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -14297,7 +14297,6 @@ s390_get_sched_attrmask (rtx_insn *insn)
 	mask |= S390_SCHED_ATTR_MASK_GROUPALONE;
       break;
     case PROCESSOR_2964_Z13:
-    case PROCESSOR_3906_Z14:
       if (get_attr_z13_cracked (insn))
 	mask |= S390_SCHED_ATTR_MASK_CRACKED;
       if (get_attr_z13_expanded (insn))
@@ -14307,6 +14306,16 @@ s390_get_sched_attrmask (rtx_insn *insn)
       if (get_attr_z13_groupalone (insn))
 	mask |= S390_SCHED_ATTR_MASK_GROUPALONE;
       break;
+    case PROCESSOR_3906_Z14:
+      if (get_attr_z14_cracked (insn))
+	mask |= S390_SCHED_ATTR_MASK_CRACKED;
+      if (get_attr_z14_expanded (insn))
+	mask |= S390_SCHED_ATTR_MASK_EXPANDED;
+      if (get_attr_z14_endgroup (insn))
+	mask |= S390_SCHED_ATTR_MASK_ENDGROUP;
+      if (get_attr_z14_groupalone (insn))
+	mask |= S390_SCHED_ATTR_MASK_GROUPALONE;
+      break;
     default:
       gcc_unreachable ();
     }
@@ -14321,7 +14330,6 @@ s390_get_unit_mask (rtx_insn *insn, int *units)
   switch (s390_tune)
     {
     case PROCESSOR_2964_Z13:
-    case PROCESSOR_3906_Z14:
       *units = 4;
       if (get_attr_z13_unit_lsu (insn))
 	mask |= 1 << 0;
@@ -14332,6 +14340,17 @@ s390_get_unit_mask (rtx_insn *insn, int *units)
       if (get_attr_z13_unit_vfu (insn))
 	mask |= 1 << 3;
       break;
+    case PROCESSOR_3906_Z14:
+      *units = 4;
+      if (get_attr_z14_unit_lsu (insn))
+	mask |= 1 << 0;
+      if (get_attr_z14_unit_fxa (insn))
+	mask |= 1 << 1;
+      if (get_attr_z14_unit_fxb (insn))
+	mask |= 1 << 2;
+      if (get_attr_z14_unit_vfu (insn))
+	mask |= 1 << 3;
+      break;
     default:
       gcc_unreachable ();
     }
diff --git a/gcc/config/s390/s390.h b/gcc/config/s390/s390.h
index 3ea7c3801f5..fcb85d653a2 100644
--- a/gcc/config/s390/s390.h
+++ b/gcc/config/s390/s390.h
@@ -44,7 +44,7 @@ enum processor_flags
 
 /* This is necessary to avoid a warning about comparing different enum
    types.  */
-#define s390_tune_attr ((enum attr_cpu)(s390_tune > PROCESSOR_2964_Z13 ? PROCESSOR_2964_Z13 : s390_tune ))
+#define s390_tune_attr ((enum attr_cpu)(s390_tune > PROCESSOR_3906_Z14 ? PROCESSOR_3906_Z14 : s390_tune ))
 
 /* These flags indicate that the generated code should run on a cpu
    providing the respective hardware facility regardless of the
diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md
index a307e33e9d7..f85b780eb7b 100644
--- a/gcc/config/s390/s390.md
+++ b/gcc/config/s390/s390.md
@@ -595,6 +595,9 @@
 ;; Pipeline description for z13
 (include "2964.md")
 
+;; Pipeline description for z14
+(include "3906.md")
+
 ;; Predicates
 (include "predicates.md")
 
-- 
2.17.0

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 1/7] S/390: Change z13 pipeline description.
  2019-03-11 12:53 [PATCH 0/7] S/390: Rework instruction scheduling Robin Dapp
                   ` (4 preceding siblings ...)
  2019-03-11 12:53 ` [PATCH 3/7] S/390: Change handling of long-running instructions Robin Dapp
@ 2019-03-11 12:53 ` Robin Dapp
  2019-03-11 13:13 ` [PATCH 5/7] S/390: Add side to schedule-mix calculations Robin Dapp
  2019-03-11 15:51 ` [PATCH 0/7] S/390: Rework instruction scheduling Andreas Krebbel
  7 siblings, 0 replies; 13+ messages in thread
From: Robin Dapp @ 2019-03-11 12:53 UTC (permalink / raw)
  To: gcc-patches; +Cc: krebbel, iii, rdapp

This patch adapts the z13 pipeline description.

---
 gcc/config/s390/2964.md | 372 ++++++++++++++++++++++------------------
 gcc/config/s390/s390.c  |  39 ++---
 2 files changed, 226 insertions(+), 185 deletions(-)

diff --git a/gcc/config/s390/2964.md b/gcc/config/s390/2964.md
index 19e641bd252..a7897bcf58a 100644
--- a/gcc/config/s390/2964.md
+++ b/gcc/config/s390/2964.md
@@ -18,215 +18,257 @@
 ;; along with GCC; see the file COPYING3.  If not see
 ;; <http://www.gnu.org/licenses/>.
 
+(define_attr "z13_unit_fpd" ""
+(cond [(eq_attr "mnemonic" "ddb,ddbr,deb,debr,dxbr,sqdb,sqdbr,sqeb,\
+sqebr,sqxbr,vfddb,vfdsb,vfsqdb,vfsqsb,wfddb,wfdsb,wfdxb,wfsqdb,wfsqxb")
+ (const_int 1)] (const_int 0)))
 
-; generator options: vector_ecycs=12 cracked_ecycs=6 scale_ecycs=5
+(define_attr "z13_unit_fxa" ""
+(cond [(eq_attr "mnemonic" "a,afi,ag,agf,agfi,agfr,aghi,aghik,agr,\
+agrk,ahi,ahik,al,alc,alcg,alcgr,alcr,alfi,alg,algf,algfi,algfr,alghsik,\
+algr,alhsik,alr,alrk,aly,ark,ay,bras,brasl,etnd,exrl,flogr,ic,icm,icmh,\
+icmy,icy,iihf,iilf,ipm,la,larl,lay,lb,lbr,lcgr,lcr,lgb,lgbr,lgf,lgfi,lgfr,\
+lgfrl,lgh,lghi,lghr,lghrl,lgr,lh,lhi,lhr,lhrl,lhy,llcr,llgfr,llghr,llgtr,\
+llhr,llihf,llihh,llihl,llilf,llilh,llill,lngr,lnr,loc,locg,locghi,locgr,\
+lochi,locr,lpgr,lpr,lr,lrv,lrvg,lrvgr,lrvh,lrvr,lt,ltg,ltgf,ltgfr,ltgr,ltr,\
+m,mfy,mghi,mh,mhi,mhy,ml,mlg,mlgr,mlr,mr,ms,msfi,msg,msgf,msgfi,msgfr,\
+msgr,msr,msy,n,ng,ngr,ngrk,nihf,nihh,nihl,nilf,nilh,nill,nr,nrk,ny,o,og,\
+ogr,ogrk,oihf,oihh,oihl,oilf,oilh,oill,or,ork,oy,pfpo,popcnt,ppa,risbg,\
+risbgn,rll,rllg,s,sg,sgf,sgfr,sgr,sgrk,sh,shy,sl,slb,slbg,slbgr,slbr,slfi,\
+slg,slgf,slgfi,slgfr,slgr,slgrk,sll,sllg,sllk,slr,slrk,sly,sr,sra,srag,\
+srak,srl,srlg,srlk,sy,x,xg,xgr,xgrk,xihf,xilf,xr,xrk,xy")
+ (const_int 1)] (const_int 0)))
+
+(define_attr "z13_unit_fxb" ""
+(cond [(eq_attr "mnemonic" "agsi,algsi,alsi,asi,b,bc,bcr,br,brcl,c,\
+cfi,cg,cgf,cgfi,cgfr,cgfrl,cgh,cghi,cghrl,cghsi,cgit,cgr,cgrl,cgrt,ch,chi,\
+chrl,chsi,chy,cit,cl,clfhsi,clfi,clfit,clg,clgf,clgfi,clgfr,clgfrl,clghsi,\
+clgit,clgr,clgrl,clgrt,clgt,clhhsi,clhrl,cli,cliy,clm,clmy,clr,clrl,clrt,\
+clt,cly,cr,crl,crt,cy,j,jg,laa,laag,lan,lang,lao,laog,lat,lax,laxg,lcdfr,\
+ldgr,ldr,lgat,lgdr,lndfr,lpdfr,lzdr,lzer,mvghi,mvhhi,mvhi,mvi,mviy,ni,niy,\
+nop,nopr,ntstg,oi,oiy,st,stc,stcy,std,stdy,ste,stey,stg,stgrl,sth,sthrl,\
+sthy,stoc,stocg,strl,strv,strvg,strvh,sty,tend,tm,tmh,tmhh,tmhl,tml,tmlh,\
+tmll,tmy,vlgvf,vlgvg,vlgvh,vlr,vlvgb,vlvgf,vlvgg,vlvgh,vlvgp,vst,vstl,xi,\
+xiy")
+ (const_int 1)] (const_int 0)))
+
+(define_attr "z13_unit_fxd" ""
+(cond [(eq_attr "mnemonic" "dlgr,dlr,dr,dsgfr,dsgr")
+ (const_int 1)] (const_int 0)))
+
+(define_attr "z13_unit_lsu" ""
+(cond [(eq_attr "mnemonic" "a,adb,aeb,ag,agf,agsi,al,alc,alcg,alg,\
+algf,algsi,alsi,aly,asi,ay,c,cdb,cg,cgf,cgfrl,cgh,cghrl,cghsi,cgrl,ch,chrl,\
+chsi,chy,cl,clc,clfhsi,clg,clgf,clgfrl,clghsi,clgrl,clgt,clhhsi,clhrl,cli,\
+cliy,clm,clmy,clrl,clt,cly,crl,cy,ddb,deb,ear,ic,icm,icmh,icmy,icy,l,laa,\
+laag,lan,lang,lao,laog,lat,lax,laxg,lb,lcbb,ld,lde,ldeb,ldy,le,ley,lg,lgat,\
+lgb,lgf,lgfrl,lgh,lghrl,lgrl,lh,lhrl,lhy,llc,llgc,llgf,llgfrl,llgh,llghrl,\
+llgt,llh,llhrl,loc,locg,lrl,lrv,lrvg,lrvh,lt,ltg,ltgf,ly,m,madb,maeb,meeb,\
+mfy,mh,mhy,ml,mlg,ms,msdb,mseb,msg,msgf,msy,mvghi,mvhhi,mvhi,mvi,mviy,n,\
+ng,ni,niy,ntstg,ny,o,og,oi,oiy,oy,s,sar,sdb,seb,sfpc,sg,sgf,sh,shy,sl,\
+slb,slbg,slg,slgf,sly,sqdb,sqeb,st,stc,stcy,std,stdy,ste,stey,stg,stgrl,\
+sth,sthrl,sthy,stoc,stocg,strl,strv,strvg,strvh,sty,sy,tabort,tm,tmy,vl,\
+vlbb,vleb,vlef,vleg,vleh,vll,vllezb,vllezf,vllezg,vllezh,vllezlf,vlrepb,\
+vlrepf,vlrepg,vlreph,vst,vstl,x,xg,xi,xiy,xy")
+ (const_int 1)] (const_int 0)))
+
+(define_attr "z13_unit_vfu" ""
+(cond [(eq_attr "mnemonic" "adb,adbr,adtr,aeb,aebr,axbr,axtr,cdb,\
+cdbr,cdtr,cebr,cpsdr,cxbr,cxtr,ddtr,dxtr,fidbr,fidbra,fidtr,fiebr,fiebra,\
+fixbr,fixbra,fixtr,lcdbr,lcebr,lcxbr,ldeb,ldebr,ldetr,le,ledbr,ledtr,ler,\
+ley,lndbr,lnebr,lnxbr,lpdbr,lpebr,lpxbr,ltdbr,ltebr,ltxbr,ltxtr,lxdb,\
+lxdbr,lxdtr,lxeb,lxebr,madb,madbr,maeb,maebr,mdbr,mdtr,meeb,meebr,msdb,\
+msdbr,mseb,msebr,mxbr,mxtr,sdb,sdbr,sdtr,seb,sebr,sxbr,sxtr,tcdb,tceb,tcxb,\
+tdcdt,tdcet,tdcxt,vab,vaccb,vacccq,vaccf,vaccg,vacch,vaccq,vacq,vaf,vag,vah,\
+vaq,vavgb,vavgf,vavgg,vavgh,vavglb,vavglf,vavglg,vavglh,vcdgb,vcdlgb,\
+vceqb,vceqbs,vceqf,vceqfs,vceqg,vceqgs,vceqh,vceqhs,vcgdb,vchb,vchbs,vchf,\
+vchfs,vchg,vchgs,vchh,vchhs,vchlb,vchlbs,vchlf,vchlfs,vchlg,vchlgs,vchlh,\
+vchlhs,vcksm,vclgdb,vclzf,vctzb,vctzf,vctzg,vctzh,verimb,verimf,verimg,\
+verimh,verllb,verllf,verllg,verllh,verllvb,verllvf,verllvg,verllvh,veslb,\
+veslf,veslg,veslh,veslvb,veslvf,veslvg,veslvh,vesrab,vesraf,vesrag,vesrah,\
+vesravb,vesravf,vesravg,vesravh,vesrlb,vesrlf,vesrlg,vesrlh,vesrlvb,vesrlvf,\
+vesrlvg,vesrlvh,vfadb,vfasb,vfcedb,vfcedbs,vfcesb,vfcesbs,vfchdb,vfchdbs,\
+vfchedb,vfchedbs,vfchesb,vfchesbs,vfchsb,vfchsbs,vfeeb,vfeef,vfeeh,vfeezbs,\
+vfeezhs,vfeneb,vfenef,vfeneh,vfenezb,vfenezf,vfenezh,vfidb,vfisb,vflcdb,\
+vflcsb,vflndb,vflnsb,vflpdb,vfmadb,vfmasb,vfmdb,vfmsb,vfmsdb,vfmssb,vfsdb,\
+vfssb,vftcidb,vftcisb,vgbm,vgfmab,vgfmaf,vgfmag,vgfmah,vgfmb,vgfmf,vgfmg,\
+vgfmh,vgm,vgmb,vgmf,vgmg,vgmh,vistrb,vistrbs,vistrf,vistrfs,vistrh,vlcb,\
+vlcf,vlcg,vlch,vldeb,vleb,vledb,vlef,vleg,vleh,vleib,vleif,vleig,vleih,\
+vlpb,vlpf,vlpg,vlph,vmaeb,vmaef,vmaeh,vmahb,vmahf,vmahh,vmalb,vmaleb,\
+vmalef,vmaleh,vmalf,vmalhb,vmalhf,vmalhh,vmalhw,vmalob,vmalof,vmaloh,vmaob,\
+vmaof,vmaoh,vmeb,vmef,vmeh,vmhb,vmhf,vmhh,vmlb,vmleb,vmlef,vmleh,vmlf,vmlhb,\
+vmlhf,vmlhh,vmlhw,vmlob,vmlof,vmloh,vmnb,vmnf,vmng,vmnh,vmnlb,vmnlf,vmnlg,\
+vmnlh,vmob,vmof,vmoh,vmrhb,vmrhf,vmrhg,vmrhh,vmrlb,vmrlf,vmrlg,vmrlh,vmxb,\
+vmxf,vmxg,vmxh,vn,vnc,vno,vnot,vo,vone,vpdi,vperm,vpkf,vpkg,vpkh,vpklsf,\
+vpklsfs,vpklsg,vpklsgs,vpklsh,vpklshs,vpksf,vpksfs,vpksg,vpksgs,vpksh,vpkshs,\
+vpopct,vpopctb,vpopctf,vpopctg,vpopcth,vrepb,vrepf,vrepg,vreph,vrepib,vrepif,\
+vrepig,vrepih,vsb,vsbiq,vscbib,vscbif,vscbig,vscbih,vscbiq,vsegb,vsegf,vsegh,\
+vsel,vsf,vsg,vsh,vsl,vslb,vsldb,vsq,vsra,vsrab,vsrl,vsrlb,vsumb,vsumgf,\
+vsumgh,vsumh,vsumqf,vsumqg,vtm,vuphb,vuphf,vuphh,vuplb,vuplf,vuplhb,vuplhf,\
+vuplhh,vuplhw,vupllb,vupllf,vupllh,vx,vzero,wcdgb,wcdlgb,wcgdb,wclgdb,wfadb,\
+wfasb,wfaxb,wfcdb,wfcedb,wfcesb,wfcexbs,wfchdb,wfchedb,wfchesb,wfchexb,\
+wfchexbs,wfchsb,wfchxb,wfchxbs,wfcsb,wfisb,wfixb,wflcdb,wflcsb,wflcxb,wflld,\
+wflndb,wflnsb,wflnxb,wflpdb,wflpsb,wflpxb,wfmadb,wfmasb,wfmaxb,wfmdb,wfmsb,\
+wfmsdb,wfmssb,wfmsxb,wfmxb,wfsdb,wfssb,wfsxb,wldeb,wledb")
+ (const_int 1)] (const_int 0)))
 
 (define_attr "z13_cracked" ""
-  (cond [(eq_attr "mnemonic" "celgbr,vscef,vsceg,exrl,clfebr,cefbr,chhsi,\
-vgef,vgeg,cdlftr,lcgfr,cfdbr,cgdbr,lzxr,cfxbr,rnsbg,cgdtr,cegbr,rxsbg,ex,\
-cgxtr,clfxtr,cdlgtr,brasl,efpc,cfebr,tbeginc,celfbr,clgxbr,vsteb,vsteh,\
-clfdtr,cdfbr,lngfr,clgebr,stpq,cs,lpgfr,cdlgbr,lpq,cdgtr,d,cgxbr,cdftr,\
-rosbg,clgdbr,cdgbr,bras,tbegin,clfdbr,cdlfbr,cgebr,clfxbr,lxr,csy,csg,clgdtr,\
-clgxtr") (const_int 1)]
-        (const_int 0)))
+(cond [(eq_attr "mnemonic" "bas,basr,cdfbr,cdftr,cdgbr,cdgtr,cdlfbr,\
+cdlftr,cdlgbr,cdlgtr,cefbr,cegbr,celfbr,celgbr,cfdbr,cfebr,cfxbr,cgdbr,cgdtr,\
+cgebr,cgxbr,cgxtr,chhsi,clfdbr,clfebr,clfxbr,clfxtr,clgdbr,clgdtr,clgebr,\
+clgxbr,clgxtr,cs,csg,csy,d,efpc,ex,lcgfr,lngfr,lpgfr,lpq,lxr,lzxr,rnsbg,\
+rosbg,rxsbg,stpq,vgef,vgeg,vscef,vsceg,vsteb")
+ (const_int 1)] (const_int 0)))
 
 (define_attr "z13_expanded" ""
-  (cond [(eq_attr "mnemonic" "cxlftr,cdsg,cdsy,stam,lam,dsgf,lmg,cxlgtr,\
-dl,cxftr,sldl,dsg,cxlfbr,cxgtr,stmg,stmy,stm,lm,cds,lmy,cxfbr,cxlgbr,srda,\
-srdl,cxgbr,dlg") (const_int 1)]
-        (const_int 0)))
+(cond [(eq_attr "mnemonic" "cds,cdsg,cdsy,cxfbr,cxftr,cxgbr,cxgtr,\
+cxlftr,cxlgbr,cxlgtr,dl,dlg,dsg,dsgf,lam,lm,lmg,lmy,sldl,srda,srdl,stam,stm,\
+stmg,stmy,tbegin,tbeginc")
+ (const_int 1)] (const_int 0)))
 
 (define_attr "z13_groupalone" ""
-  (cond [(eq_attr "mnemonic" "mvc,dxbr,lxebr,axtr,cxtr,alcr,lxdb,lxeb,mxtr,\
-mfy,cxbr,dsgr,lcxbr,slb,mr,dr,alc,slbr,maebr,mlgr,dsgfr,sxtr,tdcxt,tabort,\
-msebr,lxdtr,ltxtr,slbg,ml,mxbr,maeb,oc,dxtr,msdb,sqxbr,mseb,xc,m,clc,mlg,\
-mlr,fixbra,alcgr,nc,sfpc,dlgr,fixbr,slbgr,fixtr,lpxbr,axbr,lxdbr,ltxbr,\
-tcxb,dlr,lnxbr,sxbr,flogr,alcg,tend,madb,bcr_flush") (const_int 1)]
-        (const_int 0)))
+(cond [(eq_attr "mnemonic" "alc,alcg,alcgr,alcr,axbr,axtr,clc,cxbr,\
+cxtr,dlgr,dlr,dr,dsgfr,dsgr,dxbr,dxtr,fixbr,fixbra,fixtr,flogr,lcxbr,lnxbr,\
+lpxbr,ltxbr,ltxtr,lxdb,lxdbr,lxdtr,lxeb,lxebr,m,madb,maeb,maebr,mfy,ml,mlg,\
+mlgr,mlr,mr,msdb,mseb,msebr,mvc,mxbr,mxtr,oc,sfpc,slb,slbg,slbgr,slbr,\
+sqxbr,sxbr,sxtr,tabort,tcxb,tdcxt,tend,xc")
+ (const_int 1)] (const_int 0)))
 
 (define_attr "z13_endgroup" ""
-  (cond [(eq_attr "mnemonic" "ipm") (const_int 1)]
-        (const_int 0)))
-
-(define_attr "z13_unit_lsu" ""
-  (cond [(eq_attr "mnemonic" "vlbb,mvc,llgc,llc,llhrl,vl,llghrl,vlrepf,\
-vlrepg,vlreph,lde,ldy,tabort,l,llh,ld,lg,ly,vlrepb,vllezb,vllezf,vllezg,\
-vllezh,oc,xc,clc,lrl,ear,nc,lgrl,sfpc,llgf,llgfrl,llgh,llgt,lcbb,vll,sar") (const_int 1)]
-        (const_int 0)))
-
-(define_attr "z13_unit_fxu" ""
-  (cond [(eq_attr "mnemonic" "s,lcgr,x,nop,oiy,ppa,ng,msy,sgrk,vstl,aghik,\
-msgf,ipm,mvi,stocg,rll,srlg,cghsi,clgit,srlk,alrk,sg,sh,sl,st,sy,vst,ark,\
-xgr,agsi,tm,nrk,shy,llhr,agf,alcr,slgfr,sr,clgrt,laa,sgf,lan,llilf,\
-llilh,ag,llill,lay,al,n,laxg,ar,ahi,sgr,ntstg,ay,stcy,nopr,mfy,ngrk,lbr,\
-br,dsgr,stdy,ork,ldgr,lcr,cg,ch,lgfrl,cl,stoc,cr,agfr,stgrl,cy,alfi,xg,\
-cgfi,xi,clfhsi,cgfr,xr,slb,mghi,clfi,slg,clhhsi,agfi,clfit,sly,mr,ldr,nihf,\
-nihh,algfi,dr,nihl,algf,algfr,algr,clgf,clgr,clgt,aghi,alc,alg,locg,alr,\
-locr,cghi,aly,alghsik,slbr,clgfrl,mhy,cit,nr,ny,xiy,mlgr,sthy,cly,dsgfr,\
-rllg,cgit,lgb,lgf,clgrl,lgh,lrvgr,cliy,cgrl,lgr,slrk,clrt,icy,laog,og,agr,\
-mvhi,lhrl,or,lhr,vlvgp,lhy,nilf,oy,nilh,nill,lcdfr,mviy,tmhh,tmhl,sthrl,\
-ltgf,ltgr,srk,clghrl,ahy,vstef,vsteg,ah,vlgvb,llgcr,tmh,tml,clmy,slr,cfi,\
-stc,std,ste,stg,sth,locgr,slbg,sty,tmlh,la,lb,mvghi,lh,risbgn,lrvg,lr,asi,\
-lt,ahik,lrvr,cgf,cgh,cgr,clhrl,lzdr,tmll,mh,ml,vlvgb,ms,lrv,vlvgf,xgrk,\
-vlvgg,llgfr,vlvgh,slfi,chi,chy,mhi,lzer,alhsik,ni,ltgfr,loc,icm,oi,cgfrl,\
-agrk,lgat,oilh,llghr,lghrl,oill,xihf,lpgr,cgrt,clrl,sgfr,lpr,lgbr,strl,\
-algrk,alsi,srak,slgf,a,b,c,slgr,m,o,algsi,icmh,srag,iilf,ogrk,clg,icmy,\
-cli,clm,clr,clt,slgrk,mlg,lao,mlr,risbg,mvhhi,lat,etnd,lax,iihf,sra,alcgr,\
-msgr,clghsi,stey,ngr,xilf,laag,oihf,oihh,oihl,ltg,ltr,niy,lgfi,dlgr,lgfr,\
-slgfi,llcr,slbgr,chrl,lgdr,pfpo,lang,basr,sllg,sllk,lghi,lghr,vlgvf,vlgvg,\
-vlgvh,vlr,chsi,lngr,cghrl,srl,lhi,oilf,crl,crt,afi,xrk,llgtr,llihf,llihh,\
-llihl,dlr,msgfi,msgfr,msg,flogr,xy,msr,clgfi,clgfr,ogr,popcnt,alcg,lndfr,\
-larl,sll,tmy,msfi,ic,lpdfr,tend,lnr") (const_int 1)]
-        (const_int 0)))
+(cond [(eq_attr "mnemonic" "bras,brasl,exrl,ipm")
+ (const_int 1)] (const_int 0)))
 
-(define_attr "z13_unit_vfu" ""
-  (cond [(eq_attr "mnemonic" "seb,vcksm,vfadb,vleib,vchgs,vleif,vleig,vleih,\
-vgbm,verimb,vone,verimf,verimg,verimh,dxbr,verllvb,lpebr,verllvf,verllvg,\
-verllvh,vfeneb,wcdgb,vfenef,vfeneh,vchhs,vctzb,vctzf,vctzg,vctzh,vlcb,aeb,\
-vlcf,vlcg,vlch,vfmsdb,vgfmab,ltebr,vgfmaf,vgfmag,vgfmah,vmaeh,vsb,vsf,vsg,\
-vsh,vsl,vsq,lxebr,cdtr,fiebr,vupllb,vupllf,vupllh,vmrhb,madbr,vtm,vmrhf,\
-vmrhg,vmrhh,axtr,fiebra,vleb,cxtr,vlef,vleg,vleh,vpkf,vpkg,vpkh,vmlob,vmlof,\
-vmloh,lxdb,ldeb,mdtr,vceqfs,adb,wflndb,lxeb,vn,vo,vchlb,vx,mxtr,vchlf,vchlg,\
-vchlh,vfcedbs,vfcedb,vceqgs,cxbr,msdbr,vcdgb,debr,vceqhs,meeb,lcxbr,vavglb,\
-vavglf,vavglg,vavglh,vmrlb,vmrlf,vmrlg,vmrlh,vmxb,tcdb,\
-vmahh,vsrlb,wcgdb,lcdbr,vistrbs,vrepb,wfmdb,vrepf,vrepg,vreph,ler,wcdlgb,\
-ley,vistrb,vistrf,vistrh,tceb,wfsqdb,sqeb,vsumqf,vsumqg,vesrlb,vfeezbs,\
-maebr,vesrlf,vesrlg,vesrlh,vmeb,vmef,vmeh,meebr,vflcdb,wfmadb,vperm,sxtr,\
-vclzf,vgm,vgmb,vgmf,vgmg,vgmh,tdcxt,vzero,msebr,veslb,veslf,veslg,vfenezb,\
-vfenezf,vfenezh,vistrfs,vchf,vchg,vchh,vmhb,vmhf,vmhh,cdb,veslvb,ledbr,\
-veslvf,veslvg,veslvh,wclgdb,vfmdb,vmnlb,vmnlf,vmnlg,vmnlh,vclzb,vfeezfs,\
-vclzg,vclzh,mdb,vmxlb,vmxlf,vmxlg,vmxlh,ltdtr,vsbcbiq,ceb,wfddb,sebr,vistrhs,\
-lxdtr,lcebr,vab,vaf,vag,vah,ltxtr,vlpf,vlpg,vsegb,vaq,vsegf,vsegh,\
-sdtr,cdbr,vfeezhs,le,wldeb,vfmadb,vchlbs,vacccq,vmaleb,vsel,vmalef,vmaleh,\
-vflndb,mdbr,vmlb,wflpdb,ldetr,vpksfs,vpksf,vpksg,vpksh,sqdb,mxbr,sqdbr,\
-vmaeb,veslh,vmaef,vpklsf,vpklsg,vpklsh,verllb,vchb,ddtr,verllf,verllg,verllh,\
-wfsdb,maeb,vclgdb,vftcidb,vpksgs,vmxf,vmxg,vmxh,fidbra,vmnb,vmnf,vmng,vfchedbs,\
-lnebr,vfidb,dxtr,ddb,msdb,vmalhb,vfddb,vmalhf,vmalhh,vpkshs,vfsdb,sqxbr,\
-vmalhw,ltdbr,vmob,vmof,vmoh,deb,vchlfs,mseb,vcdlgb,vlpb,wfmsdb,vlph,vmahb,\
-vldeb,vmahf,vgfmb,fidbr,vfsqdb,aebr,wledb,vchlgs,vesravb,vfchdbs,cebr,vesravf,\
-vesravg,vesravh,vcgdb,fixbra,vrepib,vrepif,vrepig,vrepih,tdcdt,vchlhs,vceqb,\
-vscbib,vceqf,vceqg,vscbif,vscbig,vscbih,vmlhw,vscbiq,vuphb,vuphf,vuphh,\
-vfchedb,tdcet,vslb,vpklsfs,adbr,sqebr,vfchdb,fixbr,vpklsgs,vsldb,vmleb,\
-vmlef,vmleh,cpsdr,vmalb,vmalf,vavgb,vmlf,vavgf,vavgg,vavgh,vgfmf,vgfmg,\
-vgfmh,fidtr,vpklshs,lndbr,vno,lpdbr,vacq,vledb,vchbs,vfeeb,vfeef,vfeeh,\
-fixtr,vaccb,wfadb,vaccf,vaccg,vacch,vnot,vmalob,vaccq,vmalof,vmaloh,lpxbr,\
-ledtr,vuplb,vuplf,axbr,lxdbr,ltxbr,vpopct,vpdi,vmlhb,vmlhf,vmlhh,sdbr,vnc,\
-vsumb,vsrab,vsumh,vmaob,vmaof,vmaoh,vesrlvb,vesrlvf,vesrlvg,vesrlvh,tcxb,\
-vceqbs,vceqh,lnxbr,sxbr,vesrab,wflcdb,vesraf,vesrag,vesrah,vflpdb,vmnh,\
-vsbiq,adtr,vsra,vsrl,vuplhb,sdb,vuplhf,vuplhh,vsumgf,vsumgh,ldebr,vuplhw,\
-vchfs,madb,ddbr") (const_int 1)]
-        (const_int 0)))
+(define_attr "z13_groupoftwo" ""
+(cond [(eq_attr "mnemonic" "vacccq,vacq,vfmadb,vfmasb,vfmsdb,vfmssb,\
+vgfmab,vgfmaf,vgfmag,vgfmah,vmaeb,vmaef,vmaeh,vmahb,vmahf,vmahh,vmalb,vmaleb,\
+vmalef,vmaleh,vmalf,vmalhb,vmalhf,vmalhh,vmalhw,vmalob,vmalof,vmaloh,vmaob,\
+vmaof,vmaoh,vperm,vsbiq,vsel,wfmadb,wfmasb,wfmaxb,wfmsdb,wfmssb,wfmsxb")
+ (const_int 1)] (const_int 0)))
 
 (define_insn_reservation "z13_0" 0
   (and (eq_attr "cpu" "z13")
-       (eq_attr "mnemonic" "s,lcgr,x,nop,oiy,vlbb,ppa,ng,sgrk,vstl,aghik,\
-mvc,ipm,llgc,mvi,stocg,rll,jg,srlg,cghsi,clgit,srlk,alrk,sg,sh,sl,st,sy,\
-vst,ark,xgr,agsi,tm,nrk,shy,llhr,agf,alcr,slgfr,sr,clgrt,llc,laa,sgf,\
-lan,llhrl,llilf,llilh,ag,llill,lay,al,n,laxg,ar,ahi,sgr,ntstg,ay,stcy,vl,\
-nopr,ngrk,lbr,br,stdy,ork,ldgr,lcr,cg,ch,llghrl,lgfrl,cl,stoc,cr,agfr,stgrl,\
-cy,alfi,xg,cgfi,xi,vlrepf,vlrepg,vlreph,clfhsi,cgfr,xr,slb,mghi,clfi,slg,\
-lde,clhhsi,agfi,clfit,sly,ldr,ldy,nihf,nihh,algfi,nihl,algf,algfr,algr,\
-clgf,clgr,clgt,aghi,alc,alg,locg,alr,locr,cghi,aly,alghsik,slbr,clgfrl,\
-mhy,cit,nr,ny,xiy,sthy,cly,rllg,cgit,lgb,lgf,clgrl,lgh,lrvgr,cliy,cgrl,\
-lgr,slrk,clrt,icy,laog,og,agr,mvhi,lhrl,or,lhr,vlvgp,lhy,nilf,oy,nilh,tabort,\
-nill,lcdfr,mviy,tmhh,tmhl,sthrl,ltgf,ltgr,srk,clghrl,ahy,vstef,vsteg,ah,\
-vlgvb,llgcr,tmh,tml,clmy,slr,cfi,stc,std,ste,stg,sth,l,locgr,llh,slbg,sty,\
-tmlh,la,lb,ld,mvghi,lg,lh,risbgn,lrvg,lr,asi,lt,ahik,ly,lrvr,vlrepb,vllezb,\
-cgf,cgh,vllezf,vllezg,vllezh,cgr,clhrl,lzdr,tmll,mh,vlvgb,lrv,vlvgf,xgrk,\
-vlvgg,llgfr,vlvgh,slfi,chi,chy,mhi,lzer,alhsik,ni,ltgfr,loc,icm,oc,oi,cgfrl,\
-agrk,lgat,oilh,llghr,lghrl,oill,xihf,lpgr,cgrt,clrl,sgfr,lpr,lgbr,strl,\
-algrk,alsi,srak,brcl,slgf,xc,a,b,c,slgr,j,o,algsi,icmh,srag,iilf,ogrk,clc,\
-clg,icmy,cli,clm,clr,clt,slgrk,lrl,lao,risbg,mvhhi,lat,etnd,lax,iihf,sra,\
-alcgr,clghsi,ear,nc,lgrl,stey,ngr,xilf,laag,oihf,oihh,oihl,ltg,ltr,niy,\
-lgfi,sfpc,lgfr,slgfi,llcr,llgf,llgfrl,llgh,slbgr,llgt,chrl,lgdr,pfpo,lang,\
-basr,lcbb,sllg,sllk,lghi,vll,lghr,vlgvf,vlgvg,vlgvh,vlr,chsi,lngr,cghrl,\
-srl,sar,lhi,oilf,crl,crt,afi,xrk,llgtr,llihf,llihh,llihl,xy,clgfi,clgfr,\
-ogr,popcnt,alcg,lndfr,larl,sll,tmy,ic,lpdfr,tend,lnr,bcr_flush")) "nothing")
+(eq_attr "mnemonic" "a,afi,ag,agfi,aghi,aghik,agr,agrk,ahi,ahik,al,\
+alfi,alg,algf,algfi,algfr,alghsik,algr,alhsik,alr,alrk,aly,ark,ay,b,bc,bcr,\
+br,bras,brasl,brcl,c,cfi,cg,cgfi,cghi,cghsi,cgit,cgr,cgrl,cgrt,chi,chsi,\
+cit,cl,clfhsi,clfi,clfit,clg,clgf,clgfi,clgfr,clgfrl,clghsi,clgit,clgr,\
+clgrl,clgrt,clgt,clhhsi,clhrl,cli,cliy,clr,clrl,clrt,clt,cly,cr,crl,crt,cy,\
+etnd,exrl,ic,icm,icmh,icmy,icy,iihf,iilf,j,jg,la,larl,lat,lay,lb,lbr,lcdfr,\
+lcgr,lcr,ldgr,ldr,lgat,lgb,lgbr,lgf,lgfi,lgfr,lgfrl,lgh,lghi,lghr,lghrl,\
+lgr,lh,lhi,lhr,lhrl,lhy,llcr,llgfr,llghr,llgtr,llhr,llihf,llihh,llihl,\
+llilf,llilh,llill,lndfr,lpdfr,lr,lrv,lrvg,lrvgr,lrvh,lrvr,lt,ltg,ltgf,ltgfr,\
+ltgr,ltr,lzdr,lzer,n,ng,ngr,ngrk,nihf,nihh,nihl,nilf,nilh,nill,nop,nopr,nr,\
+nrk,ny,o,og,ogr,ogrk,oihf,oihh,oihl,oilf,oilh,oill,or,ork,oy,pfpo,ppa,\
+risbg,risbgn,rll,rllg,s,sg,sgr,sgrk,sl,sldl,slfi,slg,slgf,slgfi,slgfr,slgr,\
+slgrk,sll,sllg,sllk,slr,slrk,sly,sr,sra,srag,srak,srda,srdl,srl,srlg,srlk,\
+sy,tm,tmh,tmhh,tmhl,tml,tmlh,tmll,tmy,vlr,vlvgb,vlvgf,vlvgg,vlvgh,x,xg,\
+xgr,xgrk,xihf,xilf,xr,xrk,xy")) "nothing")
 
 (define_insn_reservation "z13_1" 1
   (and (eq_attr "cpu" "z13")
-       (eq_attr "mnemonic" "celgbr,vscef,vsceg,msy,msgf,cxlftr,cdsg,cdsy,\
-exrl,clfebr,cefbr,chhsi,stam,vgef,vgeg,cdlftr,lam,mfy,lcgfr,cfdbr,dsgf,\
-cgdbr,lzxr,lmg,cfxbr,rnsbg,cxlgtr,mr,dl,cxftr,sldl,cgdtr,cegbr,rxsbg,ex,\
-cgxtr,clfxtr,mlgr,cdlgtr,brasl,dsg,efpc,cfebr,tbeginc,celfbr,clgxbr,vsteb,\
-vsteh,cxlfbr,clfdtr,cxgtr,stmg,stmy,stm,lm,cds,cdfbr,ml,ms,lngfr,clgebr,\
-stpq,lmy,cs,lpgfr,cdlgbr,lpq,cxfbr,cxlgbr,cdgtr,d,m,mlg,mlr,cgxbr,cdftr,\
-msgr,rosbg,clgdbr,cdgbr,srda,bras,srdl,tbegin,clfdbr,cdlfbr,cxgbr,cgebr,\
-dlg,clfxbr,lxr,csy,msgfi,msgfr,msg,flogr,msr,csg,msfi,clgdtr,clgxtr")) "nothing")
+(eq_attr "mnemonic" "agf,agfr,agsi,algsi,alsi,asi,cgf,cgfr,cgfrl,cgh,\
+cghrl,ch,chrl,chy,clm,clmy,cpsdr,laa,laag,lan,lang,lao,laog,lax,laxg,le,ler,\
+ley,lngr,lnr,loc,locg,locghi,locgr,lochi,locr,lpgr,lpr,mvghi,mvhhi,mvhi,\
+mvi,mviy,ni,niy,ntstg,oi,oiy,sgf,sgfr,sh,shy,st,stc,stcy,stg,stgrl,sth,\
+sthrl,sthy,stoc,stocg,strl,strv,strvg,strvh,sty,vab,vaccb,vacccq,vaccf,\
+vaccg,vacch,vaccq,vacq,vaf,vag,vah,vaq,vavgb,vavgf,vavgg,vavgh,vavglb,\
+vavglf,vavglg,vavglh,vceqb,vceqf,vceqg,vceqh,vchb,vchf,vchg,vchh,vchlb,vchlf,\
+vchlg,vchlh,vclzf,vctzb,vctzf,vctzg,vctzh,verimb,verimf,verimg,verimh,\
+verllb,verllf,verllg,verllh,verllvb,verllvf,verllvg,verllvh,veslb,veslf,\
+veslg,veslh,veslvb,veslvf,veslvg,veslvh,vesrab,vesraf,vesrag,vesrah,vesravb,\
+vesravf,vesravg,vesravh,vesrlb,vesrlf,vesrlg,vesrlh,vesrlvb,vesrlvf,vesrlvg,\
+vesrlvh,vfcedb,vfcesb,vfchdb,vfchedb,vfchesb,vfchsb,vflcdb,vflcsb,vflndb,\
+vflnsb,vflpdb,vgbm,vgm,vgmb,vgmf,vgmg,vgmh,vlcb,vlcf,vlcg,vlch,vleb,vlef,\
+vleg,vleh,vleib,vleif,vleig,vleih,vlpb,vlpf,vlpg,vlph,vmnb,vmnf,vmng,vmnh,\
+vmnlb,vmnlf,vmnlg,vmnlh,vmrhb,vmrhf,vmrhg,vmrhh,vmrlb,vmrlf,vmrlg,vmrlh,\
+vmxb,vmxf,vmxg,vmxh,vn,vnc,vno,vnot,vo,vone,vpdi,vperm,vpkf,vpkg,vpkh,\
+vpklsf,vpklsg,vpklsh,vpksf,vpksg,vpksh,vpopct,vpopctb,vpopctf,vpopctg,\
+vpopcth,vrepb,vrepf,vrepg,vreph,vrepib,vrepif,vrepig,vrepih,vsb,vsbiq,vscbib,\
+vscbif,vscbig,vscbih,vscbiq,vsegb,vsegf,vsegh,vsel,vsf,vsg,vsh,vsl,vsldb,vsq,\
+vsra,vsrl,vuphb,vuphf,vuphh,vuplb,vuplf,vuplhb,vuplhf,vuplhh,vuplhw,vupllb,\
+vupllf,vupllh,vx,vzero,wfcedb,wfcesb,wfchdb,wfchedb,wfchesb,wfchexb,wfchsb,\
+wfchxb,wflcdb,wflcsb,wflcxb,wflndb,wflnsb,wflnxb,wflpdb,wflpsb,wflpxb,xi,xiy")) "nothing")
 
 (define_insn_reservation "z13_2" 2
   (and (eq_attr "cpu" "z13")
-       (eq_attr "mnemonic" "seb,vcksm,vfadb,vleib,vchgs,vleif,vleig,vleih,\
-vgbm,verimb,vone,verimf,verimg,verimh,verllvb,lpebr,verllvf,verllvg,verllvh,\
-vfeneb,wcdgb,vfenef,vfeneh,vchhs,vctzb,vctzf,vctzg,vctzh,vlcb,aeb,vlcf,\
-vlcg,vlch,vfmsdb,vgfmab,ltebr,vgfmaf,vgfmag,vgfmah,vmaeh,vsb,vsf,vsg,vsh,\
-vsl,vsq,lxebr,cdtr,fiebr,vupllb,vupllf,vupllh,vmrhb,madbr,vtm,vmrhf,vmrhg,\
-vmrhh,axtr,fiebra,vleb,cxtr,vlef,vleg,vleh,vpkf,vpkg,vpkh,vmlob,vmlof,vmloh,\
-lxdb,ldeb,vceqfs,adb,wflndb,lxeb,vn,vo,vchlb,vx,vchlf,vchlg,vchlh,vfcedbs,\
-vfcedb,vceqgs,cxbr,msdbr,vcdgb,vceqhs,meeb,lcxbr,vavglb,vavglf,vavglg,vavglh,\
-vmrlb,vmrlf,vmrlg,vmrlh,vmxb,tcdb,vmahh,vsrlb,wcgdb,lcdbr,\
-vistrbs,vrepb,wfmdb,vrepf,vrepg,vreph,ler,wcdlgb,ley,vistrb,vistrf,vistrh,\
-tceb,vsumqf,vsumqg,vesrlb,vfeezbs,maebr,vesrlf,vesrlg,vesrlh,vmeb,vmef,\
-vmeh,meebr,vflcdb,wfmadb,vperm,sxtr,vclzf,vgm,vgmb,vgmf,vgmg,vgmh,tdcxt,\
-vzero,msebr,veslb,veslf,veslg,vfenezb,vfenezf,vfenezh,vistrfs,vchf,vchg,\
-vchh,vmhb,vmhf,vmhh,cdb,veslvb,ledbr,veslvf,veslvg,veslvh,wclgdb,vfmdb,\
-vmnlb,vmnlf,vmnlg,vmnlh,vclzb,vfeezfs,vclzg,vclzh,mdb,vmxlb,vmxlf,vmxlg,\
-vmxlh,ltdtr,vsbcbiq,ceb,sebr,vistrhs,lxdtr,lcebr,vab,vaf,vag,vah,ltxtr,\
-vlpf,vlpg,vsegb,vaq,vsegf,vsegh,sdtr,cdbr,vfeezhs,le,wldeb,vfmadb,\
-vchlbs,vacccq,vmaleb,vsel,vmalef,vmaleh,vflndb,mdbr,vmlb,wflpdb,ldetr,vpksfs,\
-vpksf,vpksg,vpksh,vmaeb,veslh,vmaef,vpklsf,vpklsg,vpklsh,verllb,vchb,verllf,\
-verllg,verllh,wfsdb,maeb,vclgdb,vftcidb,vpksgs,vmxf,vmxg,vmxh,fidbra,vmnb,\
-vmnf,vmng,vfchedbs,lnebr,vfidb,msdb,vmalhb,vmalhf,vmalhh,vpkshs,vfsdb,vmalhw,\
-ltdbr,vmob,vmof,vmoh,vchlfs,mseb,vcdlgb,vlpb,wfmsdb,vlph,vmahb,vldeb,vmahf,\
-vgfmb,fidbr,aebr,wledb,vchlgs,vesravb,vfchdbs,cebr,vesravf,vesravg,vesravh,\
-vcgdb,fixbra,vrepib,vrepif,vrepig,vrepih,tdcdt,vchlhs,vceqb,vscbib,vceqf,\
-vceqg,vscbif,vscbig,vscbih,vmlhw,vscbiq,vuphb,vuphf,vuphh,vfchedb,tdcet,\
-vslb,vpklsfs,adbr,vfchdb,fixbr,vpklsgs,vsldb,vmleb,vmlef,vmleh,cpsdr,vmalb,\
-vmalf,vavgb,vmlf,vavgf,vavgg,vavgh,vgfmf,vgfmg,vgfmh,fidtr,vpklshs,lndbr,\
-vno,lpdbr,vacq,vledb,vchbs,vfeeb,vfeef,vfeeh,fixtr,vaccb,wfadb,vaccf,vaccg,\
-vacch,vnot,vmalob,vaccq,vmalof,vmaloh,lpxbr,vuplb,vuplf,axbr,lxdbr,ltxbr,\
-vpopct,vpdi,vmlhb,vmlhf,vmlhh,sdbr,vnc,vsumb,vsrab,vsumh,vmaob,vmaof,vmaoh,\
-vesrlvb,vesrlvf,vesrlvg,vesrlvh,tcxb,vceqbs,vceqh,lnxbr,sxbr,vesrab,wflcdb,\
-vesraf,vesrag,vesrah,vflpdb,vmnh,vsbiq,adtr,vsra,vsrl,vuplhb,sdb,vuplhf,\
-vuplhh,vsumgf,vsumgh,ldebr,vuplhw,vchfs,madb")) "nothing")
+(eq_attr "mnemonic" "cdb,cdbr,cebr,ear,ipm,l,lcbb,lcdbr,lcebr,ld,lde,\
+ldy,lg,lgdr,lgrl,llc,llgc,llgf,llgfrl,llgh,llghrl,llgt,llh,llhrl,lm,lmg,\
+lmy,lndbr,lnebr,lpdbr,lpebr,lrl,ltdbr,ltebr,ly,popcnt,sar,tcdb,tceb,\
+vceqbs,vceqfs,vceqgs,vceqhs,vchbs,vchfs,vchgs,vchhs,vchlbs,vchlfs,vchlgs,\
+vchlhs,vfcedbs,vfcesbs,vfchdbs,vfchedbs,vfchesbs,vfchsbs,vfeeb,vfeef,vfeeh,\
+vfeneb,vfenef,vfeneh,vfenezb,vfenezf,vfenezh,vftcidb,vftcisb,vistrb,vistrf,\
+vistrh,vllezb,vllezf,vllezg,vllezh,vllezlf,vlrepb,vlrepf,vlrepg,vlreph,vlvgp,\
+vpklsfs,vpklsgs,vpklshs,vpksfs,vpksgs,vpkshs,vslb,vsrab,vsrlb,wfcdb,wfcexbs,\
+wfchexbs,wfchxbs,wfcsb")) "nothing")
 
 (define_insn_reservation "z13_3" 3
   (and (eq_attr "cpu" "z13")
-       (eq_attr "mnemonic" "ledtr")) "nothing")
+(eq_attr "mnemonic" "cds,cdsy,std,stdy,ste,stey,vcksm,vfeezbs,\
+vfeezhs,vgfmab,vgfmaf,vgfmag,vgfmah,vgfmb,vgfmf,vgfmg,vgfmh,vistrbs,vistrfs,\
+vl,vlbb,vlgvf,vlgvg,vlgvh,vll,vmaeb,vmaef,vmaeh,vmahb,vmahf,vmahh,vmalb,\
+vmaleb,vmalef,vmaleh,vmalf,vmalhb,vmalhf,vmalhh,vmalhw,vmalob,vmalof,vmaloh,\
+vmaob,vmaof,vmaoh,vmeb,vmef,vmeh,vmhb,vmhf,vmhh,vmlb,vmleb,vmlef,vmleh,vmlf,\
+vmlhb,vmlhf,vmlhh,vmlhw,vmlob,vmlof,vmloh,vmob,vmof,vmoh,vsumb,vsumgf,\
+vsumgh,vsumh,vsumqf,vsumqg,vtm")) "nothing")
 
 (define_insn_reservation "z13_4" 4
   (and (eq_attr "cpu" "z13")
-       (eq_attr "mnemonic" "dr,mxbr,dlr")) "nothing")
+(eq_attr "mnemonic" "bas,basr,chhsi,clc,ex,lam,lcgfr,lxr,lzxr,mghi,\
+mh,mhi,mhy,mvc,oc,tabort,tbegin,tbeginc,tend,vst,vstl,xc")) "nothing")
+
+(define_insn_reservation "z13_5" 5
+  (and (eq_attr "cpu" "z13")
+(eq_attr "mnemonic" "alc,alcg,alcgr,alcr,cs,csg,csy,lngfr,lpgfr,ms,\
+msfi,msgf,msgfi,msgfr,msr,msy,rnsbg,rosbg,rxsbg,slb,slbg,slbgr,slbr,stm,\
+stmg,stmy")) "nothing")
 
 (define_insn_reservation "z13_6" 6
   (and (eq_attr "cpu" "z13")
-       (eq_attr "mnemonic" "debr,sqeb,deb,sqebr")) "nothing")
+(eq_attr "mnemonic" "adb,adbr,aeb,aebr,fidbr,fidbra,fiebr,fiebra,\
+ldeb,ldebr,ledbr,madbr,mdbr,meeb,meebr,msdbr,sdb,sdbr,seb,sebr,sfpc,wcdgb,\
+wcdlgb,wcgdb,wclgdb,wfadb,wfasb,wfaxb,wfisb,wfixb,wflld,wfmadb,wfmasb,wfmaxb,\
+wfmdb,wfmsb,wfmsdb,wfmssb,wfmsxb,wfmxb,wfsdb,wfssb,wfsxb,wldeb,wledb")) "nothing")
 
 (define_insn_reservation "z13_7" 7
   (and (eq_attr "cpu" "z13")
-       (eq_attr "mnemonic" "mdtr")) "nothing")
+(eq_attr "mnemonic" "adtr,cdtr,fidtr,ldetr,msg,msgr,sdtr,tdcdt,tdcet,\
+vcdgb,vcdlgb,vcgdb,vclgdb,vfadb,vfasb,vfidb,vfisb,vfmadb,vfmasb,vfmdb,vfmsb,\
+vfmsdb,vfmssb,vfsdb,vfssb,vldeb,vledb")) "nothing")
 
 (define_insn_reservation "z13_8" 8
   (and (eq_attr "cpu" "z13")
-       (eq_attr "mnemonic" "wfddb,ddb,vfddb,ddbr")) "nothing")
+(eq_attr "mnemonic" "cdsg,lpq,stpq,vgef,vgeg,vsteb")) "nothing")
 
 (define_insn_reservation "z13_9" 9
   (and (eq_attr "cpu" "z13")
-       (eq_attr "mnemonic" "dsgr,wfsqdb,dsgfr,sqdb,sqdbr,vfsqdb")) "nothing")
+(eq_attr "mnemonic" "cxfbr,cxgbr,cxlgbr,stam")) "nothing")
 
-(define_insn_reservation "z13_13" 13
+(define_insn_reservation "z13_10" 10
+  (and (eq_attr "cpu" "z13")
+(eq_attr "mnemonic" "cdfbr,cdgbr,cdlfbr,cdlgbr,cefbr,cegbr,celfbr,\
+celgbr,flogr,m,madb,maeb,maebr,mfy,ml,mlr,mr,msdb,mseb,msebr")) "nothing")
+
+(define_insn_reservation "z13_11" 11
+  (and (eq_attr "cpu" "z13")
+(eq_attr "mnemonic" "lxdb,lxdbr,lxeb,lxebr,vscef,vsceg")) "nothing")
+
+(define_insn_reservation "z13_12" 12
   (and (eq_attr "cpu" "z13")
-       (eq_attr "mnemonic" "mxtr,ddtr")) "nothing")
+(eq_attr "mnemonic" "cfdbr,cfebr,cgdbr,cgebr,clfdbr,clfebr,clgdbr,\
+clgebr,cxbr,cxtr,mlg,mlgr,tcxb,tdcxt")) "nothing")
 
-(define_insn_reservation "z13_16" 16
+(define_insn_reservation "z13_13" 13
   (and (eq_attr "cpu" "z13")
-       (eq_attr "mnemonic" "sqxbr")) "nothing")
+(eq_attr "mnemonic" "axbr,axtr,fixbr,fixbra,fixtr,lcxbr,lnxbr,lpxbr,\
+ltxbr,ltxtr,lxdtr,sxbr,sxtr")) "nothing")
 
-(define_insn_reservation "z13_17" 17
+(define_insn_reservation "z13_14" 14
   (and (eq_attr "cpu" "z13")
-       (eq_attr "mnemonic" "dxtr")) "nothing")
+(eq_attr "mnemonic" "cfxbr,cgxbr,clfxbr,clgxbr,ledtr")) "nothing")
 
 (define_insn_reservation "z13_20" 20
   (and (eq_attr "cpu" "z13")
-       (eq_attr "mnemonic" "dxbr,dlgr")) "nothing")
+(eq_attr "mnemonic" "cdftr,cdgtr,cdlftr,cdlgtr,cgdtr,cgxtr,clfxtr,\
+clgdtr,clgxtr,cxftr,cxgtr,cxlftr,cxlgtr,d,ddb,ddbr,ddtr,deb,debr,dl,dlg,dlgr,\
+dlr,dr,dsg,dsgf,dsgfr,dsgr,dxbr,dxtr,efpc,mdtr,mxbr,mxtr,sqdb,sqdbr,sqeb,\
+sqebr,sqxbr,vfddb,vfdsb,vfsqdb,vfsqsb,wfddb,wfdsb,wfdxb,wfsqdb,wfsqxb")) "nothing")
 
diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index aff271806b7..ac17e46abf3 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -344,20 +344,17 @@ extern int reload_completed;
 
 /* Kept up to date using the SCHED_VARIABLE_ISSUE hook.  */
 static rtx_insn *last_scheduled_insn;
-#define MAX_SCHED_UNITS 3
+#define MAX_SCHED_UNITS 4
 static int last_scheduled_unit_distance[MAX_SCHED_UNITS];
 
 #define NUM_SIDES 2
 static int current_side = 1;
-#define LONGRUNNING_THRESHOLD 5
+#define LONGRUNNING_THRESHOLD 20
 
 /* Estimate of number of cycles a long-running insn occupies an
    execution unit.  */
-static unsigned fxu_longrunning[NUM_SIDES];
-static unsigned vfu_longrunning[NUM_SIDES];
-
-/* Factor to scale latencies by, determined by measurements.  */
-#define LATENCY_FACTOR 4
+static unsigned fxd_longrunning[NUM_SIDES];
+static unsigned fpd_longrunning[NUM_SIDES];
 
 /* The maximum score added for an instruction whose unit hasn't been
    in use for MAX_SCHED_MIX_DISTANCE steps.  Increase this value to
@@ -14325,13 +14322,15 @@ s390_get_unit_mask (rtx_insn *insn, int *units)
     {
     case PROCESSOR_2964_Z13:
     case PROCESSOR_3906_Z14:
-      *units = 3;
+      *units = 4;
       if (get_attr_z13_unit_lsu (insn))
 	mask |= 1 << 0;
-      if (get_attr_z13_unit_fxu (insn))
+      if (get_attr_z13_unit_fxa (insn))
 	mask |= 1 << 1;
-      if (get_attr_z13_unit_vfu (insn))
+      if (get_attr_z13_unit_fxb (insn))
 	mask |= 1 << 2;
+      if (get_attr_z13_unit_vfu (insn))
+	mask |= 1 << 3;
       break;
     default:
       gcc_unreachable ();
@@ -14421,12 +14420,12 @@ s390_sched_score (rtx_insn *insn)
       /* Try to delay long-running insns when side is busy.  */
       if (latency > LONGRUNNING_THRESHOLD)
 	{
-	  if (get_attr_z13_unit_fxu (insn) && fxu_longrunning[current_side]
-	      && fxu_longrunning[other_side] <= fxu_longrunning[current_side])
+	  if (get_attr_z13_unit_fxu (insn) && fxd_longrunning[current_side]
+	      && fxd_longrunning[other_side] <= fxd_longrunning[current_side])
 	    score = MAX (0, score - 10);
 
-	  if (get_attr_z13_unit_vfu (insn) && vfu_longrunning[current_side]
-	      && vfu_longrunning[other_side] <= vfu_longrunning[current_side])
+	  if (get_attr_z13_unit_vfu (insn) && fpd_longrunning[current_side]
+	      && fpd_longrunning[other_side] <= fpd_longrunning[current_side])
 	    score = MAX (0, score - 10);
 	}
     }
@@ -14611,19 +14610,19 @@ s390_sched_variable_issue (FILE *file, int verbose, rtx_insn *insn, int more)
 
       for (int i = 0; i < 2; i++)
 	{
-	  if (fxu_longrunning[i] >= 1)
-	    fxu_longrunning[i] -= 1;
-	  if (vfu_longrunning[i] >= 1)
-	    vfu_longrunning[i] -= 1;
+	  if (fxd_longrunning[i] >= 1)
+	    fxd_longrunning[i] -= 1;
+	  if (fpd_longrunning[i] >= 1)
+	    fpd_longrunning[i] -= 1;
 	}
 
       unsigned latency = insn_default_latency (insn);
       if (latency > LONGRUNNING_THRESHOLD)
 	{
 	  if (get_attr_z13_unit_fxu (insn))
-	    fxu_longrunning[current_side] = latency * LATENCY_FACTOR;
+	    fxd_longrunning[current_side] = latency;
 	  else
-	    vfu_longrunning[current_side] = latency * LATENCY_FACTOR;
+	    fpd_longrunning[current_side] = latency;
 	}
 
       if (verbose > 5)
-- 
2.17.0

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 5/7] S/390: Add side to schedule-mix calculations.
  2019-03-11 12:53 [PATCH 0/7] S/390: Rework instruction scheduling Robin Dapp
                   ` (5 preceding siblings ...)
  2019-03-11 12:53 ` [PATCH 1/7] S/390: Change z13 pipeline description Robin Dapp
@ 2019-03-11 13:13 ` Robin Dapp
  2019-03-11 15:51 ` [PATCH 0/7] S/390: Rework instruction scheduling Andreas Krebbel
  7 siblings, 0 replies; 13+ messages in thread
From: Robin Dapp @ 2019-03-11 13:13 UTC (permalink / raw)
  To: gcc-patches; +Cc: krebbel, iii, rdapp

This patch makes the scheduling score execution-side aware.

---
 gcc/config/s390/s390.c | 32 ++++++++++++++++++--------------
 1 file changed, 18 insertions(+), 14 deletions(-)

diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index 249df00268a..4dcf1be4445 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -344,11 +344,11 @@ extern int reload_completed;
 
 /* Kept up to date using the SCHED_VARIABLE_ISSUE hook.  */
 static rtx_insn *last_scheduled_insn;
-#define MAX_SCHED_UNITS 4
-static int last_scheduled_unit_distance[MAX_SCHED_UNITS];
-
 #define NUM_SIDES 2
 
+#define MAX_SCHED_UNITS 4
+static int last_scheduled_unit_distance[MAX_SCHED_UNITS][NUM_SIDES];
+
 /* Estimate of number of cycles a long-running insn occupies an
    execution unit.  */
 static int fxd_longrunning[NUM_SIDES];
@@ -14421,8 +14421,8 @@ s390_sched_score (rtx_insn *insn)
 	 CPU.  */
       for (i = 0; i < units; i++, m <<= 1)
 	if (m & unit_mask)
-	  score += (last_scheduled_unit_distance[i] * MAX_SCHED_MIX_SCORE /
-		    MAX_SCHED_MIX_DISTANCE);
+	  score += (last_scheduled_unit_distance[i][sched_state.side]
+	      * MAX_SCHED_MIX_SCORE / MAX_SCHED_MIX_DISTANCE);
 
       int other_side = 1 - sched_state.side;
 
@@ -14622,9 +14622,10 @@ s390_sched_variable_issue (FILE *file, int verbose, rtx_insn *insn, int more)
 
 	  for (i = 0; i < units; i++, m <<= 1)
 	    if (m & unit_mask)
-	      last_scheduled_unit_distance[i] = 0;
-	    else if (last_scheduled_unit_distance[i] < MAX_SCHED_MIX_DISTANCE)
-	      last_scheduled_unit_distance[i]++;
+	      last_scheduled_unit_distance[i][sched_state.side] = 0;
+	    else if (last_scheduled_unit_distance[i][sched_state.side]
+		< MAX_SCHED_MIX_DISTANCE)
+	      last_scheduled_unit_distance[i][sched_state.side]++;
 	}
 
       if ((mask & S390_SCHED_ATTR_MASK_CRACKED) != 0
@@ -14686,9 +14687,10 @@ s390_sched_variable_issue (FILE *file, int verbose, rtx_insn *insn, int more)
 
 	      s390_get_unit_mask (insn, &units);
 
-	      fprintf (file, ";;\t\tBACKEND: units unused for: ");
+	      fprintf (file, ";;\t\tBACKEND: units on this side unused for: ");
 	      for (j = 0; j < units; j++)
-		fprintf (file, "%d:%d ", j, last_scheduled_unit_distance[j]);
+		fprintf (file, "%d:%d ", j,
+		    last_scheduled_unit_distance[j][sched_state.side]);
 	      fprintf (file, "\n");
 	    }
 	}
@@ -14713,9 +14715,6 @@ s390_sched_init (FILE *file ATTRIBUTE_UNUSED,
 		 int verbose ATTRIBUTE_UNUSED,
 		 int max_ready ATTRIBUTE_UNUSED)
 {
-  last_scheduled_insn = NULL;
-  memset (last_scheduled_unit_distance, 0, MAX_SCHED_UNITS * sizeof (int));
-
   /* If the next basic block is most likely entered via a fallthru edge
      we keep the last sched state.  Otherwise we start a new group.
      The scheduler traverses basic blocks in "instruction stream" ordering
@@ -14729,7 +14728,12 @@ s390_sched_init (FILE *file ATTRIBUTE_UNUSED,
     ? NEXT_INSN (current_sched_info->prev_head) : NULL;
   basic_block bb = insn ? BLOCK_FOR_INSN (insn) : NULL;
   if (s390_tune < PROCESSOR_2964_Z13 || !s390_bb_fallthru_entry_likely (bb))
-    sched_state.group_state = 0;
+    {
+      last_scheduled_insn = NULL;
+      memset (last_scheduled_unit_distance, 0,
+	  MAX_SCHED_UNITS * NUM_SIDES * sizeof (int));
+      sched_state.group_state = 0;
+    }
 }
 
 /* This target hook implementation for TARGET_LOOP_UNROLL_ADJUST calculates
-- 
2.17.0

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0/7] S/390: Rework instruction scheduling.
  2019-03-11 12:53 [PATCH 0/7] S/390: Rework instruction scheduling Robin Dapp
                   ` (6 preceding siblings ...)
  2019-03-11 13:13 ` [PATCH 5/7] S/390: Add side to schedule-mix calculations Robin Dapp
@ 2019-03-11 15:51 ` Andreas Krebbel
  2019-03-12 10:01   ` Robin Dapp
  2019-03-12 10:22   ` [PATCH 8/8] S/390: Change test case to reflect scheduling changes Robin Dapp
  7 siblings, 2 replies; 13+ messages in thread
From: Andreas Krebbel @ 2019-03-11 15:51 UTC (permalink / raw)
  To: Robin Dapp, gcc-patches; +Cc: iii

On 11.03.19 13:53, Robin Dapp wrote:
> Hi,
> 
> this patch set adds new pipeline descriptions for z13 and z14.  Based
> on that, the scoring and some properties are handled differently in
> the scheduler hooks.
> 
> Regards
>  Robin
> 
> Robin Dapp (7):
>   S/390: Change z13 pipeline description.
>   S/390: Add z14 pipeline description.
>   S/390: Change handling of long-running instructions.
>   S/390: Change handling of group end.
>   S/390: Add side to schedule-mix calculations.
>   S/390: Add handling for group-of-two instructions.
>   S/390: Tune scheduling parameters.
> 
>  gcc/config/s390/2964.md | 373 ++++++++++++++++++++++------------------
>  gcc/config/s390/3906.md | 281 ++++++++++++++++++++++++++++++
>  gcc/config/s390/s390.c  | 303 +++++++++++++++++++-------------
>  gcc/config/s390/s390.h  |   2 +-
>  gcc/config/s390/s390.md |   3 +
>  5 files changed, 679 insertions(+), 283 deletions(-)
>  create mode 100644 gcc/config/s390/3906.md
> 

Please adjust the year and the author in gcc/config/s390/3906.md. Ok with that change.

Thanks!

Andreas

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0/7] S/390: Rework instruction scheduling.
  2019-03-11 15:51 ` [PATCH 0/7] S/390: Rework instruction scheduling Andreas Krebbel
@ 2019-03-12 10:01   ` Robin Dapp
  2019-03-12 12:12     ` Andreas Krebbel
  2019-03-12 10:22   ` [PATCH 8/8] S/390: Change test case to reflect scheduling changes Robin Dapp
  1 sibling, 1 reply; 13+ messages in thread
From: Robin Dapp @ 2019-03-12 10:01 UTC (permalink / raw)
  To: Andreas Krebbel, gcc-patches; +Cc: iii

[-- Attachment #1: Type: text/plain, Size: 468 bytes --]

> Please adjust the year and the author in gcc/config/s390/3906.md. Ok with that change.

Changed that and also simplified the longrunning checks.

gcc/ChangeLog:

2019-03-12  Robin Dapp  <rdapp@linux.ibm.com>

        * config/s390/s390.c (LONGRUNNING_THRESHOLD): Remove.
        (s390_is_fpd): Add.
        (s390_is_fxd): Add.
        (s390_is_longrunning): Add.
        (s390_sched_score): Use new functions.
        (s390_sched_variable_issue): Use new functions.

[-- Attachment #2: 0003-S-390-Change-handling-of-long-running-instructions.patch --]
[-- Type: text/x-patch, Size: 4299 bytes --]

From f92c9095f622453baf9607d1669b1f7e7048aae8 Mon Sep 17 00:00:00 2001
From: Robin Dapp <rdapp@linux.ibm.com>
Date: Wed, 27 Feb 2019 11:16:07 +0100
Subject: [PATCH 3/8] S/390: Change handling of long-running instructions.
This patch makes the detection of long-running instructions
independent of their latency but checks the execution unit.

---
 gcc/config/s390/s390.c | 80 +++++++++++++++++++++++++++++++-----------
 1 file changed, 60 insertions(+), 20 deletions(-)

diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index 95a4460dcf5..f93a94550cc 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -349,12 +349,11 @@ static int last_scheduled_unit_distance[MAX_SCHED_UNITS];
 
 #define NUM_SIDES 2
 static int current_side = 1;
-#define LONGRUNNING_THRESHOLD 20
 
 /* Estimate of number of cycles a long-running insn occupies an
    execution unit.  */
-static unsigned fxd_longrunning[NUM_SIDES];
-static unsigned fpd_longrunning[NUM_SIDES];
+static int fxd_longrunning[NUM_SIDES];
+static int fpd_longrunning[NUM_SIDES];
 
 /* The maximum score added for an instruction whose unit hasn't been
    in use for MAX_SCHED_MIX_DISTANCE steps.  Increase this value to
@@ -14357,6 +14356,35 @@ s390_get_unit_mask (rtx_insn *insn, int *units)
   return mask;
 }
 
+static bool
+s390_is_fpd (rtx_insn *insn)
+{
+  if (insn == NULL_RTX)
+    return false;
+
+  return get_attr_z13_unit_fpd (insn) || get_attr_z14_unit_fpd (insn);
+}
+
+static bool
+s390_is_fxd (rtx_insn *insn)
+{
+  if (insn == NULL_RTX)
+    return false;
+
+  return get_attr_z13_unit_fxd (insn) || get_attr_z14_unit_fxd (insn);
+}
+
+/* Returns TRUE if INSN is a long-running instruction.  */
+static bool
+s390_is_longrunning (rtx_insn *insn)
+{
+  if (insn == NULL_RTX)
+    return false;
+
+  return s390_is_fxd (insn) || s390_is_fpd (insn);
+}
+
+
 /* Return the scheduling score for INSN.  The higher the score the
    better.  The score is calculated from the OOO scheduling attributes
    of INSN and the scheduling state s390_sched_state.  */
@@ -14432,20 +14460,34 @@ s390_sched_score (rtx_insn *insn)
 	  score += (last_scheduled_unit_distance[i] * MAX_SCHED_MIX_SCORE /
 		    MAX_SCHED_MIX_DISTANCE);
 
-      unsigned latency = insn_default_latency (insn);
-
       int other_side = 1 - current_side;
 
       /* Try to delay long-running insns when side is busy.  */
-      if (latency > LONGRUNNING_THRESHOLD)
+      if (s390_is_longrunning (insn))
 	{
-	  if (get_attr_z13_unit_fxu (insn) && fxd_longrunning[current_side]
-	      && fxd_longrunning[other_side] <= fxd_longrunning[current_side])
-	    score = MAX (0, score - 10);
+	  if (s390_is_fxd (insn))
+	    {
+	      if (fxd_longrunning[sched_state.side]
+		  && fxd_longrunning[other_side]
+		  <= fxd_longrunning[sched_state.side])
+		score = MAX (0, score - 10);
+
+	      else if (fxd_longrunning[other_side]
+		  >= fxd_longrunning[sched_state.side])
+		score += 10;
+	    }
 
-	  if (get_attr_z13_unit_vfu (insn) && fpd_longrunning[current_side]
-	      && fpd_longrunning[other_side] <= fpd_longrunning[current_side])
-	    score = MAX (0, score - 10);
+	  if (s390_is_fpd (insn))
+	    {
+	      if (fpd_longrunning[sched_state.side]
+		  && fpd_longrunning[other_side]
+		  <= fpd_longrunning[sched_state.side])
+		score = MAX (0, score - 10);
+
+	      else if (fpd_longrunning[other_side]
+		  >= fpd_longrunning[sched_state.side])
+		score += 10;
+	    }
 	}
     }
 
@@ -14629,19 +14671,17 @@ s390_sched_variable_issue (FILE *file, int verbose, rtx_insn *insn, int more)
 
       for (int i = 0; i < 2; i++)
 	{
-	  if (fxd_longrunning[i] >= 1)
-	    fxd_longrunning[i] -= 1;
-	  if (fpd_longrunning[i] >= 1)
-	    fpd_longrunning[i] -= 1;
+	  fxd_longrunning[i] = MAX (0, fxd_longrunning[i] - 1);
+	  fpd_longrunning[i] = MAX (0, fpd_longrunning[i] - 1);
 	}
 
       unsigned latency = insn_default_latency (insn);
-      if (latency > LONGRUNNING_THRESHOLD)
+      if (s390_is_longrunning (insn))
 	{
-	  if (get_attr_z13_unit_fxu (insn))
-	    fxd_longrunning[current_side] = latency;
+	  if (s390_is_fxd (insn))
+	    fxd_longrunning[sched_state.side] = latency;
 	  else
-	    fpd_longrunning[current_side] = latency;
+	    fpd_longrunning[sched_state.side] = latency;
 	}
 
       if (verbose > 5)
-- 
2.17.0


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 8/8] S/390: Change test case to reflect scheduling changes.
  2019-03-11 15:51 ` [PATCH 0/7] S/390: Rework instruction scheduling Andreas Krebbel
  2019-03-12 10:01   ` Robin Dapp
@ 2019-03-12 10:22   ` Robin Dapp
  2019-03-12 12:35     ` Andreas Krebbel
  1 sibling, 1 reply; 13+ messages in thread
From: Robin Dapp @ 2019-03-12 10:22 UTC (permalink / raw)
  To: Andreas Krebbel, gcc-patches; +Cc: iii

[-- Attachment #1: Type: text/plain, Size: 157 bytes --]

This fixes a newly introduced test failure.


---

2019-03-12  Robin Dapp  <rdapp@linux.ibm.com>

        * gcc.target/s390/memset-1.c: Do not require stcy.

[-- Attachment #2: testcase-fix.diff --]
[-- Type: text/x-patch, Size: 937 bytes --]

diff --git a/gcc/testsuite/gcc.target/s390/memset-1.c b/gcc/testsuite/gcc.target/s390/memset-1.c
index 3e201df1aed..9463a77208b 100644
--- a/gcc/testsuite/gcc.target/s390/memset-1.c
+++ b/gcc/testsuite/gcc.target/s390/memset-1.c
@@ -74,7 +74,7 @@ void
   return __builtin_memset (s, c, 1029);
 }
 
-/* 2 stc 1 stcy 3 mvc - displacement overflow after the first */
+/* 3 stc 3 mvc - displacement overflow after the first */
 void
 *memset10(void *s, int c)
 {
@@ -172,6 +172,6 @@ void
 /* { dg-final { scan-assembler-times "mvi\\s" 1 } } */
 /* { dg-final { scan-assembler-times "mvc\\s" 20 } } */
 /* { dg-final { scan-assembler-times "xc\\s" 28 } } */
-/* { dg-final { scan-assembler-times "stc\\s" 21 } } */
-/* { dg-final { scan-assembler-times "stcy\\s" 1 } } */
+/* { dg-final { scan-assembler-times "stc\\s" 22 } } */
+/* { dg-final { scan-assembler-times "stcy\\s" 0 } } */
 /* { dg-final { scan-assembler-times "pfd\\s" 2 } } */

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0/7] S/390: Rework instruction scheduling.
  2019-03-12 10:01   ` Robin Dapp
@ 2019-03-12 12:12     ` Andreas Krebbel
  0 siblings, 0 replies; 13+ messages in thread
From: Andreas Krebbel @ 2019-03-12 12:12 UTC (permalink / raw)
  To: Robin Dapp, gcc-patches; +Cc: iii

On 12.03.19 11:00, Robin Dapp wrote:
>> Please adjust the year and the author in gcc/config/s390/3906.md. Ok with that change.
> 
> Changed that and also simplified the longrunning checks.
> 
> gcc/ChangeLog:
> 
> 2019-03-12  Robin Dapp  <rdapp@linux.ibm.com>
> 
>         * config/s390/s390.c (LONGRUNNING_THRESHOLD): Remove.
>         (s390_is_fpd): Add.
>         (s390_is_fxd): Add.
>         (s390_is_longrunning): Add.
>         (s390_sched_score): Use new functions.
>         (s390_sched_variable_issue): Use new functions.
> 

Ok. Thanks!

Andreas

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 8/8] S/390: Change test case to reflect scheduling changes.
  2019-03-12 10:22   ` [PATCH 8/8] S/390: Change test case to reflect scheduling changes Robin Dapp
@ 2019-03-12 12:35     ` Andreas Krebbel
  0 siblings, 0 replies; 13+ messages in thread
From: Andreas Krebbel @ 2019-03-12 12:35 UTC (permalink / raw)
  To: Robin Dapp, gcc-patches; +Cc: iii

On 12.03.19 11:02, Robin Dapp wrote:
> This fixes a newly introduced test failure.
> 
> 
> ---
> 
> 2019-03-12  Robin Dapp  <rdapp@linux.ibm.com>
> 
>         * gcc.target/s390/memset-1.c: Do not require stcy.
> 

Ok. Thanks!

Andreas

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2019-03-12 12:12 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-11 12:53 [PATCH 0/7] S/390: Rework instruction scheduling Robin Dapp
2019-03-11 12:53 ` [PATCH 7/7] S/390: Tune scheduling parameters Robin Dapp
2019-03-11 12:53 ` [PATCH 4/7] S/390: Change handling of group end Robin Dapp
2019-03-11 12:53 ` [PATCH 6/7] S/390: Add handling for group-of-two instructions Robin Dapp
2019-03-11 12:53 ` [PATCH 2/7] S/390: Add z14 pipeline description Robin Dapp
2019-03-11 12:53 ` [PATCH 3/7] S/390: Change handling of long-running instructions Robin Dapp
2019-03-11 12:53 ` [PATCH 1/7] S/390: Change z13 pipeline description Robin Dapp
2019-03-11 13:13 ` [PATCH 5/7] S/390: Add side to schedule-mix calculations Robin Dapp
2019-03-11 15:51 ` [PATCH 0/7] S/390: Rework instruction scheduling Andreas Krebbel
2019-03-12 10:01   ` Robin Dapp
2019-03-12 12:12     ` Andreas Krebbel
2019-03-12 10:22   ` [PATCH 8/8] S/390: Change test case to reflect scheduling changes Robin Dapp
2019-03-12 12:35     ` Andreas Krebbel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).