OSDN Git Service

* config/i386/i386.c (output_387_reg_move): Handle memory operand[0].
authoruros <uros@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 6 Apr 2007 10:59:53 +0000 (10:59 +0000)
committeruros <uros@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 6 Apr 2007 10:59:53 +0000 (10:59 +0000)
* config/i386/i386.md (*movsf_1, *movdf_nointeger,
*movdf_integer_rex64, *movdf_integer, *movxf_nointeger,
*movxf_integer): Use output_387_reg_move() for x87 reg->mem
alternative.
(*extendsfdf2_mixed, *extendsfdf2_i387, *extendsfxf2_i387,
*extenddfxf2_i387, *truncdfsf_fast_mixed): Ditto.

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

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/config/i386/i386.md

index 1df7b55..8e0b8a1 100644 (file)
@@ -1,3 +1,13 @@
+2007-04-06  Uros Bizjak  <ubizjak@gmail.com>
+
+       * config/i386/i386.c (output_387_reg_move): Handle memory operand[0].
+       * config/i386/i386.md (*movsf_1, *movdf_nointeger,
+       *movdf_integer_rex64, *movdf_integer, *movxf_nointeger,
+       *movxf_integer): Use output_387_reg_move() for x87 reg->mem
+       alternative.
+       (*extendsfdf2_mixed, *extendsfdf2_i387, *extendsfxf2_i387,
+       *extenddfxf2_i387, *truncdfsf_fast_mixed): Ditto.
+
 2007-04-05  Richard Henderson  <rth@redhat.com>
 
        * config/alpha/alpha.c (print_operand) [+]: Remove.
