From: Gabe Black Date: Wed, 12 May 2010 07:49:12 +0000 (-0700) Subject: X86: Actual change that fixes div. How did that happen? X-Git-Tag: stable_2012_02_02~1411 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cc76842f830f15b12c0f4a64e90fe3ca9e35a45a;p=gem5.git X86: Actual change that fixes div. How did that happen? --- diff --git a/src/arch/x86/isa/microops/regop.isa b/src/arch/x86/isa/microops/regop.isa index f3fc1fc59..4d31a5545 100644 --- a/src/arch/x86/isa/microops/regop.isa +++ b/src/arch/x86/isa/microops/regop.isa @@ -620,14 +620,18 @@ let {{ remaining--; } if (dividend & (ULL(1) << 63)) { + bool highBit = false; if (dividend < divisor && remaining) { + highBit = true; dividend = (dividend << 1) | bits(SrcReg1, remaining - 1); quotient <<= 1; remaining--; } - quotient++; - dividend -= divisor; + if (highBit || divisor <= dividend) { + quotient++; + dividend -= divisor; + } } remainder = dividend; } else {