Commit 086bbd21 by Toon Moene Committed by Toon Moene

Revert all patches for optimization of Complex .op.

2002-07-10  Toon Moene  <toon@moene.indiv.nluug.nl>

	Revert all patches for optimization of Complex .op. Real.
	* complex_part_zero_p: Remove
	* expand_cmplxdiv_straight: Replace complex_part_zero_p(x)
	with x.
	* expand_cmplxdiv_wide: Ditto.
	* expand_binop: Ditto.

From-SVN: r55379
parent 126dbce0
2002-07-10 Toon Moene <toon@moene.indiv.nluug.nl>
Revert all patches for optimization of Complex .op. Real.
* complex_part_zero_p: Remove
* expand_cmplxdiv_straight: Replace complex_part_zero_p(x)
with x.
* expand_cmplxdiv_wide: Ditto.
* expand_binop: Ditto.
2002-07-10 Marek Michalkiewicz <marekm@amelek.gda.pl> 2002-07-10 Marek Michalkiewicz <marekm@amelek.gda.pl>
* config/avr/avr.md: Fix two 0x80000000 constants to make them * config/avr/avr.md: Fix two 0x80000000 constants to make them
......
...@@ -108,8 +108,6 @@ static rtx ftruncify PARAMS ((rtx)); ...@@ -108,8 +108,6 @@ static rtx ftruncify PARAMS ((rtx));
static optab new_optab PARAMS ((void)); static optab new_optab PARAMS ((void));
static inline optab init_optab PARAMS ((enum rtx_code)); static inline optab init_optab PARAMS ((enum rtx_code));
static inline optab init_optabv PARAMS ((enum rtx_code)); static inline optab init_optabv PARAMS ((enum rtx_code));
static inline int complex_part_zero_p PARAMS ((rtx, enum mode_class,
enum machine_mode));
static void init_libfuncs PARAMS ((optab, int, int, const char *, int)); static void init_libfuncs PARAMS ((optab, int, int, const char *, int));
static void init_integral_libfuncs PARAMS ((optab, const char *, int)); static void init_integral_libfuncs PARAMS ((optab, const char *, int));
static void init_floating_libfuncs PARAMS ((optab, const char *, int)); static void init_floating_libfuncs PARAMS ((optab, const char *, int));
...@@ -241,22 +239,6 @@ widen_operand (op, mode, oldmode, unsignedp, no_extend) ...@@ -241,22 +239,6 @@ widen_operand (op, mode, oldmode, unsignedp, no_extend)
return result; return result;
} }
/* Test whether either the real or imaginary part of a complex floating
point number is 0.0, so that it can be ignored (when compiling
with -funsafe-math-optimizations). */
static inline int
complex_part_zero_p (part, class, submode)
rtx part;
enum mode_class class;
enum machine_mode submode;
{
return part == 0 ||
(flag_unsafe_math_optimizations
&& class == MODE_COMPLEX_FLOAT
&& part == CONST0_RTX (submode));
}
/* Generate code to perform a straightforward complex divide. */ /* Generate code to perform a straightforward complex divide. */
static int static int
...@@ -310,7 +292,7 @@ expand_cmplxdiv_straight (real0, real1, imag0, imag1, realr, imagr, submode, ...@@ -310,7 +292,7 @@ expand_cmplxdiv_straight (real0, real1, imag0, imag1, realr, imagr, submode,
if (divisor == 0) if (divisor == 0)
return 0; return 0;
if (complex_part_zero_p (imag0, class, submode)) if (imag0 == 0)
{ {
/* Mathematically, ((a)(c-id))/divisor. */ /* Mathematically, ((a)(c-id))/divisor. */
/* Computationally, (a+i0) / (c+id) = (ac/(cc+dd)) + i(-ad/(cc+dd)). */ /* Computationally, (a+i0) / (c+id) = (ac/(cc+dd)) + i(-ad/(cc+dd)). */
...@@ -476,7 +458,7 @@ expand_cmplxdiv_wide (real0, real1, imag0, imag1, realr, imagr, submode, ...@@ -476,7 +458,7 @@ expand_cmplxdiv_wide (real0, real1, imag0, imag1, realr, imagr, submode,
/* Calculate dividend. */ /* Calculate dividend. */
if (complex_part_zero_p (imag0, class, submode)) if (imag0 == 0)
{ {
real_t = real0; real_t = real0;
...@@ -581,7 +563,7 @@ expand_cmplxdiv_wide (real0, real1, imag0, imag1, realr, imagr, submode, ...@@ -581,7 +563,7 @@ expand_cmplxdiv_wide (real0, real1, imag0, imag1, realr, imagr, submode,
/* Calculate dividend. */ /* Calculate dividend. */
if (complex_part_zero_p (imag0, class, submode)) if (imag0 == 0)
{ {
/* Compute a / (c+id) as a(c/d) / (c(c/d)+d) + i (-a) / (c(c/d)+d). */ /* Compute a / (c+id) as a(c/d) / (c(c/d)+d) + i (-a) / (c(c/d)+d). */
...@@ -1609,11 +1591,10 @@ expand_binop (mode, binoptab, op0, op1, target, unsignedp, methods) ...@@ -1609,11 +1591,10 @@ expand_binop (mode, binoptab, op0, op1, target, unsignedp, methods)
else if (res != realr) else if (res != realr)
emit_move_insn (realr, res); emit_move_insn (realr, res);
if (!complex_part_zero_p (imag0, class, submode) if (imag0 != 0 && imag1 != 0)
&& !complex_part_zero_p (imag1, class, submode))
res = expand_binop (submode, binoptab, imag0, imag1, res = expand_binop (submode, binoptab, imag0, imag1,
imagr, unsignedp, methods); imagr, unsignedp, methods);
else if (!complex_part_zero_p (imag0, class, submode)) else if (imag0 != 0)
res = imag0; res = imag0;
else if (binoptab->code == MINUS) else if (binoptab->code == MINUS)
res = expand_unop (submode, res = expand_unop (submode,
...@@ -1633,8 +1614,7 @@ expand_binop (mode, binoptab, op0, op1, target, unsignedp, methods) ...@@ -1633,8 +1614,7 @@ 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) */
if (!complex_part_zero_p (imag0, class, submode) if (imag0 != 0 && imag1 != 0)
&& !complex_part_zero_p (imag1, class, submode))
{ {
rtx temp1, temp2; rtx temp1, temp2;
...@@ -1697,7 +1677,7 @@ expand_binop (mode, binoptab, op0, op1, target, unsignedp, methods) ...@@ -1697,7 +1677,7 @@ expand_binop (mode, binoptab, op0, op1, target, unsignedp, methods)
else if (res != realr) else if (res != realr)
emit_move_insn (realr, res); emit_move_insn (realr, res);
if (!complex_part_zero_p (imag0, class, submode)) if (imag0 != 0)
res = expand_binop (submode, binoptab, res = expand_binop (submode, binoptab,
real1, imag0, imagr, unsignedp, methods); real1, imag0, imagr, unsignedp, methods);
else else
...@@ -1716,7 +1696,7 @@ expand_binop (mode, binoptab, op0, op1, target, unsignedp, methods) ...@@ -1716,7 +1696,7 @@ expand_binop (mode, binoptab, op0, op1, target, unsignedp, methods)
case DIV: case DIV:
/* (a+ib) / (c+id) = ((ac+bd)/(cc+dd)) + i((bc-ad)/(cc+dd)) */ /* (a+ib) / (c+id) = ((ac+bd)/(cc+dd)) + i((bc-ad)/(cc+dd)) */
if (complex_part_zero_p (imag1, class, submode)) if (imag1 == 0)
{ {
/* (a+ib) / (c+i0) = (a/c) + i(b/c) */ /* (a+ib) / (c+i0) = (a/c) + i(b/c) */
......
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