ifcvt.c and STORE_FLAG_VALUE

Michael Meissner meissner@cygnus.com
Thu May 4 09:39:00 GMT 2000


On Thu, May 04, 2000 at 06:17:48PM +0200, Philippe De Muyter wrote:
> Bootstrapping on m68k-motorola-sysv yields also the following failure:
> 
> cc -c  -DIN_GCC    -g   -DHAVE_CONFIG_H    -I. -I/gcc -I/gcc/config -I/gcc/../include /gcc/ifcvt.c
> "/gcc/ifcvt.c", line 519: illegal lhs of assignment operator
> "/gcc/ifcvt.c", line 557: illegal lhs of assignment operator
> "/gcc/ifcvt.c", line 640: illegal lhs of assignment operator
> 
> That happens with -STORE_FLAG_VALUE when STORE_FLAG_VALUE is defined as -1
> I thought to define it as (-1), but as it it tested in preprocessor
> expressions for equality with -1, I did not dare to do that.  My proposed fix
> is below.  OK to commit ?

Yes it is ok to commit, providing you put in a comment of why this is being
done, or possibly change the line to:

	if (diff == STORE_FLAG_VALUE || diff == -(STORE_FLAG_VALUE))

> Philippe De Muyter  <phdm@macqel.be>
> 
> 	* ifcvt.c (noce_try_store_flag_constants): Do not negate
> 	STORE_FLAG_VALUE.
> 
> Index: gcc/ifcvt.c
> ===================================================================
> RCS file: /cvs/gcc/egcs/gcc/ifcvt.c,v
> retrieving revision 1.8
> diff -u -p -b -r1.8 ifcvt.c
> --- ifcvt.c	2000/05/03 11:16:35	1.8
> +++ ifcvt.c	2000/05/04 15:09:29
> @@ -516,7 +516,7 @@ noce_try_store_flag_constants (if_info)
>        can_reverse = can_reverse_comparison_p (if_info->cond, if_info->jump);
>  
>        reversep = 0;
> -      if (diff == STORE_FLAG_VALUE || diff == -STORE_FLAG_VALUE)
> +      if (diff == STORE_FLAG_VALUE || -diff == STORE_FLAG_VALUE)
>  	normalize = 0;
>        else if (ifalse == 0 && exact_log2 (itrue) >= 0
>  	       && (STORE_FLAG_VALUE == 1
> @@ -554,7 +554,7 @@ noce_try_store_flag_constants (if_info)
>  
>        /* if (test) x = 3; else x = 4;
>  	 =>   x = 3 + (test == 0);  */
> -      if (diff == STORE_FLAG_VALUE || diff == -STORE_FLAG_VALUE)
> +      if (diff == STORE_FLAG_VALUE || -diff == STORE_FLAG_VALUE)
>  	{
>  	  target = expand_binop (GET_MODE (if_info->x),
>  				 (diff == STORE_FLAG_VALUE
> @@ -637,7 +637,7 @@ noce_try_store_flag_inc (if_info)
>      {
>        if (STORE_FLAG_VALUE == INTVAL (XEXP (if_info->a, 1)))
>  	subtract = 0, normalize = 0;
> -      else if (-STORE_FLAG_VALUE == INTVAL (XEXP (if_info->a, 1)))
> +      else if (STORE_FLAG_VALUE == -INTVAL (XEXP (if_info->a, 1)))
>  	subtract = 1, normalize = 0;
>        else
>  	subtract = 0, normalize = INTVAL (XEXP (if_info->a, 1));

-- 
Michael Meissner, Cygnus Solutions, a Red Hat company.
PMB 198, 174 Littleton Road #3, Westford, Massachusetts 01886, USA
Work:	  meissner@redhat.com		phone: +1 978-486-9304
Non-work: meissner@spectacle-pond.org	fax:   +1 978-692-4482


More information about the Gcc-patches mailing list