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]

Re: patch: store_bit_field-- use simplify_gen_subreg


> From: Aldy Hernandez <aldyh@redhat.com>
> Cc: gcc patches <gcc-patches@gcc.gnu.org>
> Date: 02 Nov 2001 16:56:17 -0500
> 
> well, while i'm at it-- might as well fix store_bit_field() which
> suffers from the same anomaly.
> 
> use simplify_gen_subreg() instead of wasting a pseudo...
> 
> ok to install?

OK.

> -- 
> Aldy Hernandez			E-mail: aldyh@redhat.com
> Professional Gypsy
> Red Hat, Inc.
> 
> 2001-11-02  Aldy Hernandez  <aldyh@redhat.com>
> 
> 	* expmed.c (store_bit_field): Use simplify_gen_subreg to make
> 	SUBREG so we avoid SUBREGing memory.
> 
> Index: expmed.c
> ===================================================================
> RCS file: /cvs/uberbaum/gcc/expmed.c,v
> retrieving revision 1.92
> diff -c -p -r1.92 expmed.c
> *** expmed.c	2001/10/11 03:15:33	1.92
> --- expmed.c	2001/11/02 21:48:59
> *************** store_bit_field (str_rtx, bitsize, bitnu
> *** 638,649 ****
>   		 if we must narrow it, be sure we do it correctly.  */
>   
>   	      if (GET_MODE_SIZE (GET_MODE (value)) < GET_MODE_SIZE (maxmode))
> ! 		{
> ! 		  /* Avoid making subreg of a subreg, or of a mem.  */
> ! 		  if (GET_CODE (value1) != REG)
> ! 		    value1 = copy_to_reg (value1);
> ! 		  value1 = gen_rtx_SUBREG (maxmode, value1, 0);
> ! 		}
>   	      else
>   		value1 = gen_lowpart (maxmode, value1);
>   	    }
> --- 638,644 ----
>   		 if we must narrow it, be sure we do it correctly.  */
>   
>   	      if (GET_MODE_SIZE (GET_MODE (value)) < GET_MODE_SIZE (maxmode))
> ! 		value1 = simplify_gen_subreg (maxmode, value1, GET_MODE (value1), 0);
>   	      else
>   		value1 = gen_lowpart (maxmode, value1);
>   	    }
> 


-- 
- Geoffrey Keating <geoffk@geoffk.org> <geoffk@redhat.com>


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