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]

reg-stack fixes


Hi
This patch fixes two reg-stack problem.  First one has become visible
by my previous patch to NREGS - if we do have clobber or use of complex
register, the second half is handled improperly.
Second one is needed for x86_64 compilation - we can't emit movxf unconditionally,
since XFmode is generally unsupported.

Honza

Tue Apr 10 20:56:29 CEST 2001  Jan Hubicka  <jh@suse.cz>

	* reg-stack.c (emit_pop_insn): Handle complex modes.
	(move_for_stack_reg): Emit proper move mode.
	(subst_stack_regs_pat): Handle complex modes.

*** reg-stack.c	Tue Apr  3 18:02:52 2001
--- /home/hubicka/x86-64/gcc/gcc/reg-stack.c	Tue Apr 10 20:53:47 2001
*************** emit_pop_insn (insn, regstack, reg, wher
*** 906,911 ****
--- 902,924 ----
    rtx pop_insn, pop_rtx;
    int hard_regno;
  
+   /* For complex types take care to pop both halves.  These may survive in
+      CLOBBER and USE expressions.  */
+   if (COMPLEX_MODE_P (GET_MODE (reg)))
+     {
+       rtx reg1 = FP_MODE_REG (REGNO (reg), DFmode);
+       rtx reg2 = FP_MODE_REG (REGNO (reg) + 1, DFmode);
+ 
+       pop_insn = NULL_RTX;
+       if (get_hard_regnum (regstack, reg1) >= 0)
+          pop_insn = emit_pop_insn (insn, regstack, reg1, where);
+       if (get_hard_regnum (regstack, reg2) >= 0)
+          pop_insn = emit_pop_insn (insn, regstack, reg2, where);
+       if (!pop_insn)
+ 	abort ();
+       return pop_insn;
+     }
+ 
    hard_regno = get_hard_regnum (regstack, reg);
  
    if (hard_regno < FIRST_STACK_REG)
*************** move_for_stack_reg (insn, regstack, pat)
*** 1129,1137 ****
  	     stack is not full, and then write the value to memory via
  	     a pop.  */
  	  rtx push_rtx, push_insn;
! 	  rtx top_stack_reg = FP_MODE_REG (FIRST_STACK_REG, XFmode);
  
! 	  push_rtx = gen_movxf (top_stack_reg, top_stack_reg);
  	  push_insn = emit_insn_before (push_rtx, insn);
  	  REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_DEAD, top_stack_reg,
  						REG_NOTES (insn));
--- 1142,1153 ----
  	     stack is not full, and then write the value to memory via
  	     a pop.  */
  	  rtx push_rtx, push_insn;
! 	  rtx top_stack_reg = FP_MODE_REG (FIRST_STACK_REG, GET_MODE (src));
  
! 	  if (GET_MODE (src) == TFmode)
! 	    push_rtx = gen_movtf (top_stack_reg, top_stack_reg);
! 	  else
! 	    push_rtx = gen_movxf (top_stack_reg, top_stack_reg);
  	  push_insn = emit_insn_before (push_rtx, insn);
  	  REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_DEAD, top_stack_reg,
  						REG_NOTES (insn));
*************** subst_stack_regs_pat (insn, regstack, pa
*** 1447,1452 ****
--- 1463,1477 ----
  		    PATTERN (insn) = pat;
  		    move_for_stack_reg (insn, regstack, pat);
  		  }
+ 		if (! note && COMPLEX_MODE_P (GET_MODE (*dest))
+ 		    && get_hard_regnum (regstack, FP_MODE_REG (REGNO (*dest), DFmode)) == -1)
+ 		  {
+ 		    pat = gen_rtx_SET (VOIDmode,
+ 				       FP_MODE_REG (REGNO (*dest) + 1, SFmode),
+ 				       nan);
+ 		    PATTERN (insn) = pat;
+ 		    move_for_stack_reg (insn, regstack, pat);
+ 		  }
  	      }
  	  }
  	break;


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