* config/s390/s390.c (legitimate_reload_constant_p): Remove
authoruweigand <uweigand@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 30 Sep 2004 21:21:57 +0000 (21:21 +0000)
committeruweigand <uweigand@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 30 Sep 2004 21:21:57 +0000 (21:21 +0000)
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@88356 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/s390/s390.c
gcc/config/s390/s390.md

index 5be270b..e8b7b17 100644 (file)
@@ -1,3 +1,17 @@
+2004-09-30  Ulrich Weigand  <uweigand@de.ibm.com>
+
+       * 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.
+
 2004-09-30  Paul Brook  <paul@codesourcery.com>
 
        * config/arm/symbian.h (STARTFILE_SPEC): Remove crt*.o.
index 3fff67c..bb468fe 100644 (file)
@@ -2062,12 +2062,6 @@ legitimate_reload_constant_p (register rtx op)
 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
@@ -2111,7 +2105,17 @@ s390_secondary_input_reload_class (enum reg_class class ATTRIBUTE_UNUSED,
                                   enum machine_mode mode, rtx in)
 {
   if (s390_plus_operand (in, mode))
-    return ADDR_REGS;
+    {
+      /* ??? 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;
 }
@@ -2193,6 +2197,10 @@ s390_expand_plus_operand (register rtx target, register rtx src,
        }
       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 d7f0e07..9f564be 100644 (file)
   /* 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"
   /* 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"
   [(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")
 ; 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"
+(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"))]
   ""