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: 10 GCC regressions, 4 new, with your patch on 2001-05-03T12:50:02Z.


On May  3, 2001, "GCC regression checker" <regress@maat.cygnus.com> wrote:

> The new failures are:
> powerpc-eabisim gcc.sum gcc.c-torture/execute/930921-1.c
> native gcc.sum gcc.c-torture/execute/930921-1.c

Since I broke it, I guess I should fix it.  Curiously, Graham Stott
had just noticed this same bug on another tool-chain, and the solution
was exactly the one I had suggested to Joern Rennecke in
<URL:http://gcc.gnu.org/ml/gcc-patches/2001-04/msg01143.html>.  I
still haven't bootstrapped this, because I'm still investigating the
other new failure I introduced, but this is ok to install, assuming it
bootstraps successfully?

Index: gcc/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>
	* optabs.c (expand_binop): Sign-extend xop0 and xop1 from the
	widest mode in narrowing and widening operations.

Index: gcc/optabs.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/optabs.c,v
retrieving revision 1.93
diff -u -p -r1.93 optabs.c
--- gcc/optabs.c 2001/04/14 03:39:22 1.93
+++ gcc/optabs.c 2001/05/03 21:45:53
@@ -725,13 +725,20 @@ expand_binop (mode, binoptab, op0, op1, 
       /* In case the insn wants input operands in modes different from
 	 the result, convert the operands.  It would seem that we
 	 don't need to convert CONST_INTs, but we do, so that they're
-	 a properly sign-extended for their modes.  */
+	 a properly sign-extended for their modes; we choose the
+	 widest mode between mode and mode[01], so that, in a widening
+	 operation, we call convert_modes with different FROM and TO
+	 modes, which ensures the value is sign-extended.  Shift
+	 operations are an exception, because the second operand needs
+	 not be extended to the mode of the result.  */
 
       if (GET_MODE (op0) != mode0
 	  && mode0 != VOIDmode)
 	xop0 = convert_modes (mode0,
 			      GET_MODE (op0) != VOIDmode
 			      ? GET_MODE (op0)
+			      : GET_MODE_SIZE (mode) > GET_MODE_SIZE (mode0)
+			      ? mode
 			      : mode0,
 			      xop0, unsignedp);
 
@@ -740,6 +747,9 @@ expand_binop (mode, binoptab, op0, op1, 
 	xop1 = convert_modes (mode1,
 			      GET_MODE (op1) != VOIDmode
 			      ? GET_MODE (op1)
+			      : (GET_MODE_SIZE (mode) > GET_MODE_SIZE (mode1)
+				 && ! shift_op)
+			      ? mode
 			      : mode1,
 			      xop1, unsignedp);
 

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

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