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]

ifcvt.c and STORE_FLAG_VALUE


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 ?

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));

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