This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

patch: move2add_note_store: handle subregs


Hi folks.

[Joern, Richard suggested I avoid the block altogether, but to check with
you, so...]

Consider move2add_note_store().  
Now imagine dst = (subreg:SI (reg:DF 10 10) 0).

The first thing move2add_note_store() does is strip out the SUBREG, giving
us (reg:DF 10).

The problem is that we have a call to trunc_int_for_mode() later, which
will try to use a mode of DF.  Abort.

The patch below, which I'm testing on ppc-linux, avoids the problem.
What do you y'all think?

	* postreload.c (move2add_note_store): Do not call
	trunc_int_for_mode on subregs.

Index: postreload.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/postreload.c,v
retrieving revision 2.25
diff -c -p -r2.25 postreload.c
*** postreload.c	5 Jan 2005 23:19:20 -0000	2.25
--- postreload.c	14 Jan 2005 01:39:05 -0000
*************** move2add_note_store (rtx dst, rtx set, v
*** 1432,1437 ****
--- 1432,1438 ----
    unsigned int regno = 0;
    unsigned int i;
    enum machine_mode mode = GET_MODE (dst);
+   bool subreg_p = false;
  
    if (GET_CODE (dst) == SUBREG)
      {
*************** move2add_note_store (rtx dst, rtx set, v
*** 1440,1445 ****
--- 1441,1447 ----
  				   SUBREG_BYTE (dst),
  				   GET_MODE (dst));
        dst = SUBREG_REG (dst);
+       subreg_p = true;
      }
  
    /* Some targets do argument pushes without adding REG_INC notes.  */
*************** move2add_note_store (rtx dst, rtx set, v
*** 1460,1466 ****
    if (SCALAR_INT_MODE_P (mode)
        && hard_regno_nregs[regno][mode] == 1 && GET_CODE (set) == SET
        && GET_CODE (SET_DEST (set)) != ZERO_EXTRACT
!       && GET_CODE (SET_DEST (set)) != STRICT_LOW_PART)
      {
        rtx src = SET_SRC (set);
        rtx base_reg;
--- 1462,1469 ----
    if (SCALAR_INT_MODE_P (mode)
        && hard_regno_nregs[regno][mode] == 1 && GET_CODE (set) == SET
        && GET_CODE (SET_DEST (set)) != ZERO_EXTRACT
!       && GET_CODE (SET_DEST (set)) != STRICT_LOW_PART
!       && !subreg_p)
      {
        rtx src = SET_SRC (set);
        rtx base_reg;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]