[Patch : M32C] Fix sim for carry flag handling
DJ Delorie
dj@redhat.com
Wed Jan 20 05:52:00 GMT 2010
> - set_oszc (v, dc.bytes, ll > ((1 op 1) ? b2mask[dc.bytes] : 0)); \
> + set_oszc (v, dc.bytes, (#op=="+") ? ll > ((1 op 1) ? \
> + b2mask[dc.bytes] : 0) : ll >= ((1 op 1) ? b2mask[dc.bytes] : 0) ); \
You can't compare strings like that. However, the (1 op 1) test is
already there to check for subtraction, so this patch (committed) does
what you want:
2010-01-20 DJ Delorie <dj@redhat.com>
* m32c.opc (MATH_OP): When doing subtraction, also set carry if
the result is zero.
Index: m32c.opc
===================================================================
RCS file: /cvs/src/src/sim/m32c/m32c.opc,v
retrieving revision 1.9
diff -p -U3 -r1.9 m32c.opc
--- m32c.opc 1 Jan 2010 10:03:31 -0000 1.9
+++ m32c.opc 20 Jan 2010 05:50:18 -0000
@@ -125,7 +125,7 @@ prefix (src_allowed, dest_allowed, index
mb = sign_ext (s, dc.bytes * 8); \
v = ma op mb op c; \
tprintf("%d " #op " %d " #op " %d = %d\n", ma, mb, c, v); \
- set_oszc (v, dc.bytes, ll > ((1 op 1) ? b2mask[dc.bytes] : 0)); \
+ set_oszc (v, dc.bytes, (1 op 1) ? (ll > b2mask[dc.bytes]) : (ll >= 0)); \
put_dest (dc, v); \
}
More information about the Binutils
mailing list