aboutsummaryrefslogtreecommitdiff
path: root/gcc/reg-stack.c
diff options
context:
space:
mode:
authorJames Van Artsdalen <jrv@gnu.org>1993-10-05 05:48:02 +0000
committerJames Van Artsdalen <jrv@gnu.org>1993-10-05 05:48:02 +0000
commitb40b8b0642082bd67870f06ccde36440f3a9092d (patch)
treedf9f87807211728104ca217f0da45bf92cb3031b /gcc/reg-stack.c
parenta8683de70b540a7b40dedf4222677226a5c52b48 (diff)
downloadgcc-b40b8b0642082bd67870f06ccde36440f3a9092d.zip
gcc-b40b8b0642082bd67870f06ccde36440f3a9092d.tar.gz
gcc-b40b8b0642082bd67870f06ccde36440f3a9092d.tar.bz2
(move_for_stack_reg): If the 387 regstack is not full when doing an XFmode write from 387 to MEM...
(move_for_stack_reg): If the 387 regstack is not full when doing an XFmode write from 387 to MEM, copy the source reg and write the copy. From-SVN: r5598
Diffstat (limited to 'gcc/reg-stack.c')
-rw-r--r--gcc/reg-stack.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/gcc/reg-stack.c b/gcc/reg-stack.c
index 3cf49de..005f554 100644
--- a/gcc/reg-stack.c
+++ b/gcc/reg-stack.c
@@ -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);
}