From cefa4c337f087ee2eb751d7b4ea93ae323c14f57 Mon Sep 17 00:00:00 2001 From: ebotcazou Date: Tue, 27 Mar 2012 20:50:16 +0000 Subject: [PATCH] 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 --- gcc/ChangeLog | 6 ++++++ gcc/expmed.c | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index cc4f0cb..a7a7661 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2012-03-27 Aurelien Buhrig + + PR middle-end/51893 + * expmed.c (store_bit_field_1): Fix wordnum value for big-endian + targets. + 2012-03-27 Oleg Endo PR target/50751 diff --git a/gcc/expmed.c b/gcc/expmed.c index 54e51dc..5eea2ab 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, -- 2.7.4