re PR middle-end/50325 (76 new fails with rev. 177691)
authorAndreas Krebbel <Andreas.Krebbel@de.ibm.com>
Tue, 17 Jan 2012 20:37:46 +0000 (20:37 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Tue, 17 Jan 2012 20:37:46 +0000 (20:37 +0000)
gcc/
2012-01-17  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>
    Richard Sandiford  <rdsandiford@googlemail.com>

PR middle-end/50325
PR middle-end/51192
* optabs.h (simplify_expand_binop): Declare.
* optabs.c (simplify_expand_binop): Make global.
* expmed.c (store_bit_field_1): Use simplify_expand_binop on big
endian targets if the source cannot be exactly covered by word
mode chunks.

Co-Authored-By: Richard Sandiford <rdsandiford@googlemail.com>
From-SVN: r183262

gcc/ChangeLog
gcc/expmed.c
gcc/optabs.c
gcc/optabs.h

index fbd93bb6313a8878ea9702f5b53848086b70b7ee..6def41fee76b7b8fdf0130f551556cd51765aa4f 100644 (file)
@@ -1,3 +1,14 @@
+2012-01-17  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>
+           Richard Sandiford  <rdsandiford@googlemail.com>
+
+       PR middle-end/50325
+       PR middle-end/51192
+       * optabs.h (simplify_expand_binop): Declare.
+       * optabs.c (simplify_expand_binop): Make global.
+       * expmed.c (store_bit_field_1): Use simplify_expand_binop on big
+       endian targets if the source cannot be exactly covered by word
+       mode chunks.
+
 2012-01-17  Jakub Jelinek  <jakub@redhat.com>
 
        PR bootstrap/51872
index bced96e74d455203e917a0ea655b5f3f36a1b713..09a933da5f5b63abb84a472c4055f3cc9e92726d 100644 (file)
@@ -557,9 +557,21 @@ store_bit_field_1 (rtx str_rtx, unsigned HOST_WIDE_INT bitsize,
                                            0)
                                     : (int) i * BITS_PER_WORD);
          rtx value_word = operand_subword_force (value, wordnum, fieldmode);
-
-         if (!store_bit_field_1 (op0, MIN (BITS_PER_WORD,
-                                           bitsize - i * BITS_PER_WORD),
+         unsigned HOST_WIDE_INT new_bitsize =
+           MIN (BITS_PER_WORD, bitsize - i * BITS_PER_WORD);
+
+         /* If the remaining chunk doesn't have full wordsize we have
+            to make sure that for big endian machines the higher order
+            bits are used.  */
+         if (new_bitsize < BITS_PER_WORD && BYTES_BIG_ENDIAN && !backwards)
+           value_word = simplify_expand_binop (word_mode, lshr_optab,
+                                               value_word,
+                                               GEN_INT (BITS_PER_WORD
+                                                        - new_bitsize),
+                                               NULL_RTX, true,
+                                               OPTAB_LIB_WIDEN);
+
+         if (!store_bit_field_1 (op0, new_bitsize,
                                  bitnum + bit_offset,
                                  bitregion_start, bitregion_end,
                                  word_mode,
index b586eb91626da0e0ec8dbcfd5e60df7147b93f48..a532ba3d5389b9f556265d3f5dbc9e2a65606814 100644 (file)
@@ -659,7 +659,7 @@ expand_ternary_op (enum machine_mode mode, optab ternary_optab, rtx op0,
    calculated at compile time.  The arguments and return value are
    otherwise the same as for expand_binop.  */
 
-static rtx
+rtx
 simplify_expand_binop (enum machine_mode mode, optab binoptab,
                       rtx op0, rtx op1, rtx target, int unsignedp,
                       enum optab_methods methods)
index cc4854dcf48bf3f7a88f4be6a65df2b6019cfc20..6ad6dae9ab676b4c3dd8839e9147ded239bf980c 100644 (file)
@@ -859,6 +859,10 @@ extern rtx expand_ternary_op (enum machine_mode mode, optab ternary_optab,
 extern rtx expand_binop (enum machine_mode, optab, rtx, rtx, rtx, int,
                         enum optab_methods);
 
+extern rtx simplify_expand_binop (enum machine_mode mode, optab binoptab,
+                                 rtx op0, rtx op1, rtx target, int unsignedp,
+                                 enum optab_methods methods);
+
 extern bool force_expand_binop (enum machine_mode, optab, rtx, rtx, rtx, int,
                                enum optab_methods);