summaryrefslogtreecommitdiff
path: root/gcc/expmed.c
diff options
context:
space:
mode:
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2012-03-27 20:50:16 +0000
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2012-03-27 20:50:16 +0000
commitcefa4c337f087ee2eb751d7b4ea93ae323c14f57 (patch)
tree73769ec7025d31af9ae6e54d533e687dcfd17ed5 /gcc/expmed.c
parent263f25bdc576c5da3dfbe05194f871c3bf3f0494 (diff)
downloadgcc-cefa4c337f087ee2eb751d7b4ea93ae323c14f57.tar.gz
PR middle-end/51893
* expmed.c (store_bit_field_1): Fix wordnum value for big-endian targets. git-svn-id: svn+ssh://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,