changeset 4f70960761cd in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=4f70960761cd
description:
X86: Don't clobber the original dividend when doing signed divide.
diffstat:
1 file changed, 18 insertions(+), 26 deletions(-)
src/arch/x86/isa/insts/general_purpose/arithmetic/multiply_and_divide.py | 44
++++------
diffs (175 lines):
diff -r c72296d5ee85 -r 4f70960761cd
src/arch/x86/isa/insts/general_purpose/arithmetic/multiply_and_divide.py
--- a/src/arch/x86/isa/insts/general_purpose/arithmetic/multiply_and_divide.py
Sun Aug 09 01:00:47 2009 -0700
+++ b/src/arch/x86/isa/insts/general_purpose/arithmetic/multiply_and_divide.py
Sun Aug 09 01:01:18 2009 -0700
@@ -388,7 +388,6 @@
sub t2, t2, t4
#Find the sign of the divisor
- #FIXME!!! This depends on shifts setting the carry flag correctly.
slli t0, reg, 1, flags=(ECF,), dataSize=1
# Negate divisor
@@ -397,7 +396,6 @@
mov t3, t3, reg, flags=(nCECF,), dataSize=1
#Find the sign of the dividend
- #FIXME!!! This depends on shifts setting the carry flag correctly.
slli t0, ah, 1, flags=(ECF,), dataSize=1
# Put the dividend's absolute value into t1 and t2
@@ -440,7 +438,7 @@
mov t5, t5, t4, (CECF,), dataSize=1
# Check the sign of the divisor
- slli t0, t3, 1, flags=(ECF,), dataSize=1
+ slli t0, reg, 1, flags=(ECF,), dataSize=1
# Negate the (possibly already negated) quotient
sub t4, t0, t5, dataSize=1
@@ -458,19 +456,17 @@
sub t2, t0, ah, dataSize=1
sub t2, t2, t4
- ld t3, seg, sib, disp
+ ld t8, seg, sib, disp
#Find the sign of the divisor
- #FIXME!!! This depends on shifts setting the carry flag correctly.
slli t0, t3, 1, flags=(ECF,), dataSize=1
# Negate divisor
- sub t4, t0, t3, dataSize=1
+ sub t3, t0, t8, dataSize=1
# Put the divisor's absolute value into t3
- mov t3, t3, t4, flags=(CECF,), dataSize=1
+ mov t3, t3, t8, flags=(nCECF,), dataSize=1
#Find the sign of the dividend
- #FIXME!!! This depends on shifts setting the carry flag correctly.
slli t0, ah, 1, flags=(ECF,), dataSize=1
# Put the dividend's absolute value into t1 and t2
@@ -513,7 +509,7 @@
mov t5, t5, t4, (CECF,), dataSize=1
# Check the sign of the divisor
- slli t0, t3, 1, flags=(ECF,), dataSize=1
+ slli t0, t8, 1, flags=(ECF,), dataSize=1
# Negate the (possibly already negated) quotient
sub t4, t0, t5, dataSize=1
@@ -532,19 +528,17 @@
sub t2, t2, t4
rdip t7
- ld t3, seg, riprel, disp
+ ld t8, seg, riprel, disp
#Find the sign of the divisor
- #FIXME!!! This depends on shifts setting the carry flag correctly.
slli t0, t3, 1, flags=(ECF,), dataSize=1
# Negate divisor
- sub t4, t0, t3, dataSize=1
+ sub t3, t0, t8, dataSize=1
# Put the divisor's absolute value into t3
- mov t3, t3, t4, flags=(CECF,), dataSize=1
+ mov t3, t3, t8, flags=(nCECF,), dataSize=1
#Find the sign of the dividend
- #FIXME!!! This depends on shifts setting the carry flag correctly.
slli t0, ah, 1, flags=(ECF,), dataSize=1
# Put the dividend's absolute value into t1 and t2
@@ -587,7 +581,7 @@
mov t5, t5, t4, (CECF,), dataSize=1
# Check the sign of the divisor
- slli t0, t3, 1, flags=(ECF,), dataSize=1
+ slli t0, t8, 1, flags=(ECF,), dataSize=1
# Negate the (possibly already negated) quotient
sub t4, t0, t5, dataSize=1
@@ -610,7 +604,6 @@
sub t2, t2, t4
#Find the sign of the divisor
- #FIXME!!! This depends on shifts setting the carry flag correctly.
slli t0, reg, 1, flags=(ECF,)
# Negate divisor
@@ -619,7 +612,6 @@
mov t3, t3, reg, flags=(nCECF,)
#Find the sign of the dividend
- #FIXME!!! This depends on shifts setting the carry flag correctly.
slli t0, rdx, 1, flags=(ECF,)
# Put the dividend's absolute value into t1 and t2
@@ -664,7 +656,7 @@
mov t5, t5, t4, (CECF,)
# Check the sign of the divisor
- slli t0, t3, 1, flags=(ECF,)
+ slli t0, reg, 1, flags=(ECF,)
# Negate the (possibly already negated) quotient
sub t4, t0, t5
@@ -682,16 +674,16 @@
sub t2, t0, rdx
sub t2, t2, t4
- ld t3, seg, sib, disp
+ ld t8, seg, sib, disp
#Find the sign of the divisor
#FIXME!!! This depends on shifts setting the carry flag correctly.
slli t0, t3, 1, flags=(ECF,)
# Negate divisor
- sub t4, t0, t3
+ sub t3, t0, t8
# Put the divisor's absolute value into t3
- mov t3, t3, t4, flags=(CECF,)
+ mov t3, t3, t8, flags=(nCECF,)
#Find the sign of the dividend
#FIXME!!! This depends on shifts setting the carry flag correctly.
@@ -739,7 +731,7 @@
mov t5, t5, t4, (CECF,)
# Check the sign of the divisor
- slli t0, t3, 1, flags=(ECF,)
+ slli t0, t8, 1, flags=(ECF,)
# Negate the (possibly already negated) quotient
sub t4, t0, t5
@@ -758,16 +750,16 @@
sub t2, t2, t4
rdip t7
- ld t3, seg, riprel, disp
+ ld t8, seg, riprel, disp
#Find the sign of the divisor
#FIXME!!! This depends on shifts setting the carry flag correctly.
slli t0, t3, 1, flags=(ECF,)
# Negate divisor
- sub t4, t0, t3
+ sub t3, t0, t8
# Put the divisor's absolute value into t3
- mov t3, t3, t4, flags=(CECF,)
+ mov t3, t3, t4, flags=(nCECF,)
#Find the sign of the dividend
#FIXME!!! This depends on shifts setting the carry flag correctly.
@@ -815,7 +807,7 @@
mov t5, t5, t4, (CECF,)
# Check the sign of the divisor
- slli t0, t3, 1, flags=(ECF,)
+ slli t0, t8, 1, flags=(ECF,)
# Negate the (possibly already negated) quotient
sub t4, t0, t5
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev