From 69498c64a33688edbb9b8dcadb6c5025cebf61f5 Mon Sep 17 00:00:00 2001 From: Dale Johannesen Date: Tue, 15 Nov 2005 00:45:55 +0000 Subject: [PATCH] expmed.c (store_bit_field): Add offset unconditionally for memory targets. 2005-11-14 Dale Johannesen * 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 --- gcc/ChangeLog | 7 +++++++ gcc/expmed.c | 23 +++++++++++++++-------- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8ad58d5fdab..433f6d0b581 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2005-11-14 Dale Johannesen + + * 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. + 2005-11-14 Daniel Jacobowitz * config/arm/arm.c (pic_labelno): New. diff --git a/gcc/expmed.c b/gcc/expmed.c index 00172a355d6..632f24ff53b 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);