Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Michael Snyder <msnyder@redhat.com>
To: Kazu Hirata <kazu@cs.umass.edu>
Cc: gdb-patches@sources.redhat.com, dvenkat@noida.hcltech.com,
	avolkov@transas.com
Subject: Re: [PATCH/RFA] h8300 sim: add daa and das insns
Date: Sun, 13 Apr 2003 16:57:00 -0000	[thread overview]
Message-ID: <3E9996FB.58B22C50@redhat.com> (raw)
In-Reply-To: <20030412.172441.63131380.kazu@cs.umass.edu>

Kazu Hirata wrote:
> 
> 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)

Ugh.  I hate it, but OK.  My way scans so much better...

> 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. :-)

Right you are.  I think your suggestion is both necessary and sufficient.
Sure it's odd, but this is binary coded decimal we're talking about...

I'll check it in with your suggestions.  Thanks.


      reply	other threads:[~2003-04-13 16:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-08  6:24 Michael Snyder
2003-04-12 21:25 ` Kazu Hirata
2003-04-13 16:57   ` Michael Snyder [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3E9996FB.58B22C50@redhat.com \
    --to=msnyder@redhat.com \
    --cc=avolkov@transas.com \
    --cc=dvenkat@noida.hcltech.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=kazu@cs.umass.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox