diff options
author | Gabe Black <gblack@eecs.umich.edu> | 2010-05-12 00:49:12 -0700 |
---|---|---|
committer | Gabe Black <gblack@eecs.umich.edu> | 2010-05-12 00:49:12 -0700 |
commit | cc76842f830f15b12c0f4a64e90fe3ca9e35a45a (patch) | |
tree | 3844f3373a60fa13dc2b54dcc17c3ddc0d045c25 /src/arch | |
parent | 776e8d5c8eba804bc61c3ff83dbd32d5b381d8e7 (diff) | |
download | gem5-cc76842f830f15b12c0f4a64e90fe3ca9e35a45a.tar.xz |
X86: Actual change that fixes div. How did that happen?
Diffstat (limited to 'src/arch')
-rw-r--r-- | src/arch/x86/isa/microops/regop.isa | 8 |
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 { |