OSDN Git Service

Cope with inlining functions which return a multiword CONCAT value
authornickc <nickc@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 15 Dec 1998 11:56:36 +0000 (11:56 +0000)
committernickc <nickc@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 15 Dec 1998 11:56:36 +0000 (11:56 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@24328 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/emit-rtl.c
gcc/integrate.c

index 0b4e5a8..beb0b81 100644 (file)
@@ -1,3 +1,13 @@
+Tue Dec 15 11:55:30 1998  Nick Clifton  <nickc@cygnus.com>
+
+       * integrate.c (copy_rtx_and_substitute): If a SUBREG is
+       replaced by a CONCAT whoes components do not have the same
+       mode as the original SUBREG, use a new SUBREG to restore the
+       mode. 
+
+       * emit-rtl.c (subreg_realpart_p): Cope with subregs containing
+       multiword complex values.
+
 1998-12-15  Zack Weinberg  <zack@rabi.phys.columbia.edu>
 
        * cppalloc.c: Add xstrdup here.
index c5d5060..701415f 100644 (file)
@@ -942,7 +942,7 @@ subreg_realpart_p (x)
   if (GET_CODE (x) != SUBREG)
     abort ();
 
-  return SUBREG_WORD (x) == 0;
+  return SUBREG_WORD (x) * UNITS_PER_WORD < GET_MODE_UNIT_SIZE (GET_MODE (SUBREG_REG (x)));
 }
 \f
 /* Assuming that X is an rtx (e.g., MEM, REG or SUBREG) for a value,
index 4c1464c..943eeaf 100644 (file)
@@ -2451,7 +2451,17 @@ copy_rtx_and_substitute (orig, map)
        return gen_rtx_SUBREG (GET_MODE (orig), SUBREG_REG (copy),
                               SUBREG_WORD (orig) + SUBREG_WORD (copy));
       else if (GET_CODE (copy) == CONCAT)
-       return (subreg_realpart_p (orig) ? XEXP (copy, 0) : XEXP (copy, 1));
+       {
+         rtx retval = subreg_realpart_p (orig) ? XEXP (copy, 0) : XEXP (copy, 1);
+
+         if (GET_MODE (retval) == GET_MODE (orig))
+           return retval;
+         else
+           return gen_rtx_SUBREG (GET_MODE (orig), retval,
+                                  (SUBREG_WORD (orig) %
+                                   (GET_MODE_UNIT_SIZE (GET_MODE (SUBREG_REG (orig)))
+                                    / (unsigned) UNITS_PER_WORD)));
+       }
       else
        return gen_rtx_SUBREG (GET_MODE (orig), copy,
                               SUBREG_WORD (orig));