adjust generation of component addresses

Richard Henderson rth@redhat.com
Fri Mar 1 00:15:00 GMT 2002


On Thu, Feb 28, 2002 at 10:41:01PM -0500, Hans-Peter Nilsson wrote:
> No regressions for a bootstrap+check on i686-pc-linux-gnu.  No
> regressions for a build and check on mmix-knuth-mmixware,
> cris-axis-elf, h8300-hitachi-hms, i960-unknown-coff,
> m32r-unknown-elf, mn10300-unknown-elf, arm-unknown-elf,
> powerpc-unknown-eabisim, mips-mips-elf, sh-unknown-elf.

Good to know.

I needed a bit more to fix your test case on alpha.
I applied the following to mainline and branch.


r~


        * expmed.c (store_bit_field): Prevent generation of CONCATs;
        pun complex values as integers; use gen_lowpart instead of
        gen_rtx_SUBREG.
        (extract_bit_field): Likewise.

Index: expmed.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/expmed.c,v
retrieving revision 1.109
diff -c -p -d -r1.109 expmed.c
*** expmed.c	2002/02/27 20:27:35	1.109
--- expmed.c	2002/03/01 07:30:11
*************** store_bit_field (str_rtx, bitsize, bitnu
*** 325,331 ****
    value = protect_from_queue (value, 0);
  
    if (flag_force_mem)
!     value = force_not_mem (value);
  
    /* If the target is a register, overwriting the entire object, or storing
       a full-word or multi-word field can be done with just a SUBREG.
--- 325,336 ----
    value = protect_from_queue (value, 0);
  
    if (flag_force_mem)
!     {
!       int old_generating_concat_p = generating_concat_p;
!       generating_concat_p = 0;
!       value = force_not_mem (value);
!       generating_concat_p = old_generating_concat_p;
!     }
  
    /* If the target is a register, overwriting the entire object, or storing
       a full-word or multi-word field can be done with just a SUBREG.
*************** store_bit_field (str_rtx, bitsize, bitnu
*** 519,530 ****
       corresponding size.  This can occur on a machine with 64 bit registers
       that uses SFmode for float.  This can also occur for unaligned float
       structure fields.  */
!   if (GET_MODE_CLASS (GET_MODE (value)) == MODE_FLOAT)
!     {
!       if (GET_CODE (value) != REG)
! 	value = copy_to_reg (value);
!       value = gen_rtx_SUBREG (word_mode, value, 0);
!     }
  
    /* Now OFFSET is nonzero only if OP0 is memory
       and is therefore always measured in bytes.  */
--- 524,532 ----
       corresponding size.  This can occur on a machine with 64 bit registers
       that uses SFmode for float.  This can also occur for unaligned float
       structure fields.  */
!   if (GET_MODE_CLASS (GET_MODE (value)) != MODE_INT
!       && GET_MODE_CLASS (GET_MODE (value)) != MODE_PARTIAL_INT)
!     value = gen_lowpart (word_mode, value);
  
    /* Now OFFSET is nonzero only if OP0 is memory
       and is therefore always measured in bytes.  */
*************** extract_bit_field (str_rtx, bitsize, bit
*** 1516,1529 ****
        /* If the target mode is floating-point, first convert to the
  	 integer mode of that size and then access it as a floating-point
  	 value via a SUBREG.  */
!       if (GET_MODE_CLASS (tmode) == MODE_FLOAT)
  	{
  	  target = convert_to_mode (mode_for_size (GET_MODE_BITSIZE (tmode),
  						   MODE_INT, 0),
  				    target, unsignedp);
! 	  if (GET_CODE (target) != REG)
! 	    target = copy_to_reg (target);
! 	  return gen_rtx_SUBREG (tmode, target, 0);
  	}
        else
  	return convert_to_mode (tmode, target, unsignedp);
--- 1518,1530 ----
        /* If the target mode is floating-point, first convert to the
  	 integer mode of that size and then access it as a floating-point
  	 value via a SUBREG.  */
!       if (GET_MODE_CLASS (tmode) != MODE_INT
! 	  && GET_MODE_CLASS (tmode) != MODE_PARTIAL_INT)
  	{
  	  target = convert_to_mode (mode_for_size (GET_MODE_BITSIZE (tmode),
  						   MODE_INT, 0),
  				    target, unsignedp);
! 	  return gen_lowpart (tmode, target);
  	}
        else
  	return convert_to_mode (tmode, target, unsignedp);



More information about the Gcc-patches mailing list