This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [3.4-BIB] Use FFREEp


> On Sat, Nov 23, 2002 at 12:47:57PM +0100, Jan Hubicka wrote:
> > Would be patch OK with that change?
> 
> I've deleted the old one, so I can't go back and look.
> Forward me the new one?

Hi,
I am just testing the attached patch.
It updates the push?f into aborts to make things cleaner.
Fri Nov 22 20:28:35 CET 2002  Jan Hubicka  <jh@suse.cz>
	* i386.c (x86_use_ffreep): New global variable.
	* i386.h (x86_use_frfeep): Declare
	(TARGET_USE_FFREEP): New macro
	* i386.md  (movs?f*): Use freep when asked for.
	(push?f): Remove dead code.
Index: i386.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.c,v
retrieving revision 1.447.2.26
diff -c -3 -p -r1.447.2.26 i386.c
*** i386.c	20 Nov 2002 22:25:16 -0000	1.447.2.26
--- i386.c	23 Nov 2002 23:16:15 -0000
*************** const int x86_sse_partial_reg_dependency
*** 506,511 ****
--- 506,512 ----
  const int x86_sse_partial_regs = m_ATHLON_K8;
  const int x86_sse_typeless_stores = m_ATHLON_K8;
  const int x86_sse_load0_by_pxor = m_PPRO | m_PENT4;
+ const int x86_use_ffreep = m_ATHLON_K8;
  
  /* In case the avreage insn count for single function invocation is
     lower than this constant, emit fast (but longer) prologue and
Index: i386.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.h,v
retrieving revision 1.280.4.18
diff -c -3 -p -r1.280.4.18 i386.h
*** i386.h	20 Nov 2002 21:00:39 -0000	1.280.4.18
--- i386.h	23 Nov 2002 23:16:17 -0000
*************** extern const int x86_epilogue_using_move
*** 229,234 ****
--- 229,235 ----
  extern const int x86_arch_always_fancy_math_387, x86_shift1;
  extern const int x86_sse_partial_reg_dependency, x86_sse_partial_regs;
  extern const int x86_sse_typeless_stores, x86_sse_load0_by_pxor;
+ extern const int x86_use_ffreep;
  extern int x86_prefetch_sse;
  
  #define TARGET_USE_LEAVE (x86_use_leave & CPUMASK)
*************** extern int x86_prefetch_sse;
*** 277,282 ****
--- 278,284 ----
  #define TARGET_DECOMPOSE_LEA (x86_decompose_lea & CPUMASK)
  #define TARGET_PREFETCH_SSE (x86_prefetch_sse)
  #define TARGET_SHIFT1 (x86_shift1 & CPUMASK)
+ #define TARGET_USE_FFREEP (x86_use_ffreep & CPUMASK)
  
  #define TARGET_STACK_PROBE (target_flags & MASK_STACK_PROBE)
  
Index: i386.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.md,v
retrieving revision 1.380.4.28
diff -c -3 -p -r1.380.4.28 i386.md
*** i386.md	20 Nov 2002 21:00:39 -0000	1.380.4.28
--- i386.md	23 Nov 2002 23:16:28 -0000
***************
*** 2056,2077 ****
  {
    switch (which_alternative)
      {
-     case 0:
-       /* %%% We loose REG_DEAD notes for controling pops if we split late.  */
-       operands[0] = gen_rtx_MEM (SFmode, stack_pointer_rtx);
-       operands[2] = stack_pointer_rtx;
-       operands[3] = GEN_INT (4);
-       if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
- 	return "sub{l}\t{%3, %2|%2, %3}\;fstp%z0\t%y0";
-       else
- 	return "sub{l}\t{%3, %2|%2, %3}\;fst%z0\t%y0";
- 
      case 1:
        return "push{l}\t%1";
-     case 2:
-       return "#";
  
      default:
        abort ();
      }
  }
--- 2056,2066 ----
  {
    switch (which_alternative)
      {
      case 1:
        return "push{l}\t%1";
  
      default:
+       /* This insn should be already splitted before reg-stack.  */
        abort ();
      }
  }
***************
*** 2085,2107 ****
  {
    switch (which_alternative)
      {
-     case 0:
-       /* %%% We loose REG_DEAD notes for controling pops if we split late.  */
-       operands[0] = gen_rtx_MEM (SFmode, stack_pointer_rtx);
-       operands[2] = stack_pointer_rtx;
-       operands[3] = GEN_INT (8);
-       if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
- 	return "sub{q}\t{%3, %2|%2, %3}\;fstp%z0\t%y0";
-       else
- 	return "sub{q}\t{%3, %2|%2, %3}\;fst%z0\t%y0";
- 
      case 1:
        return "push{q}\t%q1";
  
!     case 2:
!       return "#";
! 
!     default:
        abort ();
      }
  }
