[mips sim]: Fix handling of unsigned muls in vr.igen

Richard Sandiford rsandifo@redhat.com
Tue Apr 15 19:04:00 GMT 2003


Oops, it looks like I managed to introduce a bug while contributing the
VR simulator stuff.  Operands to unsigned multiplications were being
multiplied in their original sign-extended form.

Patch tested against gcc's mips-rewrite branch, fixes some
test failures.  No regressions.  Please install if OK.

Richard


	* vr.igen (do_vr_mul_op): Zero-extend the low 32 bits of
	unsigned operands.

Index: sim/mips/vr.igen
===================================================================
RCS file: /cvs/src/src/sim/mips/vr.igen,v
retrieving revision 1.2
diff -u -d -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.2 vr.igen
--- sim/mips/vr.igen	5 Jan 2003 07:56:59 -0000	1.2
+++ sim/mips/vr.igen	15 Apr 2003 18:54:29 -0000
@@ -73,7 +73,9 @@
 		      (long) CIA);
 
   TRACE_ALU_INPUT2 (x, y);
-  product = (unsigned_p ? x * y : EXTEND32 (x) * EXTEND32 (y));
+  product = (unsigned_p
+	     ? V8_4 (x, 1) * V8_4 (y, 1)
+	     : EXTEND32 (x) * EXTEND32 (y));
   result = (subtract_p ? lhs - product : lhs + product);
   if (saturate_p)
     {



More information about the Gdb-patches mailing list