aboutsummaryrefslogtreecommitdiff
path: root/sim/d10v
diff options
context:
space:
mode:
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));