From 977b0b66fc2a6bbb1b3975032098ac33ab30e73a Mon Sep 17 00:00:00 2001 From: zoltan Date: Wed, 11 Mar 2009 14:27:10 +0000 Subject: [PATCH] 2009-03-11 Zoltan Varga * mini-amd64.c (mono_arch_output_basic_block): Fix % 1. Fixes #484323. * basic.cs: Add a test. git-svn-id: svn+ssh://mono-cvs.ximian.com/source/trunk/mono@129063 e3ebcda4-bce8-0310-ba0a-eca2169e7518 --- mono/mini/ChangeLog | 6 ++++++ mono/mini/basic.cs | 5 +++++ mono/mini/mini-amd64.c | 5 +++++ 3 files changed, 16 insertions(+) diff --git a/mono/mini/ChangeLog b/mono/mini/ChangeLog index a800f0518..3c9ca88a4 100644 --- a/mono/mini/ChangeLog +++ b/mono/mini/ChangeLog @@ -1,3 +1,9 @@ +2009-03-11 Zoltan Varga + + * mini-amd64.c (mono_arch_output_basic_block): Fix % 1. Fixes #484323. + + * basic.cs: Add a test. + 2009-03-11 Mark Probst * mini-x86.c (mono_arch_output_basic_block): Use different diff --git a/mono/mini/basic.cs b/mono/mini/basic.cs index ecbef60b6..74d1ede1f 100644 --- a/mono/mini/basic.cs +++ b/mono/mini/basic.cs @@ -190,6 +190,11 @@ class Tests { return b % 8; } + public static int test_0_rem_imm_0 () { + int b = 12; + return b % 1; + } + public static int test_4_rem_big_imm () { int b = 10004; return b % 10000; diff --git a/mono/mini/mini-amd64.c b/mono/mini/mini-amd64.c index c3a918fa7..bda1d5778 100644 --- a/mono/mini/mini-amd64.c +++ b/mono/mini/mini-amd64.c @@ -3059,6 +3059,11 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb) g_assert (ins->dreg == X86_EAX); g_assert (power >= 0); + if (power == 0) { + amd64_mov_reg_imm (code, ins->dreg, 0); + break; + } + /* Based on gcc code */ /* Add compensation for negative dividents */ -- 2.11.4.GIT