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]

patch: subreg of mem when converting vector types


and on a tangentially [vector] related subject...

convert_move() is blindly creating a subreg when converting between
vector types.  this sometimes causes a subreg of a mem to be created
when converting between vector types.

(subreg (mem) 0) gets optimized away in simplify_subreg(), but it's only
being called from combine (optimization > 0).  so for no optimization,
we get subregs of mems.

the following patch makes sure we are subreging a register.

ok to install?

-- 
Aldy Hernandez			E-mail: aldyh@redhat.com
Professional Gypsy
Red Hat, Inc.

2001-10-30  Aldy Hernandez  <aldyh@redhat.com>

	* expr.c (convert_move): Avoid making a subreg of a subreg or mem
	when converting vector types.

Index: expr.c
===================================================================
RCS file: /cvs/uberbaum/gcc/expr.c,v
retrieving revision 1.362
diff -c -p -r1.362 expr.c
*** expr.c	2001/10/19 19:54:06	1.362
--- expr.c	2001/10/30 17:24:06
*************** convert_move (to, from, unsignedp)
*** 544,552 ****
  	abort ();
  
        if (VECTOR_MODE_P (to_mode))
! 	from = gen_rtx_SUBREG (to_mode, from, 0);
        else
! 	to = gen_rtx_SUBREG (from_mode, to, 0);
  
        emit_move_insn (to, from);
        return;
--- 544,562 ----
  	abort ();
  
        if (VECTOR_MODE_P (to_mode))
! 	{
! 	  /* Avoid making a subreg of a subreg, or of a mem.  */
! 	  if (GET_CODE (from) != REG)
! 	    from = copy_to_reg (from);
! 	  from = gen_rtx_SUBREG (to_mode, from, 0);
! 	}
        else
! 	{
! 	  /* Avoid making a subreg of a subreg, or of a mem.  */
! 	  if (GET_CODE (to) != REG)
! 	    to = copy_to_reg (to);
! 	  to = gen_rtx_SUBREG (from_mode, to, 0);
! 	}
  
        emit_move_insn (to, from);
        return;


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