OSDN Git Service

(move_for_stack_reg): If the 387 regstack is not full when doing an XFmode
authorjrv <jrv@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 5 Oct 1993 05:48:02 +0000 (05:48 +0000)
committerjrv <jrv@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 5 Oct 1993 05:48:02 +0000 (05:48 +0000)
write from 387 to MEM, copy the source reg and write the copy.

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

gcc/reg-stack.c

index 3cf49de..005f554 100644 (file)
@@ -230,7 +230,7 @@ static rtx FP_mode_reg[FIRST_PSEUDO_REGISTER][(int) MAX_MACHINE_MODE];
     : block_number)[INSN_UID (INSN)])
 
 extern rtx gen_jump ();
-extern rtx gen_movdf ();
+extern rtx gen_movdf (), gen_movxf ();
 extern rtx find_regno_note ();
 extern rtx emit_jump_insn_before ();
 extern rtx emit_label_after ();
@@ -1723,6 +1723,24 @@ move_for_stack_reg (insn, regstack, pat)
          regstack->top--;
          CLEAR_HARD_REG_BIT (regstack->reg_set, REGNO (*src));
        }
+      else if (GET_MODE (*src) == XFmode && regstack->top != REG_STACK_SIZE)
+       {
+         /* A 387 cannot write an XFmode value to a MEM without
+            clobbering the source reg.  The output code can handle
+            this by reading back the value from the MEM.
+            But it is more efficient to use a temp register if one is
+            available.  Push the source value here if the register
+            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][(int) XFmode];
+
+         push_rtx = gen_movxf (top_stack_reg, top_stack_reg);
+         push_insn = emit_insn_before (push_rtx, insn);
+         PUT_MODE (push_insn, QImode);
+         REG_NOTES (insn) = gen_rtx (EXPR_LIST, REG_DEAD, top_stack_reg,
+                                     REG_NOTES (insn));
+       }
 
       replace_reg (src, FIRST_STACK_REG);
     }