i386.h (PREFERRED_RELOAD_CLASS): Standard fp constants load to TOS.
authorRichard Henderson <rth@cygnus.com>
Sat, 5 Sep 1998 14:50:25 +0000 (07:50 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Sat, 5 Sep 1998 14:50:25 +0000 (07:50 -0700)
        * i386.h (PREFERRED_RELOAD_CLASS): Standard fp constants load to TOS.
        * i386.md (movsf, movdf, movxf): Validate memory address returned
        from force_const_mem.  Kill useless REG_EQUAL setting code.

From-SVN: r22269

gcc/ChangeLog
gcc/config/i386/i386.h
gcc/config/i386/i386.md

index 912533d..8b65a18 100644 (file)
@@ -1,3 +1,9 @@
+Sat Sep  5 14:47:17 1998  Richard Henderson  <rth@cygnus.com>
+
+       * i386.h (PREFERRED_RELOAD_CLASS): Standard fp constants load to TOS.
+       * i386.md (movsf, movdf, movxf): Validate memory address returned
+       from force_const_mem.  Kill useless REG_EQUAL setting code.
+
 Sat Sep  5 14:23:31 1998  Torbjorn Granlund <tege@matematik.su.se>
 
        * m68k.md (zero_extendsidi2): Fix typo.
index 75e0298..7e3f723 100644 (file)
@@ -932,7 +932,8 @@ enum reg_class
    movdf to do mem-to-mem moves through integer regs. */
 
 #define PREFERRED_RELOAD_CLASS(X,CLASS)        \
-  (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) != VOIDmode ? NO_REGS  \
+  (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) != VOIDmode \
+   ? (standard_80387_constant_p (X) ? FP_TOP_REG : NO_REGS) \
    : GET_MODE (X) == QImode && ! reg_class_subset_p (CLASS, Q_REGS) ? Q_REGS \
    : ((CLASS) == ALL_REGS                                              \
       && GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT) ? GENERAL_REGS   \
index e65ca1c..69134dd 100644 (file)
     }
 
   /* If we are loading a floating point constant that isn't 0 or 1
-     into a register, indicate we need the pic register loaded.  This could
-     be optimized into stores of constants if the target eventually moves
-     to memory, but better safe than sorry.  */
+     into a register, force the value to memory now, since we'll 
+     get better code out the back end.  */
   else if ((reload_in_progress | reload_completed) == 0
-      && GET_CODE (operands[0]) != MEM
-      && GET_CODE (operands[1]) == CONST_DOUBLE
-      && !standard_80387_constant_p (operands[1]))
+          && GET_CODE (operands[0]) != MEM
+          && GET_CODE (operands[1]) == CONST_DOUBLE
+          && !standard_80387_constant_p (operands[1]))
     {
-      rtx insn, note, fp_const;
-
-      fp_const = force_const_mem (SFmode, operands[1]);
-      if (flag_pic)
-       current_function_uses_pic_offset_table = 1;
-
-      insn = emit_insn (gen_rtx_SET (SFmode, operands[0], fp_const));
-      note = find_reg_note (insn, REG_EQUAL, NULL_RTX);
-
-      if (note)
-       XEXP (note, 0) = operands[1];
-      else
-       REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_EQUAL, operands[1], REG_NOTES (insn));
+      operands[1] = validize_mem (force_const_mem (SFmode, operands[1]));
     }
 }")
 
     return AS1 (fxch,%0);
 }")
 
+
 (define_insn "movdf_push"
   [(set (match_operand:DF 0 "push_operand" "=<,<")
        (match_operand:DF 1 "general_operand" "*rfF,o"))]
      optimized into stores of constants if the target eventually moves to
      memory, but better safe than sorry.  */
   else if ((reload_in_progress | reload_completed) == 0
-      && GET_CODE (operands[0]) != MEM
-      && GET_CODE (operands[1]) == CONST_DOUBLE
-      && !standard_80387_constant_p (operands[1]))
+          && GET_CODE (operands[0]) != MEM
+          && GET_CODE (operands[1]) == CONST_DOUBLE
+          && !standard_80387_constant_p (operands[1]))
     {
-      rtx insn, note, fp_const;
-
-      fp_const = force_const_mem (DFmode, operands[1]);
-      if (flag_pic)
-       current_function_uses_pic_offset_table = 1;
-
-      insn = emit_insn (gen_rtx_SET (DFmode, operands[0], fp_const));
-      note = find_reg_note (insn, REG_EQUAL, NULL_RTX);
-
-      if (note)
-       XEXP (note, 0) = operands[1];
-      else
-       REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_EQUAL, operands[1], REG_NOTES (insn));
+      operands[1] = validize_mem (force_const_mem (DFmode, operands[1]));
     }
 }")
 
      be optimized into stores of constants if the target eventually moves
      to memory, but better safe than sorry.  */
   else if ((reload_in_progress | reload_completed) == 0
-      && GET_CODE (operands[0]) != MEM
-      && GET_CODE (operands[1]) == CONST_DOUBLE
-      && !standard_80387_constant_p (operands[1]))
+          && GET_CODE (operands[0]) != MEM
+          && GET_CODE (operands[1]) == CONST_DOUBLE
+          && !standard_80387_constant_p (operands[1]))
     {
-      rtx insn, note, fp_const;
-
-      fp_const = force_const_mem (XFmode, operands[1]);
-      if (flag_pic)
-       current_function_uses_pic_offset_table = 1;
-
-      insn = emit_insn (gen_rtx_SET (XFmode, operands[0], fp_const));
-      note = find_reg_note (insn, REG_EQUAL, NULL_RTX);
-
-      if (note)
-       XEXP (note, 0) = operands[1];
-      else
-       REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_EQUAL, operands[1], REG_NOTES (insn));
+      operands[1] = validize_mem (force_const_mem (XFmode, operands[1]));
     }
 }")