--- 2074,2083 ----
  {
    switch (which_alternative)
      {
      case 1:
        return "push{q}\t%q1";
  
!       /* This insn should be already splitted before reg-stack.  */
        abort ();
      }
  }
***************
*** 2149,2155 ****
      case 0:
        if (REG_P (operands[1])
            && find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
!         return "fstp\t%y0";
        else if (STACK_TOP_P (operands[0]))
          return "fld%z1\t%y1";
        else
--- 2125,2136 ----
      case 0:
        if (REG_P (operands[1])
            && find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
! 	{
! 	  if (REGNO (operands[0]) == FIRST_STACK_REG
! 	      && TARGET_USE_FFREEP)
! 	    return "ffreep\t%y0";
!           return "fstp\t%y0";
! 	}
        else if (STACK_TOP_P (operands[0]))
          return "fld%z1\t%y1";
        else
***************
*** 2266,2291 ****
  	(match_operand:DF 1 "general_no_elim_operand" "f#Y,Fo#fY,*r#fY,Y#f"))]
    "!TARGET_64BIT && !TARGET_INTEGER_DFMODE_MOVES"
  {
!   switch (which_alternative)
!     {
!     case 0:
!       /* %%% We loose REG_DEAD notes for controling pops if we split late.  */
!       operands[0] = gen_rtx_MEM (DFmode, stack_pointer_rtx);
!       operands[2] = stack_pointer_rtx;
!       operands[3] = GEN_INT (8);
!       if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
! 	return "sub{l}\t{%3, %2|%2, %3}\;fstp%z0\t%y0";
!       else
! 	return "sub{l}\t{%3, %2|%2, %3}\;fst%z0\t%y0";
! 
!     case 1:
!     case 2:
!     case 3:
!       return "#";
! 
!     default:
!       abort ();
!     }
  }
    [(set_attr "type" "multi")
     (set_attr "mode" "DF,SI,SI,DF")])
--- 2247,2254 ----
  	(match_operand:DF 1 "general_no_elim_operand" "f#Y,Fo#fY,*r#fY,Y#f"))]
    "!TARGET_64BIT && !TARGET_INTEGER_DFMODE_MOVES"
  {
!   /* This insn should be already splitted before reg-stack.  */
!   abort ();
  }
    [(set_attr "type" "multi")
     (set_attr "mode" "DF,SI,SI,DF")])
***************
*** 2295,2326 ****
  	(match_operand:DF 1 "general_no_elim_operand" "f#rY,rFo#fY,Y#rf"))]
    "TARGET_64BIT || TARGET_INTEGER_DFMODE_MOVES"
  {
!   switch (which_alternative)
!     {
!     case 0:
!       /* %%% We loose REG_DEAD notes for controling pops if we split late.  */
!       operands[0] = gen_rtx_MEM (DFmode, stack_pointer_rtx);
!       operands[2] = stack_pointer_rtx;
!       operands[3] = GEN_INT (8);
!       if (TARGET_64BIT)
! 	if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
! 	  return "sub{q}\t{%3, %2|%2, %3}\;fstp%z0\t%y0";
! 	else
! 	  return "sub{q}\t{%3, %2|%2, %3}\;fst%z0\t%y0";
!       else
! 	if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
! 	  return "sub{l}\t{%3, %2|%2, %3}\;fstp%z0\t%y0";
! 	else
! 	  return "sub{l}\t{%3, %2|%2, %3}\;fst%z0\t%y0";
! 
! 
!     case 1:
!     case 2:
!       return "#";
! 
!     default:
!       abort ();
!     }
  }
    [(set_attr "type" "multi")
     (set_attr "mode" "DF,SI,DF")])
--- 2258,2265 ----
  	(match_operand:DF 1 "general_no_elim_operand" "f#rY,rFo#fY,Y#rf"))]
    "TARGET_64BIT || TARGET_INTEGER_DFMODE_MOVES"
  {
!   /* This insn should be already splitted before reg-stack.  */
!   abort ();
  }
    [(set_attr "type" "multi")
     (set_attr "mode" "DF,SI,DF")])
