aboutsummaryrefslogtreecommitdiff
path: root/gcc/expmed.c
diff options
context:
space:
mode:
authorAurelien Buhrig <aurelien.buhrig.gcc@gmail.com>2012-03-27 20:50:16 +0000
committerEric Botcazou <ebotcazou@adacore.com>2012-03-27 20:50:16 +0000
commit583ac509a941d47abf186dc2ea7533854429b28d (patch)
tree73769ec7025d31af9ae6e54d533e687dcfd17ed5 /gcc/expmed.c
parent670d6247516c249ec2afe6df135d79a6cbf77ff4 (diff)
PR middle-end/51893
* expmed.c (store_bit_field_1): Fix wordnum value for big-endian targets. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@185897 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/expmed.c')
-rw-r--r--gcc/expmed.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/expmed.c b/gcc/expmed.c
index 54e51dca02d..5eea2ab8b51 100644
--- a/gcc/expmed.c
+++ b/gcc/expmed.c
@@ -550,7 +550,10 @@ store_bit_field_1 (rtx str_rtx, unsigned HOST_WIDE_INT bitsize,
{
/* If I is 0, use the low-order word in both field and target;
if I is 1, use the next to lowest word; and so on. */
- unsigned int wordnum = (backwards ? nwords - i - 1 : i);
+ unsigned int wordnum = (backwards
+ ? GET_MODE_SIZE (fieldmode) / UNITS_PER_WORD
+ - i - 1
+ : i);
unsigned int bit_offset = (backwards
? MAX ((int) bitsize - ((int) i + 1)
* BITS_PER_WORD,