diff options
author | rsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-01-17 20:37:46 +0000 |
---|---|---|
committer | rsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-01-17 20:37:46 +0000 |
commit | 4d18c297eb4e8f4f1cda3ccfd1efac6c033b9a16 (patch) | |
tree | 0817497fe59c2693e5501c674272b3c4672529f3 | |
parent | 487ecfe987fa0a567e39bc153975326099bff014 (diff) | |
download | gcc-4d18c297eb4e8f4f1cda3ccfd1efac6c033b9a16.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@183262 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 11 | ||||
-rw-r--r-- | gcc/expmed.c | 18 | ||||
-rw-r--r-- | gcc/optabs.c | 2 | ||||
-rw-r--r-- | gcc/optabs.h | 4 |
4 files changed, 31 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fbd93bb6313..6def41fee76 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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 diff --git a/gcc/expmed.c b/gcc/expmed.c index bced96e74d4..09a933da5f5 100644 --- a/gcc/expmed.c +++ b/gcc/expmed.c @@ -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, diff --git a/gcc/optabs.c b/gcc/optabs.c index b586eb91626..a532ba3d538 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -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) diff --git a/gcc/optabs.h b/gcc/optabs.h index cc4854dcf48..6ad6dae9ab6 100644 --- a/gcc/optabs.h +++ b/gcc/optabs.h @@ -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); |