(expand_binop): For complex mult, compute res in each alternative, not before.
From-SVN: r3165
This commit is contained in:
parent
676ce22316
commit
96f153da76
21
gcc/optabs.c
21
gcc/optabs.c
@ -889,7 +889,9 @@ expand_binop (mode, binoptab, op0, op1, target, unsignedp, methods)
|
|||||||
switch (binoptab->code)
|
switch (binoptab->code)
|
||||||
{
|
{
|
||||||
case PLUS:
|
case PLUS:
|
||||||
|
/* (a+ib) + (c+id) = (a+c) + i(b+d) */
|
||||||
case MINUS:
|
case MINUS:
|
||||||
|
/* (a+ib) - (c+id) = (a-c) + i(b-d) */
|
||||||
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)
|
||||||
@ -912,15 +914,14 @@ expand_binop (mode, binoptab, op0, op1, target, unsignedp, methods)
|
|||||||
case MULT:
|
case MULT:
|
||||||
/* (a+ib) * (c+id) = (ac-bd) + i(ad+cb) */
|
/* (a+ib) * (c+id) = (ac-bd) + i(ad+cb) */
|
||||||
|
|
||||||
res = expand_binop (submode, binoptab, real0, real1,
|
|
||||||
realr, unsignedp, methods);
|
|
||||||
|
|
||||||
if (imag0 && imag1)
|
if (imag0 && imag1)
|
||||||
{
|
{
|
||||||
rtx temp =
|
rtx temp =
|
||||||
expand_binop (submode, sub_optab, res,
|
expand_binop (submode, sub_optab,
|
||||||
expand_binop (submode, binoptab, imag0, imag1,
|
expand_binop (submode, binoptab, real0,
|
||||||
0, unsignedp, methods),
|
real1, 0, unsignedp, methods),
|
||||||
|
expand_binop (submode, binoptab, imag0,
|
||||||
|
imag1, 0, unsignedp, methods),
|
||||||
realr, unsignedp, methods);
|
realr, unsignedp, methods);
|
||||||
|
|
||||||
if (temp != realr)
|
if (temp != realr)
|
||||||
@ -939,6 +940,8 @@ expand_binop (mode, binoptab, op0, op1, target, unsignedp, methods)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
res = expand_binop (submode, binoptab, real0, real1,
|
||||||
|
realr, unsignedp, methods);
|
||||||
if (res != realr)
|
if (res != realr)
|
||||||
emit_move_insn (realr, res);
|
emit_move_insn (realr, res);
|
||||||
|
|
||||||
@ -954,11 +957,11 @@ expand_binop (mode, binoptab, op0, op1, target, unsignedp, methods)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case DIV:
|
case DIV:
|
||||||
/* (c+id)/(a+ib) == ((c+id)*(a-ib))/(a*a+b*b) */
|
/* (a+ib) / (c+id) = ((ac+bd)/(cc+dd)) + i((bc-ad)/(cc+dd)) */
|
||||||
|
|
||||||
if (! imag1)
|
if (! imag1)
|
||||||
{
|
{ /* (a+ib) / (c+i0) = (a/c) + i(b/c) */
|
||||||
/* Simply divide the real and imaginary parts by `a' */
|
/* 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);
|
||||||
if (res != realr)
|
if (res != realr)
|
||||||
|
Loading…
Reference in New Issue
Block a user