index a782308..0429232 100644 (file)
@@ -21089,16 +21089,36 @@ ix86_reverse_condition (enum rtx_code code, enum machine_mode mode)
 const char *
 output_387_reg_move (rtx insn, rtx *operands)
 {
-  if (REG_P (operands[1])
-      && find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
+  if (REG_P (operands[0]))
     {
-      if (REGNO (operands[0]) == FIRST_STACK_REG)
-       return output_387_ffreep (operands, 0);
-      return "fstp\t%y0";
+      if (REG_P (operands[1])
+         && find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
+       {
+         if (REGNO (operands[0]) == FIRST_STACK_REG)
+           return output_387_ffreep (operands, 0);
+         return "fstp\t%y0";
+       }
+      if (STACK_TOP_P (operands[0]))
+       return "fld%z1\t%y1";
+      return "fst\t%y0";
     }
-  if (STACK_TOP_P (operands[0]))
-    return "fld%z1\t%y1";
-  return "fst\t%y0";
+  else if (MEM_P (operands[0]))
+    {
+      gcc_assert (REG_P (operands[1]));
+      if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
+       return "fstp%z0\t%y0";
+      else
+       {
+         /* There is no non-popping store to memory for XFmode.
+            So if we need one, follow the store with a load.  */
+         if (GET_MODE (operands[0]) == XFmode)
+           return "fstp%z0\t%y0\n\tfld%z0\t%y0";
+         else
+           return "fst%z0\t%y0";
+       }
+    }
+  else
+    gcc_unreachable();
 }
 
 /* Output code to perform a conditional jump to LABEL, if C2 flag in
index 849ca83..885e677 100644 (file)
   switch (which_alternative)
     {
     case 0:
-      return output_387_reg_move (insn, operands);
-
     case 1:
-      if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
-        return "fstp%z0\t%y0";
-      else
-        return "fst%z0\t%y0";
+      return output_387_reg_move (insn, operands);
 
     case 2:
       return standard_80387_constant_opcode (operands[1]);
   switch (which_alternative)
     {
     case 0:
-      return output_387_reg_move (insn, operands);
-
     case 1:
-      if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
-        return "fstp%z0\t%y0";
-      else
-        return "fst%z0\t%y0";
+      return output_387_reg_move (insn, operands);
 
     case 2:
       return standard_80387_constant_opcode (operands[1]);
   switch (which_alternative)
     {
     case 0:
-      return output_387_reg_move (insn, operands);
-
     case 1:
-      if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
-        return "fstp%z0\t%y0";
-      else
-        return "fst%z0\t%y0";
+      return output_387_reg_move (insn, operands);
 
     case 2:
       return standard_80387_constant_opcode (operands[1]);
   switch (which_alternative)
     {
     case 0:
-      return output_387_reg_move (insn, operands);
-
     case 1:
-      if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
-        return "fstp%z0\t%y0";
-      else
-        return "fst%z0\t%y0";
+      return output_387_reg_move (insn, operands);
 
     case 2:
       return standard_80387_constant_opcode (operands[1]);
   switch (which_alternative)
     {
     case 0:
-      return output_387_reg_move (insn, operands);
-
     case 1:
-      /* There is no non-popping store to memory for XFmode.  So if
-        we need one, follow the store with a load.  */
-      if (! find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
-        return "fstp%z0\t%y0\;fld%z0\t%y0";
-      else
-        return "fstp%z0\t%y0";
+      return output_387_reg_move (insn, operands);
 
     case 2:
       return standard_80387_constant_opcode (operands[1]);
   switch (which_alternative)
     {
     case 0:
-      return output_387_reg_move (insn, operands);
-
     case 1:
-      /* There is no non-popping store to memory for XFmode.  So if
-        we need one, follow the store with a load.  */
-      if (! find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
-        return "fstp%z0\t%y0\;fld%z0\t%y0";
-      else
-        return "fstp%z0\t%y0";
+      return output_387_reg_move (insn, operands);
 
     case 2:
       return standard_80387_constant_opcode (operands[1]);
   switch (which_alternative)
     {
     case 0:
-      return output_387_reg_move (insn, operands);
-
     case 1:
-      if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
-        return "fstp%z0\t%y0";
-      else
-        return "fst%z0\t%y0";
+      return output_387_reg_move (insn, operands);
 
     case 2:
       return "cvtss2sd\t{%1, %0|%0, %1}";
   [(set (match_operand:DF 0 "nonimmediate_operand" "=f,m")
         (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "fm,f")))]
   "TARGET_80387"
-{
-  switch (which_alternative)
-    {
-    case 0:
-      return output_387_reg_move (insn, operands);
-
-    case 1:
-      if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
-        return "fstp%z0\t%y0";
-      else
-        return "fst%z0\t%y0";
-
-    default:
-      gcc_unreachable ();
-    }
-}
+  "* return output_387_reg_move (insn, operands);"
   [(set_attr "type" "fmov")
    (set_attr "mode" "SF,XF")])
 
   [(set (match_operand:XF 0 "nonimmediate_operand" "=f,m")
         (float_extend:XF (match_operand:SF 1 "nonimmediate_operand" "fm,f")))]
   "TARGET_80387"
-{
-  switch (which_alternative)
-    {
-    case 0:
-      return output_387_reg_move (insn, operands);
-
-    case 1:
-      /* There is no non-popping store to memory for XFmode.  So if
-        we need one, follow the store with a load.  */
-      if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
-        return "fstp%z0\t%y0";
-      else
-        return "fstp%z0\t%y0\n\tfld%z0\t%y0";
-
-    default:
-      gcc_unreachable ();
-    }
-}
+  "* return output_387_reg_move (insn, operands);"
   [(set_attr "type" "fmov")
    (set_attr "mode" "SF,XF")])
 
   [(set (match_operand:XF 0 "nonimmediate_operand" "=f,m")
         (float_extend:XF (match_operand:DF 1 "nonimmediate_operand" "fm,f")))]
   "TARGET_80387"
-{
-  switch (which_alternative)
-    {
-    case 0:
-      return output_387_reg_move (insn, operands);
-
-    case 1:
-      /* There is no non-popping store to memory for XFmode.  So if
-        we need one, follow the store with a load.  */
-      if (! find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
-        return "fstp%z0\t%y0\n\tfld%z0\t%y0";
-      else
-        return "fstp%z0\t%y0";
-
-    default:
-      gcc_unreachable ();
-    }
-}
+  "* return output_387_reg_move (insn, operands);"
   [(set_attr "type" "fmov")
    (set_attr "mode" "DF,XF")])
 
   switch (which_alternative)
     {
     case 0:
-      if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
-       return "fstp%z0\t%y0";
-      else
-       return "fst%z0\t%y0";
     case 1:
       return output_387_reg_move (insn, operands);
     case 2: