ia64 bundling tweek

Richard Henderson rth@cygnus.com
Fri Sep 1 18:09:00 GMT 2000


There are only two M and I units on Itanium.  The way in which we
choose default templates happens to result in nop.i being chosen
most of the time.  This results in overcommitting execution units
and unnecessary stalls.

Here we explicitly prefer nop.f and nop.b.


r~


        * config/tc-ia64.c (match): Don't inline.
        (extra_goodness): New.
        (md_begin): Prefer nop.f and nop.b for best_template.

Index: gas/config/tc-ia64.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gas/config/tc-ia64.c,v
retrieving revision 1.63
diff -c -p -d -r1.63 tc-ia64.c
*** tc-ia64.c	2000/08/23 20:38:44	1.63
--- tc-ia64.c	2000/09/01 23:02:02
*************** IA-64 options:\n\
*** 5664,5670 ****
  	stream);
  }
  
! static inline int
  match (int templ, int type, int slot)
  {
    enum ia64_unit unit;
--- 5664,5672 ----
  	stream);
  }
  
! /* Return true if TYPE fits in TEMPL at SLOT.  */
! 
! static int
  match (int templ, int type, int slot)
  {
    enum ia64_unit unit;
*************** match (int templ, int type, int slot)
*** 5687,5692 ****
--- 5689,5707 ----
    return result;
  }
  
+ /* Add a bit of extra goodness if a nop of type F or B would fit
+    in TEMPL at SLOT.  */
+ 
+ static inline int
+ extra_goodness (int templ, int slot)
+ {
+   if (match (templ, IA64_TYPE_F, slot))
+     return 2;
+   if (match (templ, IA64_TYPE_B, slot))
+     return 1;
+   return 0;
+ }
+ 
  /* This function is called once, at assembler startup time.  It sets
     up all the tables, etc. that the MD part of the assembler will need
     that can be determined before arguments are parsed.  */
*************** md_begin ()
*** 5739,5745 ****
        symbol_new (".<ltoff.fptr>", undefined_section, FUNC_LT_FPTR_RELATIVE,
  		  &zero_address_frag);
  
!   /* compute the table of best templates: */
    for (i = 0; i < IA64_NUM_TYPES; ++i)
      for (j = 0; j < IA64_NUM_TYPES; ++j)
        for (k = 0; k < IA64_NUM_TYPES; ++k)
--- 5754,5764 ----
        symbol_new (".<ltoff.fptr>", undefined_section, FUNC_LT_FPTR_RELATIVE,
  		  &zero_address_frag);
  
!   /* Compute the table of best templates.  We compute goodness as a 
!      base 4 value, in which each match counts for 3, each F counts
!      for 2, each B counts for 1.  This should maximize the number of
!      F and B nops in the chosen bundles, which is good because these
!      pipelines are least likely to be overcommitted.  */
    for (i = 0; i < IA64_NUM_TYPES; ++i)
      for (j = 0; j < IA64_NUM_TYPES; ++j)
        for (k = 0; k < IA64_NUM_TYPES; ++k)
*************** md_begin ()
*** 5753,5776 ****
  		  if (match (t, j, 1))
  		    {
  		      if (match (t, k, 2))
! 			goodness = 3;
  		      else
! 			goodness = 2;
  		    }
  		  else if (match (t, j, 2))
! 		    goodness = 2;
  		  else
! 		    goodness = 1;
  		}
  	      else if (match (t, i, 1))
  		{
  		  if (match (t, j, 2))
! 		    goodness = 2;
  		  else
! 		    goodness = 1;
  		}
  	      else if (match (t, i, 2))
! 		goodness = 1;
  
  	      if (goodness > best)
  		{
--- 5772,5799 ----
  		  if (match (t, j, 1))
  		    {
  		      if (match (t, k, 2))
! 			goodness = 3 + 3 + 3;
  		      else
! 			goodness = 3 + 3 + extra_goodness (t, 2);
  		    }
  		  else if (match (t, j, 2))
! 		    goodness = 3 + 3 + extra_goodness (t, 1);
  		  else
! 		    {
! 		      goodness = 3;
! 		      goodness += extra_goodness (t, 1);
! 		      goodness += extra_goodness (t, 2);
! 		    }
  		}
  	      else if (match (t, i, 1))
  		{
  		  if (match (t, j, 2))
! 		    goodness = 3 + 3;
  		  else
! 		    goodness = 3 + extra_goodness (t, 2);
  		}
  	      else if (match (t, i, 2))
! 		goodness = 3 + extra_goodness (t, 1);
  
  	      if (goodness > best)
  		{


More information about the Binutils mailing list