***************
*** 2368,2374 ****
      case 0:
        if (REG_P (operands[1])
            && find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
!         return "fstp\t%y0";
        else if (STACK_TOP_P (operands[0]))
          return "fld%z1\t%y1";
        else
--- 2307,2318 ----
      case 0:
        if (REG_P (operands[1])
            && find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
! 	{
! 	  if (REGNO (operands[0]) == FIRST_STACK_REG
! 	      && TARGET_USE_FFREEP)
! 	    return "ffreep\t%y0";
!           return "fstp\t%y0";
! 	}
        else if (STACK_TOP_P (operands[0]))
          return "fld%z1\t%y1";
        else
***************
*** 2376,2382 ****
  
      case 1:
        if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
!         return "fstp%z0\t%y0";
        else
          return "fst%z0\t%y0";
  
--- 2320,2331 ----
  
      case 1:
        if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
! 	{
! 	  if (REGNO (operands[0]) == FIRST_STACK_REG
! 	      && TARGET_USE_FFREEP)
! 	    return "ffreep\t%y0";
!           return "fstp\t%y0";
! 	}
        else
          return "fst%z0\t%y0";
  
***************
*** 2482,2488 ****
      case 0:
        if (REG_P (operands[1])
            && find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
!         return "fstp\t%y0";
        else if (STACK_TOP_P (operands[0]))
          return "fld%z1\t%y1";
        else
--- 2431,2442 ----
      case 0:
        if (REG_P (operands[1])
            && find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
! 	{
! 	  if (REGNO (operands[0]) == FIRST_STACK_REG
! 	      && TARGET_USE_FFREEP)
! 	    return "ffreep\t%y0";
!           return "fstp\t%y0";
! 	}
        else if (STACK_TOP_P (operands[0]))
          return "fld%z1\t%y1";
        else
***************
*** 2490,2496 ****
  
      case 1:
        if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
!         return "fstp%z0\t%y0";
        else
          return "fst%z0\t%y0";
  
--- 2444,2455 ----
  
      case 1:
        if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
! 	{
! 	  if (REGNO (operands[0]) == FIRST_STACK_REG
! 	      && TARGET_USE_FFREEP)
! 	    return "ffreep\t%y0";
!           return "fstp\t%y0";
! 	}
        else
          return "fst%z0\t%y0";
  
***************
*** 2635,2659 ****
  	(match_operand:XF 1 "general_no_elim_operand" "f,Fo,*r"))]
    "!TARGET_64BIT && optimize_size"
  {
!   switch (which_alternative)
!     {
!     case 0:
!       /* %%% We loose REG_DEAD notes for controling pops if we split late.  */
!       operands[0] = gen_rtx_MEM (XFmode, stack_pointer_rtx);
!       operands[2] = stack_pointer_rtx;
!       operands[3] = GEN_INT (12);
!       if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
! 	return "sub{l}\t{%3, %2|%2, %3}\;fstp%z0\t%y0";
!       else
! 	return "sub{l}\t{%3, %2|%2, %3}\;fst%z0\t%y0";
! 
!     case 1:
!     case 2:
!       return "#";
! 
!     default:
!       abort ();
!     }
  }
    [(set_attr "type" "multi")
     (set_attr "mode" "XF,SI,SI")])
--- 2594,2601 ----
  	(match_operand:XF 1 "general_no_elim_operand" "f,Fo,*r"))]
    "!TARGET_64BIT && optimize_size"
  {
!   /* This insn should be already splitted before reg-stack.  */
!   abort ();
  }
    [(set_attr "type" "multi")
     (set_attr "mode" "XF,SI,SI")])
***************
*** 2663,2687 ****
  	(match_operand:TF 1 "general_no_elim_operand" "f,Fo,*r"))]
    "optimize_size"
  {
!   switch (which_alternative)
!     {
!     case 0:
!       /* %%% We loose REG_DEAD notes for controling pops if we split late.  */
!       operands[0] = gen_rtx_MEM (XFmode, stack_pointer_rtx);
!       operands[2] = stack_pointer_rtx;
!       operands[3] = GEN_INT (16);
!       if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
! 	return "sub{l}\t{%3, %2|%2, %3}\;fstp%z0\t%y0";
!       else
! 	return "sub{l}\t{%3, %2|%2, %3}\;fst%z0\t%y0";
! 
!     case 1:
!     case 2:
!       return "#";
! 
!     default:
!       abort ();
!     }
  }
    [(set_attr "type" "multi")
     (set_attr "mode" "XF,SI,SI")])
--- 2605,2612 ----
  	(match_operand:TF 1 "general_no_elim_operand" "f,Fo,*r"))]
    "optimize_size"
  {
!   /* This insn should be already splitted before reg-stack.  */
!   abort ();
  }
    [(set_attr "type" "multi")
     (set_attr "mode" "XF,SI,SI")])
***************
*** 2691,2714 ****
  	(match_operand:XF 1 "general_no_elim_operand" "f#r,ro#f"))]
    "!TARGET_64BIT && !optimize_size"
  {
!   switch (which_alternative)
!     {
!     case 0:
!       /* %%% We loose REG_DEAD notes for controling pops if we split late.  */
!       operands[0] = gen_rtx_MEM (XFmode, stack_pointer_rtx);
!       operands[2] = stack_pointer_rtx;
!       operands[3] = GEN_INT (12);
!       if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
! 	return "sub{l}\t{%3, %2|%2, %3}\;fstp%z0\t%y0";
!       else
! 	return "sub{l}\t{%3, %2|%2, %3}\;fst%z0\t%y0";
! 
!     case 1:
!       return "#";
! 
!     default:
!       abort ();
!     }
  }
    [(set_attr "type" "multi")
     (set_attr "mode" "XF,SI")])
