aboutsummaryrefslogtreecommitdiff
path: root/gcc/optabs.c
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1992-12-06 16:26:31 -0500
committerRichard Kenner <kenner@gcc.gnu.org>1992-12-06 16:26:31 -0500
commit8a6f81295284e06536a40f7feaaf9bbe1606dcb3 (patch)
treeac6d8d8c0ae183c6afc10499684a3eb40832ec01 /gcc/optabs.c
parent67aac05d147f6abfbcf5d916b76a34f684d37edc (diff)
downloadgcc-8a6f81295284e06536a40f7feaaf9bbe1606dcb3.zip
gcc-8a6f81295284e06536a40f7feaaf9bbe1606dcb3.tar.gz
gcc-8a6f81295284e06536a40f7feaaf9bbe1606dcb3.tar.bz2
(expand_binop): Correct sign of complex quotient imagpart.
From-SVN: r2843
Diffstat (limited to 'gcc/optabs.c')
-rw-r--r--gcc/optabs.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/gcc/optabs.c b/gcc/optabs.c
index 1dd2e26..eed7bef 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -969,17 +969,17 @@ expand_binop (mode, binoptab, op0, op1, target, unsignedp, methods)
if (res != imagr)
emit_move_insn (imagr, res);
}
- else /* Divider is of complex type */
+ else /* Divisor is of complex type */
{ /* X/(a+ib) */
- rtx divider;
+ rtx divisor;
rtx real_t;
rtx imag_t;
optab mulopt = unsignedp ? umul_widen_optab : smul_optab;
- /* Divider: a*a + b*b */
- divider = expand_binop (submode, add_optab,
+ /* Divisor: c*c + d*d */
+ divisor = expand_binop (submode, add_optab,
expand_binop (submode, mulopt,
real1, real1,
0, unsignedp, methods),
@@ -988,9 +988,9 @@ expand_binop (mode, binoptab, op0, op1, target, unsignedp, methods)
0, unsignedp, methods),
0, unsignedp, methods);
- if (! imag0) /* ((c)(a-ib))/divider */
- {
- /* Calculate the divident */
+ if (! imag0) /* ((a)(c-id))/divisor */
+ { /* (a+i0) / (c+id) = (ac/(cc+dd)) + i(-ad/(cc+dd)) */
+ /* Calculate the dividend */
real_t = expand_binop (submode, mulopt, real0, real1,
0, unsignedp, methods);
@@ -1000,9 +1000,9 @@ expand_binop (mode, binoptab, op0, op1, target, unsignedp, methods)
0, unsignedp, methods),
0, unsignedp);
}
- else /* ((c+id)(a-ib))/divider */
+ else /* ((a+ib)(c-id))/divider */
{
- /* Calculate the divident */
+ /* Calculate the dividend */
real_t = expand_binop (submode, add_optab,
expand_binop (submode, mulopt,
real0, real1,
@@ -1014,21 +1014,21 @@ expand_binop (mode, binoptab, op0, op1, target, unsignedp, methods)
imag_t = expand_binop (submode, sub_optab,
expand_binop (submode, mulopt,
- real0, imag1,
+ imag0, real1,
0, unsignedp, methods),
expand_binop (submode, mulopt,
- real1, imag0,
+ real0, imag1,
0, unsignedp, methods),
0, unsignedp, methods);
}
- res = expand_binop (submode, binoptab, real_t, divider,
+ res = expand_binop (submode, binoptab, real_t, divisor,
realr, unsignedp, methods);
if (res != realr)
emit_move_insn (realr, res);
- res = expand_binop (submode, binoptab, imag_t, divider,
+ res = expand_binop (submode, binoptab, imag_t, divisor,
imagr, unsignedp, methods);
if (res != imagr)
emit_move_insn (imagr, res);