diff options
Diffstat (limited to 'contrib/gcc/expmed.c')
-rw-r--r-- | contrib/gcc/expmed.c | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/contrib/gcc/expmed.c b/contrib/gcc/expmed.c index a803934..864f78a 100644 --- a/contrib/gcc/expmed.c +++ b/contrib/gcc/expmed.c @@ -389,25 +389,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 (GET_CODE (op0) == SUBREG) - { - if (GET_MODE (SUBREG_REG (op0)) == fieldmode - || GET_MODE_CLASS (fieldmode) == MODE_INT - || GET_MODE_CLASS (fieldmode) == MODE_PARTIAL_INT) - op0 = SUBREG_REG (op0); - else - /* Else we've got some float mode source being extracted into - a different float mode destination -- this combination of - subregs results in Severe Tire Damage. */ - abort (); - } - if (GET_CODE (op0) == REG) - op0 = gen_rtx_SUBREG (fieldmode, op0, byte_offset); - else - op0 = adjust_address (op0, fieldmode, offset); - } + if (GET_CODE (op0) == MEM) + 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; } @@ -622,6 +608,7 @@ store_bit_field (rtx str_rtx, unsigned HOST_WIDE_INT bitsize, bestmode = GET_MODE (op0); if (bestmode == VOIDmode + || GET_MODE_SIZE (bestmode) < GET_MODE_SIZE (fieldmode) || (SLOW_UNALIGNED_ACCESS (bestmode, MEM_ALIGN (op0)) && GET_MODE_BITSIZE (bestmode) > MEM_ALIGN (op0))) goto insv_loses; @@ -1401,6 +1388,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); @@ -1531,6 +1523,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); |