Message ID | 4F16B19D.5050806@gmail.com |
---|---|
State | New |
Headers | show |
On Wed, Jan 18, 2012 at 12:48:45PM +0100, Aurelien Buhrig wrote: > The problem occurs when value is a REG and bitsize > BITS_PER_WORD. This > is because wordnum, which is used to get the subword of value, is > incorrectly computed, in BIG_ENDIAN, wrt the number of words needed by > bitsize instead of the number of words needed by the integer mode of the > field, which is the mode used to compute subwords. That doesn't sound right. wordnum is passed to operand_subword as its "offset" param, which counts in words of word_mode size. I think you have a problem elsewhere.
Le 21/01/2012 03:37, Alan Modra a écrit : >> The problem occurs when value is a REG and bitsize > BITS_PER_WORD. This >> is because wordnum, which is used to get the subword of value, is >> incorrectly computed, in BIG_ENDIAN, wrt the number of words needed by >> bitsize instead of the number of words needed by the integer mode of the >> field, which is the mode used to compute subwords. > > That doesn't sound right. wordnum is passed to operand_subword as its > "offset" param, which counts in words of word_mode size. I think you > have a problem elsewhere. > The offset is wrong. I filed a bug. See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51893
--- expmed.c.orig 2012-01-18 11:48:21.000000000 +0100 +++ expmed.c 2012-01-18 11:49:19.000000000 +0100 @@ -589,7 +589,10 @@ { /* 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,