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: -fprefetch-loop-arrays on PowerPC


> On Fri, 31 May 2002, Jan Hubicka wrote:
> 
> > Did it work?
> 
> Yes.
> 

Hi,
would be OK to install this patch for both mainline and branch?
Mark: the problem is not regression, but it is important problem in
-fprefetch-loop-arrays - on architectures that do not allow offsetting
of addresses it prefetch random blocks of memory.  The patch is safe in
a way that it touches code not executed unless this switch is used.

Honza

Tue May 28 11:49:18 CEST 2002  Jan Hubicka  <jh@ssue.cz>
	* loop.c (emit_prefetch_instructions): Properly place the address computation.
*** loop.c.old	Tue May 28 11:43:34 2002
--- loop.c	Tue May 28 11:45:07 2002
*************** emit_prefetch_instructions (loop)
*** 4139,4144 ****
--- 4139,4145 ----
  	  int bytes_ahead = PREFETCH_BLOCK * (ahead + y);
  	  rtx before_insn = info[i].giv->insn;
  	  rtx prev_insn = PREV_INSN (info[i].giv->insn);
+ 	  rtx seq;
  
  	  /* We can save some effort by offsetting the address on
  	     architectures with offsettable memory references.  */
*************** emit_prefetch_instructions (loop)
*** 4153,4165 ****
  	      loc = reg;
  	    }
  
  	  /* Make sure the address operand is valid for prefetch.  */
  	  if (! (*insn_data[(int)CODE_FOR_prefetch].operand[0].predicate)
  		  (loc, insn_data[(int)CODE_FOR_prefetch].operand[0].mode))
  	    loc = force_reg (Pmode, loc);
! 	  emit_insn_before (gen_prefetch (loc, GEN_INT (info[i].write),
! 					  GEN_INT (3)),
! 			    before_insn);
  
  	  /* Check all insns emitted and record the new GIV
  	     information.  */
--- 4154,4169 ----
  	      loc = reg;
  	    }
  
+ 	  start_sequence ();
  	  /* Make sure the address operand is valid for prefetch.  */
  	  if (! (*insn_data[(int)CODE_FOR_prefetch].operand[0].predicate)
  		  (loc, insn_data[(int)CODE_FOR_prefetch].operand[0].mode))
  	    loc = force_reg (Pmode, loc);
! 	  emit_insn (gen_prefetch (loc, GEN_INT (info[i].write),
! 				   GEN_INT (3)));
! 	  seq = gen_sequence ();
! 	  end_sequence ();
! 	  emit_insn_before (seq, before_insn);
  
  	  /* Check all insns emitted and record the new GIV
  	     information.  */


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