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]

S/390: Remove some old workarounds


Hello,

this removes some workarounds that are no longer necessary.  In particular
the patch prepares for no longer calling force_const_mem after the early
reload phase (so that register elimination can reliably determine whether
the pool base register needs to be allocated).

There is still one code path in reload that requires us to force a
constant too late; we add a local workaround for just this case.

Bootstrapped/regtested on s390-ibm-linux and s390x-ibm-linux.
Committed to mainline.

Bye,
Ulrich


ChangeLog:

	* config/s390/s390.c (legitimate_reload_constant_p): Remove
	floating point constant workaround.
	(s390_secondary_input_reload_class): Handle PLUS reloads
	with too-large constant.
	(s390_expand_plus_operand): Likewise.
	* config/s390/s390.md ("movdi"): Do not call force_const_mem.
	("movsi"): Likewise.  Also, remove workaround for non-general
	operands.
	("movdf"): Do not call force_const_mem.
	("movsf"): Likewise.  Merge expander with *movsf insn.
	("*movsf"): Remove, merge with movsf expander.


Index: gcc/config/s390/s390.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/s390/s390.c,v
retrieving revision 1.180
diff -c -p -r1.180 s390.c
*** gcc/config/s390/s390.c	28 Sep 2004 21:39:27 -0000	1.180
--- gcc/config/s390/s390.c	30 Sep 2004 19:32:38 -0000
*************** legitimate_reload_constant_p (register r
*** 2062,2073 ****
  enum reg_class
  s390_preferred_reload_class (rtx op, enum reg_class class)
  {
-   /* This can happen if a floating point constant is being
-      reloaded into an integer register.  Leave well alone.  */
-   if (GET_MODE_CLASS (GET_MODE (op)) == MODE_FLOAT
-       && class != FP_REGS)
-     return class;
- 
    switch (GET_CODE (op))
      {
        /* Constants we cannot reload must be forced into the
--- 2062,2067 ----
*************** s390_secondary_input_reload_class (enum 
*** 2111,2117 ****
  				   enum machine_mode mode, rtx in)
  {
    if (s390_plus_operand (in, mode))
!     return ADDR_REGS;
  
    return NO_REGS;
  }
--- 2105,2121 ----
  				   enum machine_mode mode, rtx in)
  {
    if (s390_plus_operand (in, mode))
!     {
!       /* ??? Reload sometimes pushes a PLUS reload with a too-large constant.
! 	 Until reload is fixed, we need to force_const_mem while emitting the
! 	 secondary reload insn -- thus we need to make sure here that we do
! 	 have a literal pool for the current function.  */
!       if (CONSTANT_P (XEXP (in, 1))
! 	  && !legitimate_reload_constant_p (XEXP (in, 1)))
! 	current_function_uses_const_pool = true;
! 
!       return ADDR_REGS;
!     }
  
    return NO_REGS;
  }
*************** s390_expand_plus_operand (register rtx t
*** 2193,2198 ****
--- 2197,2206 ----
  	}
        if (true_regnum (sum2) < 1 || true_regnum (sum2) > 15)
  	{
+ 	  /* ??? See comment in s390_secondary_input_reload_class.  */
+ 	  if (CONSTANT_P (sum2) && !legitimate_reload_constant_p (sum2))
+ 	    sum2 = force_const_mem (Pmode, sum2);
+ 
  	  emit_move_insn (scratch, sum2);
  	  sum2 = scratch;
  	}
Index: gcc/config/s390/s390.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/s390/s390.md,v
retrieving revision 1.127
diff -c -p -r1.127 s390.md
*** gcc/config/s390/s390.md	28 Sep 2004 21:39:28 -0000	1.127
--- gcc/config/s390/s390.md	30 Sep 2004 19:32:39 -0000
***************
*** 827,840 ****
    /* Handle symbolic constants.  */
    if (TARGET_64BIT && SYMBOLIC_CONST (operands[1]))
      emit_symbolic_move (operands);
- 
-   /* During and after reload, we need to force constants
-      to the literal pool ourselves, if necessary.  */
-   if ((reload_in_progress || reload_completed)
-       && CONSTANT_P (operands[1])
-       && (!legitimate_reload_constant_p (operands[1])
-           || FP_REG_P (operands[0])))
-     operands[1] = force_const_mem (DImode, operands[1]);
  })
  
  (define_insn "*movdi_larl"
--- 827,832 ----
***************
*** 1011,1037 ****
    /* Handle symbolic constants.  */
    if (!TARGET_64BIT && SYMBOLIC_CONST (operands[1]))
      emit_symbolic_move (operands);
- 
-   /* expr.c tries to load an effective address using
-      force_reg.  This fails because we don't have a
-      generic load_address pattern.  Convert the move
-      to a proper arithmetic operation instead, unless
-      it is guaranteed to be OK.  */
-   if (GET_CODE (operands[1]) == PLUS
-       && !legitimate_la_operand_p (operands[1]))
-     {
-       operands[1] = force_operand (operands[1], operands[0]);
-       if (operands[1] == operands[0])
-         DONE;
-     }
- 
-   /* During and after reload, we need to force constants
-      to the literal pool ourselves, if necessary.  */
-   if ((reload_in_progress || reload_completed)
-       && CONSTANT_P (operands[1])
-       && (!legitimate_reload_constant_p (operands[1])
-           || FP_REG_P (operands[0])))
-     operands[1] = force_const_mem (SImode, operands[1]);
  })
  
  (define_insn "*movsi_larl"
--- 1003,1008 ----
***************
*** 1321,1333 ****
    [(set (match_operand:DF 0 "nonimmediate_operand" "")
          (match_operand:DF 1 "general_operand"  ""))]
    ""
! {
!   /* During and after reload, we need to force constants
!      to the literal pool ourselves, if necessary.  */
!   if ((reload_in_progress || reload_completed)
!       && CONSTANT_P (operands[1]))
!     operands[1] = force_const_mem (DFmode, operands[1]);
! })
  
  (define_insn "*movdf_64"
    [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,f,R,T,d,d,m,?Q")
--- 1292,1298 ----
    [(set (match_operand:DF 0 "nonimmediate_operand" "")
          (match_operand:DF 1 "general_operand"  ""))]
    ""
!   "")
  
  (define_insn "*movdf_64"
    [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,f,R,T,d,d,m,?Q")
***************
*** 1421,1439 ****
  ; movsf instruction pattern(s).
  ;
  
! (define_expand "movsf"
!   [(set (match_operand:SF 0 "nonimmediate_operand" "")
!         (match_operand:SF 1 "general_operand"  ""))]
!   ""
! {
!   /* During and after reload, we need to force constants
!      to the literal pool ourselves, if necessary.  */
!   if ((reload_in_progress || reload_completed)
!       && CONSTANT_P (operands[1]))
!     operands[1] = force_const_mem (SFmode, operands[1]);
! })
! 
! (define_insn "*movsf"
    [(set (match_operand:SF 0 "nonimmediate_operand" "=f,f,f,R,T,d,d,d,R,T,?Q")
          (match_operand:SF 1 "general_operand" "f,R,T,f,f,d,R,T,d,d,?Q"))]
    ""
--- 1386,1392 ----
  ; movsf instruction pattern(s).
  ;
  
! (define_insn "movsf"
    [(set (match_operand:SF 0 "nonimmediate_operand" "=f,f,f,R,T,d,d,d,R,T,?Q")
          (match_operand:SF 1 "general_operand" "f,R,T,f,f,d,R,T,d,d,?Q"))]
    ""
-- 
  Dr. Ulrich Weigand
  weigand@informatik.uni-erlangen.de


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