This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [PATCH/RFA] h8300 sim: add daa and das insns
- From: Kazu Hirata <kazu at cs dot umass dot edu>
- To: msnyder at redhat dot com
- Cc: gdb-patches at sources dot redhat dot com, dvenkat at noida dot hcltech dot com, avolkov at transas dot com
- Date: Sat, 12 Apr 2003 17:24:41 -0400 (EDT)
- Subject: Re: [PATCH/RFA] h8300 sim: add daa and das insns
- References: <3E926B1A.879C98CC@redhat.com>
Hi Michael,
> Here's my implementation of daa/das:
+ if (!c && (0 <= (res >> 4) && (res >> 4) <= 9) &&
+ !h && (0 <= (res & 0xf) && (res & 0xf) <= 9))
The GNU coding standard says
if (A
&& B)
so we would have to fix formatting.
+ else if ( c && (1 <= (res >> 4) && (res >> 4) <= 2) &&
+ !h && (0 <= (res & 0xf) && (res & 0xf) <= 9))
+ res = res + 0x60; /* Value added == 60. */
+ else if ( c && (1 <= (res >> 4) && (res >> 4) <= 2) &&
+ !h && (10 <= (res & 0xf) && (res & 0xf) <= 15))
+ res = res + 0x66; /* Value added == 66. */
+ else if (c && (1 <= (res >> 4) && (res >> 4) <= 3) &&
+ h && (0 <= (res & 0xf) && (res & 0xf) <= 3))
+ res = res + 0x66; /* Value added == 66. */
IMHO, for the last three cases of DAA, the carry flag won't be set to
1 because adding 0x66 does not generate a carry. We can put a hack
like "res |= 0x100;" after "res += 0x66;" or replace "res += 0x66;"
with "res += 0x166;" so that "alu8:" can take care of this, but I
don't know how much you like these. :-)
Thanks,
Kazu Hirata