[Mono-list] Integer division problems

Martin Baulig martin@gnome.org
09 Mar 2002 16:45:58 +0100


--=-=-=

Hi Dietmar,

here's a patch which fixes the problem:

====
2002-03-09  Martin Baulig  <martin@gnome.org>

	* x86.brg (DIV, DIV_UN): Clear EDX before performing the division.

====


--=-=-=
Content-Type: application/octet-stream
Content-Disposition: attachment; filename=diff

Index: ChangeLog
===================================================================
RCS file: /cvs/public/mono/mono/jit/ChangeLog,v
retrieving revision 1.121
diff -u -u -r1.121 ChangeLog
--- ChangeLog	2002/03/08 06:08:46	1.121
+++ ChangeLog	2002/03/09 11:53:47
@@ -1,3 +1,7 @@
+2002-03-09  Martin Baulig  <martin@gnome.org>
+
+	* x86.brg (DIV, DIV_UN): Clear EDX before performing the division.
+
 2002-03-07  Dietmar Maurer  <dietmar@ximian.com>
 
 	* jit.c (mono_analyze_stack): only load addresses of value types
Index: x86.brg
===================================================================
RCS file: /cvs/public/mono/mono/jit/x86.brg,v
retrieving revision 1.92
diff -u -u -r1.92 x86.brg
--- x86.brg	2002/03/08 06:08:46	1.92
+++ x86.brg	2002/03/09 11:53:49
@@ -804,6 +804,7 @@
 		x86_mov_reg_reg (s->code, X86_EAX, tree->left->reg1, 4);
 
 	x86_cdq (s->code);
+	x86_mov_reg_imm (s->code, X86_EDX, 0);
 	x86_div_reg (s->code, tree->right->reg1, TRUE);
 
 	mono_assert (tree->reg1 == X86_EAX &&
@@ -817,6 +818,7 @@
 		x86_mov_reg_reg (s->code, X86_EAX, tree->left->reg1, 4);
 
 	x86_cdq (s->code);
+	x86_mov_reg_imm (s->code, X86_EDX, 0);
 	x86_div_reg (s->code, tree->right->reg1, FALSE);
 
 	mono_assert (tree->reg1 == X86_EAX &&

--=-=-=


Ok to commit ?

-- 
Martin Baulig
martin@gnome.org

--=-=-=--