From cc76842f830f15b12c0f4a64e90fe3ca9e35a45a Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Wed, 12 May 2010 00:49:12 -0700 Subject: X86: Actual change that fixes div. How did that happen? --- src/arch/x86/isa/microops/regop.isa | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/arch/x86') 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 { -- cgit v1.2.3