expmed.c (store_bit_field): Add offset unconditionally for memory targets.
authorDale Johannesen <dalej@apple.com>
Tue, 15 Nov 2005 00:45:55 +0000 (00:45 +0000)
committerDale Johannesen <dalej@gcc.gnu.org>
Tue, 15 Nov 2005 00:45:55 +0000 (00:45 +0000)
2005-11-14  Dale Johannesen  <dalej@apple.com>

        * expmed.c (store_bit_field):  Add offset unconditionally for
        memory targets.
        (extract_bit_field):  Don't force extzv or extv operand into
        a register if field is too big.

From-SVN: r106919

gcc/ChangeLog
gcc/expmed.c

index 8ad58d5fdabc45ee406964de36b5eb33acd16fba..433f6d0b5817f764ad7023a396fc9484e0d8dfbd 100644 (file)
@@ -1,3 +1,10 @@
+2005-11-14  Dale Johannesen  <dalej@apple.com>
+
+       * expmed.c (store_bit_field):  Add offset unconditionally for
+       memory targets.
+       (extract_bit_field):  Don't force extzv or extv operand into
+       a register if field is too big.
+
 2005-11-14  Daniel Jacobowitz  <dan@codesourcery.com>
 
        * config/arm/arm.c (pic_labelno): New.
index 00172a355d6a029fec82ba9b83f294c5aeab4d94..632f24ff53b2a6214cc389c61c2aa957ccd11079 100644 (file)
@@ -430,14 +430,11 @@ store_bit_field (rtx str_rtx, unsigned HOST_WIDE_INT bitsize,
             || (offset * BITS_PER_UNIT % bitsize == 0
                 && MEM_ALIGN (op0) % GET_MODE_BITSIZE (fieldmode) == 0))))
     {
-      if (GET_MODE (op0) != fieldmode)
-       {
-         if (MEM_P (op0))
-           op0 = adjust_address (op0, fieldmode, offset);
-         else
-           op0 = simplify_gen_subreg (fieldmode, op0, GET_MODE (op0),
-                                      byte_offset);
-       }
+      if (MEM_P (op0))
+       op0 = adjust_address (op0, fieldmode, offset);
+      else if (GET_MODE (op0) != fieldmode)
+       op0 = simplify_gen_subreg (fieldmode, op0, GET_MODE (op0),
+                                  byte_offset);
       emit_move_insn (op0, value);
       return value;
     }
@@ -1410,6 +1407,11 @@ extract_bit_field (rtx str_rtx, unsigned HOST_WIDE_INT bitsize,
                  xbitpos = bitnum % unit;
                  xop0 = adjust_address (xop0, bestmode, xoffset);
 
+                 /* Make sure register is big enough for the whole field. */
+                 if (xoffset * BITS_PER_UNIT + unit 
+                     < offset * BITS_PER_UNIT + bitsize)
+                   goto extzv_loses;
+
                  /* Fetch it to a register in that size.  */
                  xop0 = force_reg (bestmode, xop0);
 
@@ -1539,6 +1541,11 @@ extract_bit_field (rtx str_rtx, unsigned HOST_WIDE_INT bitsize,
                  xbitpos = bitnum % unit;
                  xop0 = adjust_address (xop0, bestmode, xoffset);
 
+                 /* Make sure register is big enough for the whole field. */
+                 if (xoffset * BITS_PER_UNIT + unit 
+                     < offset * BITS_PER_UNIT + bitsize)
+                   goto extv_loses;
+
                  /* Fetch it to a register in that size.  */
                  xop0 = force_reg (bestmode, xop0);