]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gcc/
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 31 Oct 2012 08:00:51 +0000 (08:00 +0000)
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 31 Oct 2012 08:00:51 +0000 (08:00 +0000)
* expmed.c (store_bit_field_1): Move generation of MEM insvs
to the MEM_P block.
(extract_bit_field_1): Likewise extvs and extzvs.

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

gcc/ChangeLog
gcc/expmed.c

index 3bf1bba568f98bafb99419d56f4f81a9c9d29037..9f4f4ce92cf81f546a879f6aca900c35ef84c3d7 100644 (file)
@@ -1,3 +1,9 @@
+2012-10-31  Richard Sandiford  <rdsandiford@googlemail.com>
+
+       * expmed.c (store_bit_field_1): Move generation of MEM insvs
+       to the MEM_P block.
+       (extract_bit_field_1): Likewise extvs and extzvs.
+
 2012-10-31  Richard Sandiford  <rdsandiford@googlemail.com>
 
        * expmed.c (store_bit_field_using_insv): New function,
index 4e20a9456015d068065a8fabc6f00fc7161035ca..5b697a1cd2d765d1b6832e901973533711adaca4 100644 (file)
@@ -784,16 +784,7 @@ store_bit_field_1 (rtx str_rtx, unsigned HOST_WIDE_INT bitsize,
 
   enum machine_mode op_mode = mode_for_extraction (EP_insv, 3);
   if (op_mode != MAX_MACHINE_MODE
-      /* Do not use insv for volatile bitfields when
-         -fstrict-volatile-bitfields is in effect.  */
-      && !(MEM_P (op0) && MEM_VOLATILE_P (op0)
-          && flag_strict_volatile_bitfields > 0)
-      /* Do not use insv if the bit region is restricted and
-        op_mode integer at offset doesn't fit into the
-        restricted region.  */
-      && !(MEM_P (op0) && bitregion_end
-          && bitnum - (bitnum % BITS_PER_UNIT) + GET_MODE_BITSIZE (op_mode)
-             > bitregion_end + 1)
+      && !MEM_P (op0)
       && store_bit_field_using_insv (op0, bitsize, bitnum, value, op_mode))
     return true;
 
@@ -804,6 +795,18 @@ store_bit_field_1 (rtx str_rtx, unsigned HOST_WIDE_INT bitsize,
       enum machine_mode bestmode;
       unsigned HOST_WIDE_INT maxbits = MAX_FIXED_MODE_SIZE;
 
+      /* Do not use insv for volatile bitfields when
+         -fstrict-volatile-bitfields is in effect.  */
+      if (!(MEM_VOLATILE_P (op0) && flag_strict_volatile_bitfields > 0)
+         /* Do not use insv if the bit region is restricted and
+            an op_mode integer doesn't fit into the restricted region.  */
+         && !(bitregion_end
+              && (bitnum - (bitnum % BITS_PER_UNIT)
+                  + GET_MODE_BITSIZE (op_mode)
+                  > bitregion_end + 1))
+         && store_bit_field_using_insv (op0, bitsize, bitnum, value, op_mode))
+       return true;
+
       if (bitregion_end)
        maxbits = bitregion_end - bitregion_start + 1;
 
@@ -1594,11 +1597,7 @@ extract_bit_field_1 (rtx str_rtx, unsigned HOST_WIDE_INT bitsize,
      If OP0 is a register, it too fits within a word.  */
 
   ext_mode = mode_for_extraction (unsignedp ? EP_extzv : EP_extv, 0);
-  if (ext_mode != MAX_MACHINE_MODE
-      /* Do not use extv/extzv for volatile bitfields when
-         -fstrict-volatile-bitfields is in effect.  */
-      && !(MEM_P (op0) && MEM_VOLATILE_P (op0)
-          && flag_strict_volatile_bitfields > 0))
+  if (ext_mode != MAX_MACHINE_MODE && !MEM_P (op0))
     {
       rtx result = extract_bit_field_using_extv (op0, bitsize, bitnum,
                                                 unsignedp, target, mode,
@@ -1613,6 +1612,17 @@ extract_bit_field_1 (rtx str_rtx, unsigned HOST_WIDE_INT bitsize,
     {
       enum machine_mode bestmode;
 
+      /* Do not use extv/extzv for volatile bitfields when
+         -fstrict-volatile-bitfields is in effect.  */
+      if (!(MEM_VOLATILE_P (op0) && flag_strict_volatile_bitfields > 0))
+       {
+         rtx result = extract_bit_field_using_extv (op0, bitsize, bitnum,
+                                                    unsignedp, target, mode,
+                                                    tmode, ext_mode);
+         if (result)
+           return result;
+       }
+
       /* Get the mode to use for inserting into this field.  If
         OP0 is BLKmode, get the smallest mode consistent with the
         alignment. If OP0 is a non-BLKmode object that is no