reload.c (find_reloads_subreg_address): Use correct offset for paradoxical MEM subreg...
authorUlrich Weigand <uweigand@de.ibm.com>
Mon, 6 Oct 2003 15:56:07 +0000 (15:56 +0000)
committerUlrich Weigand <uweigand@gcc.gnu.org>
Mon, 6 Oct 2003 15:56:07 +0000 (15:56 +0000)
* reload.c (find_reloads_subreg_address): Use correct offset for
paradoxical MEM subregs on big-endian targets.

From-SVN: r72153

gcc/ChangeLog
gcc/reload.c

index d36ae3aa8fa6c3c57848e63b02af2774005d13d7..b39d79c1b04b0a9a2d73de77f7814c88ce68c4c3 100644 (file)
@@ -1,3 +1,8 @@
+2003-10-06  Ulrich Weigand  <uweigand@de.ibm.com>
+
+       * reload.c (find_reloads_subreg_address): Use correct offset for
+       paradoxical MEM subregs on big-endian targets.
+
 2003-10-06  Andrew Haley  <aph@redhat.com>
 
        * tree.c (get_callee_fndecl): Call
index dc088730e67bd5e65f659480c99b5f8787efabe6..59852ba2b5eaaeb68b7a1532a29fd30640726a18 100644 (file)
@@ -5806,9 +5806,16 @@ find_reloads_subreg_address (rtx x, int force_replace, int opnum,
          if (force_replace
              || ! rtx_equal_p (tem, reg_equiv_mem[regno]))
            {
-             int offset = SUBREG_BYTE (x);
              unsigned outer_size = GET_MODE_SIZE (GET_MODE (x));
              unsigned inner_size = GET_MODE_SIZE (GET_MODE (SUBREG_REG (x)));
+             int offset;
+
+             /* For big-endian paradoxical subregs, SUBREG_BYTE does not
+                hold the correct (negative) byte offset.  */
+             if (BYTES_BIG_ENDIAN && outer_size > inner_size)
+               offset = inner_size - outer_size;
+             else
+               offset = SUBREG_BYTE (x);
 
              XEXP (tem, 0) = plus_constant (XEXP (tem, 0), offset);
              PUT_MODE (tem, GET_MODE (x));