Commit 54e7b5e6 by Richard Stallman

(emit_no_conflict_block): Don't move target to itself if that takes multiple insns.

(emit_no_conflict_block): Don't move target to itself
if that takes multiple insns.
(expand_binop): For complex mult and div, avoid fetching operand
components more than once from memory.

From-SVN: r3647
parent b6a10c9f
...@@ -916,16 +916,21 @@ expand_binop (mode, binoptab, op0, op1, target, unsignedp, methods) ...@@ -916,16 +916,21 @@ expand_binop (mode, binoptab, op0, op1, target, unsignedp, methods)
if (imag0 && imag1) if (imag0 && imag1)
{ {
rtx temp = /* Don't fetch these from memory more than once. */
expand_binop (submode, sub_optab, real0 = force_reg (submode, real0);
expand_binop (submode, binoptab, real0, real1 = force_reg (submode, real1);
real1, 0, unsignedp, methods), imag0 = force_reg (submode, imag0);
expand_binop (submode, binoptab, imag0, imag1 = force_reg (submode, imag1);
imag1, 0, unsignedp, methods),
realr, unsignedp, methods); res = expand_binop (submode, sub_optab,
expand_binop (submode, binoptab, real0,
real1, 0, unsignedp, methods),
expand_binop (submode, binoptab, imag0,
imag1, 0, unsignedp, methods),
realr, unsignedp, methods);
if (temp != realr) if (res != realr)
emit_move_insn (realr, temp); emit_move_insn (realr, res);
res = expand_binop (submode, add_optab, res = expand_binop (submode, add_optab,
expand_binop (submode, binoptab, expand_binop (submode, binoptab,
...@@ -940,6 +945,10 @@ expand_binop (mode, binoptab, op0, op1, target, unsignedp, methods) ...@@ -940,6 +945,10 @@ expand_binop (mode, binoptab, op0, op1, target, unsignedp, methods)
} }
else else
{ {
/* Don't fetch these from memory more than once. */
real0 = force_reg (submode, real0);
real1 = force_reg (submode, real1);
res = expand_binop (submode, binoptab, real0, real1, res = expand_binop (submode, binoptab, real0, real1,
realr, unsignedp, methods); realr, unsignedp, methods);
if (res != realr) if (res != realr)
...@@ -961,6 +970,10 @@ expand_binop (mode, binoptab, op0, op1, target, unsignedp, methods) ...@@ -961,6 +970,10 @@ expand_binop (mode, binoptab, op0, op1, target, unsignedp, methods)
if (! imag1) if (! imag1)
{ /* (a+ib) / (c+i0) = (a/c) + i(b/c) */ { /* (a+ib) / (c+i0) = (a/c) + i(b/c) */
/* Don't fetch these from memory more than once. */
real1 = force_reg (submode, real1);
/* Simply divide the real and imaginary parts by `c' */ /* Simply divide the real and imaginary parts by `c' */
res = expand_binop (submode, binoptab, real0, real1, res = expand_binop (submode, binoptab, real0, real1,
realr, unsignedp, methods); realr, unsignedp, methods);
...@@ -981,6 +994,13 @@ expand_binop (mode, binoptab, op0, op1, target, unsignedp, methods) ...@@ -981,6 +994,13 @@ expand_binop (mode, binoptab, op0, op1, target, unsignedp, methods)
optab mulopt = unsignedp ? umul_widen_optab : smul_optab; optab mulopt = unsignedp ? umul_widen_optab : smul_optab;
/* Don't fetch these from memory more than once. */
real0 = force_reg (submode, real0);
real1 = force_reg (submode, real1);
if (imag0)
imag0 = force_reg (submode, imag0);
imag1 = force_reg (submode, imag1);
/* Divisor: c*c + d*d */ /* Divisor: c*c + d*d */
divisor = expand_binop (submode, add_optab, divisor = expand_binop (submode, add_optab,
expand_binop (submode, mulopt, expand_binop (submode, mulopt,
...@@ -1984,9 +2004,16 @@ emit_no_conflict_block (insns, target, op0, op1, equiv) ...@@ -1984,9 +2004,16 @@ emit_no_conflict_block (insns, target, op0, op1, equiv)
REG_NOTES (insn)); REG_NOTES (insn));
} }
last = emit_move_insn (target, target); if (mov_optab->handlers[(int) GET_MODE (target)].insn_code
if (equiv) != CODE_FOR_nothing)
REG_NOTES (last) = gen_rtx (EXPR_LIST, REG_EQUAL, equiv, REG_NOTES (last)); {
last = emit_move_insn (target, target);
if (equiv)
REG_NOTES (last)
= gen_rtx (EXPR_LIST, REG_EQUAL, equiv, REG_NOTES (last));
}
else
last = get_last_insn ();
if (prev == 0) if (prev == 0)
first = get_insns (); first = get_insns ();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment