summaryrefslogtreecommitdiff
path: root/gcc/expmed.c
diff options
context:
space:
mode:
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>1995-06-08 23:21:13 +0000
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>1995-06-08 23:21:13 +0000
commit052251d066e5716bbbf385c623065b04a50d48f8 (patch)
tree4c73a5eb6a8c3d1ad9b25086b65d85d9e1047f50 /gcc/expmed.c
parentf1a6e1483b89338bf7e416054c1635ccbdb2d213 (diff)
downloadgcc-052251d066e5716bbbf385c623065b04a50d48f8.tar.gz
(store_split_bit_field): When adjust arg in BYTES_BIT_ENDIAN case, use
number of bits in arg for MEM operands and BITS_PER_WORD for other operands. (extract_fixed_bit_field): Undo last change. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@9911 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/expmed.c')
-rw-r--r--gcc/expmed.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/gcc/expmed.c b/gcc/expmed.c
index e2d31bef155..4da81a7c94d 100644
--- a/gcc/expmed.c
+++ b/gcc/expmed.c
@@ -770,6 +770,16 @@ store_split_bit_field (op0, bitsize, bitpos, value, align)
if (BYTES_BIG_ENDIAN)
{
+ int total_bits;
+
+ /* We must do an endian conversion exactly the same way as it is
+ done in extract_bit_field, so that the two calls to
+ extract_fixed_bit_field will have comparable arguments. */
+ if (GET_CODE (value) != MEM)
+ total_bits = BITS_PER_WORD;
+ else
+ total_bits = GET_MODE_BITSIZE (GET_MODE (value));
+
/* Fetch successively less significant portions. */
if (GET_CODE (value) == CONST_INT)
part = GEN_INT (((unsigned HOST_WIDE_INT) (INTVAL (value))
@@ -780,8 +790,7 @@ store_split_bit_field (op0, bitsize, bitpos, value, align)
lsb. Give extract_bit_field the value it needs (with
endianness compensation) to fetch the piece we want. */
part = extract_fixed_bit_field (word_mode, value, 0, thissize,
- GET_MODE_BITSIZE (GET_MODE (value))
- - bitsize + bitsdone,
+ total_bits - bitsize + bitsdone,
NULL_RTX, 1, align);
}
else
@@ -1362,7 +1371,7 @@ extract_fixed_bit_field (tmode, op0, offset, bitsize, bitpos,
int unsignedp;
int align;
{
- int total_bits;
+ int total_bits = BITS_PER_WORD;
enum machine_mode mode;
if (GET_CODE (op0) == SUBREG || GET_CODE (op0) == REG)
@@ -1371,9 +1380,6 @@ extract_fixed_bit_field (tmode, op0, offset, bitsize, bitpos,
if (bitsize + bitpos > BITS_PER_WORD)
return extract_split_bit_field (op0, bitsize, bitpos,
unsignedp, align);
-
- mode = GET_MODE (op0);
- total_bits = GET_MODE_BITSIZE (mode);
}
else
{
@@ -1414,6 +1420,8 @@ extract_fixed_bit_field (tmode, op0, offset, bitsize, bitpos,
plus_constant (XEXP (op0, 0), offset));
}
+ mode = GET_MODE (op0);
+
if (BYTES_BIG_ENDIAN)
{
/* BITPOS is the distance between our msb and that of OP0.