aboutsummaryrefslogtreecommitdiff
path: root/sim/d10v
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>1997-12-02 00:27:27 +0000
committerAndrew Cagney <cagney@redhat.com>1997-12-02 00:27:27 +0000
commit51b057f27b7da5dcbb57b118e24ed03f0f8f5034 (patch)
treec14ee726e62cdf190624719d04770c0618fe43ef /sim/d10v
parent3c6d5393c4705b748e27aef0e358164da1f8f252 (diff)
downloadgdb-51b057f27b7da5dcbb57b118e24ed03f0f8f5034.zip
gdb-51b057f27b7da5dcbb57b118e24ed03f0f8f5034.tar.gz
gdb-51b057f27b7da5dcbb57b118e24ed03f0f8f5034.tar.bz2
For sub2w, compute carry according to negated addition rules.
Test.
Diffstat (limited to 'sim/d10v')
-rw-r--r--sim/d10v/ChangeLog5
-rw-r--r--sim/d10v/simops.c5
2 files changed, 6 insertions, 4 deletions
diff --git a/sim/d10v/ChangeLog b/sim/d10v/ChangeLog
index d80707c..a5f9e99 100644
--- a/sim/d10v/ChangeLog
+++ b/sim/d10v/ChangeLog
@@ -1,6 +1,7 @@
-Thu Nov 27 15:30:01 1997 Andrew Cagney <cagney@b1.cygnus.com>
+Tue Dec 2 11:04:37 1997 Andrew Cagney <cagney@b1.cygnus.com>
- * simops.c (OP_1000): Compute carry by comparing inputs.
+ * simops.c (OP_1000): For "sub2w", compute carry by comparing
+ inputs.
Mon Nov 17 20:57:21 1997 Andrew Cagney <cagney@b1.cygnus.com>
diff --git a/sim/d10v/simops.c b/sim/d10v/simops.c
index 222d2d4..d617cb4 100644
--- a/sim/d10v/simops.c
+++ b/sim/d10v/simops.c
@@ -2483,7 +2483,7 @@ OP_1000 ()
/* see ../common/sim-alu.h for a more extensive discussion on how to
compute the carry/overflow bits */
tmp = a - b;
- State.C = (a < b);
+ State.C = (a >= b);
State.regs[OP[0]] = (tmp >> 16) & 0xffff;
State.regs[OP[0]+1] = tmp & 0xffff;
trace_output (OP_DREG);
@@ -2585,7 +2585,8 @@ OP_1 ()
trace_input ("subi", OP_REG, OP_CONSTANT16, OP_VOID);
/* see ../common/sim-alu.h for a more extensive discussion on how to
- compute the carry/overflow bits */
+ compute the carry/overflow bits. */
+ /* since OP[1] is never <= 0, -OP[1] == ~OP[1]+1 can never overflow */
tmp = ((unsigned)(unsigned16) State.regs[OP[0]]
+ (unsigned)(unsigned16) ( - OP[1]));
State.C = (tmp >= (1 << 16));