OSDN Git Service

* reload.c (find_reloads_subreg_address): Use correct offset for
authoruweigand <uweigand@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 6 Oct 2003 15:56:07 +0000 (15:56 +0000)
committeruweigand <uweigand@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 6 Oct 2003 15:56:07 +0000 (15:56 +0000)
paradoxical MEM subregs on big-endian targets.

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

gcc/ChangeLog
gcc/reload.c

index d36ae3a..b39d79c 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 dc08873..59852ba 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));