diff options
author | Jim Wilson <wilson@gcc.gnu.org> | 1993-04-25 14:07:22 -0700 |
---|---|---|
committer | Jim Wilson <wilson@gcc.gnu.org> | 1993-04-25 14:07:22 -0700 |
commit | 401db79156cdaef435b566f7c54abac74d53108b (patch) | |
tree | d740e7f9b823f5db2f7282f7c8f36ee32b327668 | |
parent | 31e4b1c0990daaa780524bf61f060049571f018b (diff) | |
download | gcc-401db79156cdaef435b566f7c54abac74d53108b.zip gcc-401db79156cdaef435b566f7c54abac74d53108b.tar.gz gcc-401db79156cdaef435b566f7c54abac74d53108b.tar.bz2 |
(extract_fixed_bit_field): Adjust BITPOS so that it
fits inside MODE before adjusting OFFSET to get an aligned address.
From-SVN: r4216
-rw-r--r-- | gcc/expmed.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/expmed.c b/gcc/expmed.c index 90ab40f..6e7efad 100644 --- a/gcc/expmed.c +++ b/gcc/expmed.c @@ -1257,6 +1257,16 @@ extract_fixed_bit_field (tmode, op0, offset, bitsize, bitpos, total_bits = GET_MODE_BITSIZE (mode); + /* Make sure bitpos is valid for the chosen mode. Adjust BITPOS to + be be in the range 0 to total_bits-1, and put any excess bytes in + OFFSET. */ + if (bitpos >= total_bits) + { + offset += (bitpos / total_bits) * (total_bits / BITS_PER_UNIT); + bitpos -= ((bitpos / total_bits) * (total_bits / BITS_PER_UNIT) + * BITS_PER_UNIT); + } + /* Get ref to an aligned byte, halfword, or word containing the field. Adjust BITPOS to be position within a word, and OFFSET to be the offset of that word. |