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]

Re: PR 14776


> Hi,
> 
> On Wed, 31 Mar 2004, Jan Hubicka wrote:
> 
> > + 	/* Preserve EQUIV/EQUAL notes in trivial cases.  */
> > + 	case REG_EQUIV:
> > + 	case REG_EQUAL:
> > + 	  {
> > + 	    rtx set = single_set (insn_last);
> > + 	    rtx set2 = single_set (trial);
> > + 	    if (set && set2 && rtx_equal_p (SET_DEST (set), SET_DEST (set2)))
> > + 	      REG_NOTES (insn_last)
> > + 		= gen_rtx_EXPR_LIST (REG_NOTE_KIND (note),
> > + 				     XEXP (note, 0),
> > + 				     REG_NOTES (insn_last));
> > + 	  }
> >   	default:
> >   	  break;
> 
> Although it works in this case, this depends on fallthrough.  Please add 
> an explicit 'break;' in case anyone later adds more cases.

Oops, that obviously an omision.  

Hi,
PR 14776 is result of sequence if interesting events.  The a=-b expands to SSE
using pattern that use vector negative zero as operand.  (that is used for ^
operation).  This negative zero is load using 128bit move instruction that has
REG_EQUAL note attached.  This instruction is later split into 64bit zero
extending load and the REG_EQUAL note is lost.  It is re-discovered by
local-alloc.c and promoted to REG_EQUIV but since the representation of 64bit
zero extending load consists of vec_merge with vec_duplicate nested in it and
because simplify_rtx don't do recursive simplification, it won't simplify into
constant.  Later reg-alloc runs out of registers and decide to offload this on
the stack and because of infamous problem of cygwin runtime and missaligned
stack we end up with missaligned 128bit read.

This patch maked insn splitter to preserve the notes in trivial cases (where
the last instruction of split sequence is single set destinating the same thing
as original instruction).  This makes reload to rematerialize the constant and
everything is working well.  I also have experimental patch to teach
simplify-rtx to recurse on operands, but I would like to give it more testing.
It would be also nice to fix the cygwin BTW :)

Bootstrapped/regtested i686-pc-gnu-linux on both mainline and 3.4.  OK for both branches?

Honza

2004-03-31  Jan Hubicka  <jh@suse.cz>
	* emit-rtl.c (try_split): Preserve REG_EQUIV/EQUAL notes in trivial cases.
Index: emit-rtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/emit-rtl.c,v
retrieving revision 1.386
diff -c -3 -p -r1.386 emit-rtl.c
*** emit-rtl.c	22 Mar 2004 00:40:43 -0000	1.386
--- emit-rtl.c	30 Mar 2004 15:11:24 -0000
*************** try_split (rtx pat, rtx trial, int last)
*** 3306,3311 ****
--- 3306,3324 ----
  	    }
  	  break;
  
+ 	/* Preserve EQUIV/EQUAL notes in trivial cases.  */
+ 	case REG_EQUIV:
+ 	case REG_EQUAL:
+ 	  {
+ 	    rtx set = single_set (insn_last);
+ 	    rtx set2 = single_set (trial);
+ 	    if (set && set2 && rtx_equal_p (SET_DEST (set), SET_DEST (set2)))
+ 	      REG_NOTES (insn_last)
+ 		= gen_rtx_EXPR_LIST (REG_NOTE_KIND (note),
+ 				     XEXP (note, 0),
+ 				     REG_NOTES (insn_last));
+ 	  }
+ 	  break;
  	default:
  	  break;
  	}


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