OSDN Git Service

PR middle-end/12705
authorsayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 23 Oct 2003 21:37:52 +0000 (21:37 +0000)
committersayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 23 Oct 2003 21:37:52 +0000 (21:37 +0000)
* optabs.c (expand_binop): When expanding complex operations
inline, always calculate result into a new temporary register.
Minor code clean-ups.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@72871 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/optabs.c

index b76df94..e29d3bc 100644 (file)
@@ -1,3 +1,10 @@
+2003-10-23  Roger Sayle  <roger@eyesopen.com>
+
+       PR middle-end/12705
+       * optabs.c (expand_binop): When expanding complex operations
+       inline, always calculate result into a new temporary register.
+       Minor code clean-ups.
+
 2003-10-24  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>
 
        * objc/lang-specs.h: Handle -print-objc-runtime-info.
index a56c89f..1410ed2 100644 (file)
@@ -1521,24 +1521,17 @@ expand_binop (enum machine_mode mode, optab binoptab, rtx op0, rtx op1,
       rtx real0 = 0, imag0 = 0;
       rtx real1 = 0, imag1 = 0;
       rtx realr, imagr, res;
-      rtx seq;
-      rtx equiv_value;
+      rtx seq, result;
       int ok = 0;
 
       /* Find the correct mode for the real and imaginary parts.  */
-      enum machine_mode submode = GET_MODE_INNER(mode);
+      enum machine_mode submode = GET_MODE_INNER (mode);
 
       if (submode == BLKmode)
        abort ();
 
-      if (! target)
-       target = gen_reg_rtx (mode);
-
       start_sequence ();
 
-      realr = gen_realpart (submode, target);
-      imagr = gen_imagpart (submode, target);
-
       if (GET_MODE (op0) == mode)
        {
          real0 = gen_realpart (submode, op0);
@@ -1558,6 +1551,10 @@ expand_binop (enum machine_mode mode, optab binoptab, rtx op0, rtx op1,
       if (real0 == 0 || real1 == 0 || ! (imag0 != 0 || imag1 != 0))
        abort ();
 
+      result = gen_reg_rtx (mode);
+      realr = gen_realpart (submode, result);
+      imagr = gen_imagpart (submode, result);
+
       switch (binoptab->code)
        {
        case PLUS:
@@ -1749,16 +1746,10 @@ expand_binop (enum machine_mode mode, optab binoptab, rtx op0, rtx op1,
 
       if (ok)
        {
-         if (binoptab->code != UNKNOWN)
-           equiv_value
-             = gen_rtx_fmt_ee (binoptab->code, mode,
-                               copy_rtx (op0), copy_rtx (op1));
-         else
-           equiv_value = 0;
-
-         emit_no_conflict_block (seq, target, op0, op1, equiv_value);
-
-         return target;
+         rtx equiv = gen_rtx_fmt_ee (binoptab->code, mode,
+                                     copy_rtx (op0), copy_rtx (op1));
+         emit_no_conflict_block (seq, result, op0, op1, equiv);
+         return result;
        }
     }