expmed.c (store_bit_field_1): Move generation of MEM insvs to the MEM_P block.

gcc/
	* expmed.c (store_bit_field_1): Move generation of MEM insvs
	to the MEM_P block.
	(extract_bit_field_1): Likewise extvs and extzvs.

From-SVN: r193024
This commit is contained in:
Richard Sandiford 2012-10-31 08:00:51 +00:00 committed by Richard Sandiford
parent a20556e46c
commit 17a73ba049
2 changed files with 31 additions and 15 deletions

View File

@ -1,3 +1,9 @@
2012-10-31 Richard Sandiford <rdsandiford@googlemail.com>
* expmed.c (store_bit_field_1): Move generation of MEM insvs
to the MEM_P block.
(extract_bit_field_1): Likewise extvs and extzvs.
2012-10-31 Richard Sandiford <rdsandiford@googlemail.com>
* expmed.c (store_bit_field_using_insv): New function,

View File

@ -784,16 +784,7 @@ store_bit_field_1 (rtx str_rtx, unsigned HOST_WIDE_INT bitsize,
enum machine_mode op_mode = mode_for_extraction (EP_insv, 3);
if (op_mode != MAX_MACHINE_MODE
/* Do not use insv for volatile bitfields when
-fstrict-volatile-bitfields is in effect. */
&& !(MEM_P (op0) && MEM_VOLATILE_P (op0)
&& flag_strict_volatile_bitfields > 0)
/* Do not use insv if the bit region is restricted and
op_mode integer at offset doesn't fit into the
restricted region. */
&& !(MEM_P (op0) && bitregion_end
&& bitnum - (bitnum % BITS_PER_UNIT) + GET_MODE_BITSIZE (op_mode)
> bitregion_end + 1)
&& !MEM_P (op0)
&& store_bit_field_using_insv (op0, bitsize, bitnum, value, op_mode))
return true;
@ -804,6 +795,18 @@ store_bit_field_1 (rtx str_rtx, unsigned HOST_WIDE_INT bitsize,
enum machine_mode bestmode;
unsigned HOST_WIDE_INT maxbits = MAX_FIXED_MODE_SIZE;
/* Do not use insv for volatile bitfields when
-fstrict-volatile-bitfields is in effect. */
if (!(MEM_VOLATILE_P (op0) && flag_strict_volatile_bitfields > 0)
/* Do not use insv if the bit region is restricted and
an op_mode integer doesn't fit into the restricted region. */
&& !(bitregion_end
&& (bitnum - (bitnum % BITS_PER_UNIT)
+ GET_MODE_BITSIZE (op_mode)
> bitregion_end + 1))
&& store_bit_field_using_insv (op0, bitsize, bitnum, value, op_mode))
return true;
if (bitregion_end)
maxbits = bitregion_end - bitregion_start + 1;
@ -1594,11 +1597,7 @@ extract_bit_field_1 (rtx str_rtx, unsigned HOST_WIDE_INT bitsize,
If OP0 is a register, it too fits within a word. */
ext_mode = mode_for_extraction (unsignedp ? EP_extzv : EP_extv, 0);
if (ext_mode != MAX_MACHINE_MODE
/* Do not use extv/extzv for volatile bitfields when
-fstrict-volatile-bitfields is in effect. */
&& !(MEM_P (op0) && MEM_VOLATILE_P (op0)
&& flag_strict_volatile_bitfields > 0))
if (ext_mode != MAX_MACHINE_MODE && !MEM_P (op0))
{
rtx result = extract_bit_field_using_extv (op0, bitsize, bitnum,
unsignedp, target, mode,
@ -1613,6 +1612,17 @@ extract_bit_field_1 (rtx str_rtx, unsigned HOST_WIDE_INT bitsize,
{
enum machine_mode bestmode;
/* Do not use extv/extzv for volatile bitfields when
-fstrict-volatile-bitfields is in effect. */
if (!(MEM_VOLATILE_P (op0) && flag_strict_volatile_bitfields > 0))
{
rtx result = extract_bit_field_using_extv (op0, bitsize, bitnum,
unsignedp, target, mode,
tmode, ext_mode);
if (result)
return result;
}
/* Get the mode to use for inserting into this field. If
OP0 is BLKmode, get the smallest mode consistent with the
alignment. If OP0 is a non-BLKmode object that is no