aboutsummaryrefslogtreecommitdiff
path: root/gcc/expmed.c
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2005-11-15 00:45:55 +0000
committerDale Johannesen <dalej@gcc.gnu.org>2005-11-15 00:45:55 +0000
commit69498c64a33688edbb9b8dcadb6c5025cebf61f5 (patch)
tree43b1c5181891aeb6fa652c06e16dcee87285bf34 /gcc/expmed.c
parent53acd3845fdae40c43ff3a0b813aa6cf5428205b (diff)
downloadgcc-69498c64a33688edbb9b8dcadb6c5025cebf61f5.zip
gcc-69498c64a33688edbb9b8dcadb6c5025cebf61f5.tar.gz
gcc-69498c64a33688edbb9b8dcadb6c5025cebf61f5.tar.bz2
expmed.c (store_bit_field): Add offset unconditionally for memory targets.
2005-11-14 Dale Johannesen <dalej@apple.com> * expmed.c (store_bit_field): Add offset unconditionally for memory targets. (extract_bit_field): Don't force extzv or extv operand into a register if field is too big. From-SVN: r106919
Diffstat (limited to 'gcc/expmed.c')
-rw-r--r--gcc/expmed.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/gcc/expmed.c b/gcc/expmed.c
index 00172a3..632f24f 100644
--- a/gcc/expmed.c
+++ b/gcc/expmed.c
@@ -430,14 +430,11 @@ store_bit_field (rtx str_rtx, unsigned HOST_WIDE_INT bitsize,
|| (offset * BITS_PER_UNIT % bitsize == 0
&& MEM_ALIGN (op0) % GET_MODE_BITSIZE (fieldmode) == 0))))
{
- if (GET_MODE (op0) != fieldmode)
- {
- if (MEM_P (op0))
- op0 = adjust_address (op0, fieldmode, offset);
- else
- op0 = simplify_gen_subreg (fieldmode, op0, GET_MODE (op0),
- byte_offset);
- }
+ if (MEM_P (op0))
+ op0 = adjust_address (op0, fieldmode, offset);
+ else if (GET_MODE (op0) != fieldmode)
+ op0 = simplify_gen_subreg (fieldmode, op0, GET_MODE (op0),
+ byte_offset);
emit_move_insn (op0, value);
return value;
}
@@ -1410,6 +1407,11 @@ extract_bit_field (rtx str_rtx, unsigned HOST_WIDE_INT bitsize,
xbitpos = bitnum % unit;
xop0 = adjust_address (xop0, bestmode, xoffset);
+ /* Make sure register is big enough for the whole field. */
+ if (xoffset * BITS_PER_UNIT + unit
+ < offset * BITS_PER_UNIT + bitsize)
+ goto extzv_loses;
+
/* Fetch it to a register in that size. */
xop0 = force_reg (bestmode, xop0);
@@ -1539,6 +1541,11 @@ extract_bit_field (rtx str_rtx, unsigned HOST_WIDE_INT bitsize,
xbitpos = bitnum % unit;
xop0 = adjust_address (xop0, bestmode, xoffset);
+ /* Make sure register is big enough for the whole field. */
+ if (xoffset * BITS_PER_UNIT + unit
+ < offset * BITS_PER_UNIT + bitsize)
+ goto extv_loses;
+
/* Fetch it to a register in that size. */
xop0 = force_reg (bestmode, xop0);