--- 2616,2623 ----
  	(match_operand:XF 1 "general_no_elim_operand" "f#r,ro#f"))]
    "!TARGET_64BIT && !optimize_size"
  {
!   /* This insn should be already splitted before reg-stack.  */
!   abort ();
  }
    [(set_attr "type" "multi")
     (set_attr "mode" "XF,SI")])
***************
*** 2718,2747 ****
  	(match_operand:TF 1 "general_no_elim_operand" "f#r,rFo#f"))]
    "!optimize_size"
  {
!   switch (which_alternative)
!     {
!     case 0:
!       /* %%% We loose REG_DEAD notes for controling pops if we split late.  */
!       operands[0] = gen_rtx_MEM (XFmode, stack_pointer_rtx);
!       operands[2] = stack_pointer_rtx;
!       operands[3] = GEN_INT (16);
!       if (TARGET_64BIT)
! 	if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
! 	  return "sub{q}\t{%3, %2|%2, %3}\;fstp%z0\t%y0";
! 	else
! 	  return "sub{q}\t{%3, %2|%2, %3}\;fst%z0\t%y0";
!       else
! 	if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
! 	  return "sub{l}\t{%3, %2|%2, %3}\;fstp%z0\t%y0";
! 	else
! 	  return "sub{l}\t{%3, %2|%2, %3}\;fst%z0\t%y0";
! 
!     case 1:
!       return "#";
! 
!     default:
!       abort ();
!     }
  }
    [(set_attr "type" "multi")
     (set_attr "mode" "XF,SI")])
--- 2627,2634 ----
  	(match_operand:TF 1 "general_no_elim_operand" "f#r,rFo#f"))]
    "!optimize_size"
  {
!   /* This insn should be already splitted before reg-stack.  */
!   abort ();
  }
    [(set_attr "type" "multi")
     (set_attr "mode" "XF,SI")])
***************
*** 2794,2800 ****
      case 0:
        if (REG_P (operands[1])
            && find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
!         return "fstp\t%y0";
        else if (STACK_TOP_P (operands[0]))
          return "fld%z1\t%y1";
        else
--- 2681,2692 ----
      case 0:
        if (REG_P (operands[1])
            && find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
! 	{
! 	  if (REGNO (operands[0]) == FIRST_STACK_REG
! 	      && TARGET_USE_FFREEP)
! 	    return "ffreep\t%y0";
!           return "fstp\t%y0";
! 	}
        else if (STACK_TOP_P (operands[0]))
          return "fld%z1\t%y1";
        else
***************
*** 2841,2847 ****
      case 0:
        if (REG_P (operands[1])
            && find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
!         return "fstp\t%y0";
        else if (STACK_TOP_P (operands[0]))
          return "fld%z1\t%y1";
        else
--- 2733,2744 ----
      case 0:
        if (REG_P (operands[1])
            && find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
! 	{
! 	  if (REGNO (operands[0]) == FIRST_STACK_REG
! 	      && TARGET_USE_FFREEP)
! 	    return "ffreep\t%y0";
!           return "fstp\t%y0";
! 	}
        else if (STACK_TOP_P (operands[0]))
          return "fld%z1\t%y1";
        else
***************
*** 2888,2894 ****
      case 0:
        if (REG_P (operands[1])
            && find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
!         return "fstp\t%y0";
        else if (STACK_TOP_P (operands[0]))
          return "fld%z1\t%y1";
        else
--- 2785,2796 ----
      case 0:
        if (REG_P (operands[1])
            && find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
! 	{
! 	  if (REGNO (operands[0]) == FIRST_STACK_REG
! 	      && TARGET_USE_FFREEP)
! 	    return "ffreep\t%y0";
!           return "fstp\t%y0";
! 	}
        else if (STACK_TOP_P (operands[0]))
          return "fld%z1\t%y1";
        else
***************
*** 2935,2941 ****
      case 0:
        if (REG_P (operands[1])
            && find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
!         return "fstp\t%y0";
        else if (STACK_TOP_P (operands[0]))
          return "fld%z1\t%y1";
        else
--- 2837,2848 ----
      case 0:
        if (REG_P (operands[1])
            && find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
! 	{
! 	  if (REGNO (operands[0]) == FIRST_STACK_REG
! 	      && TARGET_USE_FFREEP)
! 	    return "ffreep\t%y0";
!           return "fstp\t%y0";
! 	}
        else if (STACK_TOP_P (operands[0]))
          return "fld%z1\t%y1";
        else


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]