summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/arch/x86/isa/microops/regop.isa8
1 files changed, 6 insertions, 2 deletions
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 {