OSDN Git Service

Get correct bit offset for big endian (SUBREG (REG))
authormeissner <meissner@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 3 Apr 1995 20:19:05 +0000 (20:19 +0000)
committermeissner <meissner@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 3 Apr 1995 20:19:05 +0000 (20:19 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@9299 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/expmed.c

index f725f7a..fc0a0ef 100644 (file)
@@ -878,7 +878,21 @@ extract_bit_field (str_rtx, bitsize, bitnum, unsignedp,
     tmode = mode;
   while (GET_CODE (op0) == SUBREG)
     {
+      int outer_size = GET_MODE_BITSIZE (GET_MODE (op0));
+      int inner_size = GET_MODE_BITSIZE (GET_MODE (SUBREG_REG (op0)));
+
       offset += SUBREG_WORD (op0);
+
+      if (BYTES_BIG_ENDIAN && (outer_size < inner_size))
+       {
+         bitpos += inner_size - outer_size;
+         if (bitpos > unit)
+           {
+             offset += (bitpos / unit);
+             bitpos %= unit;
+           }
+       }
+
       op0 = SUBREG_REG (op0);
     }