From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20670 invoked by alias); 13 Apr 2003 16:57:33 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 20663 invoked from network); 13 Apr 2003 16:57:33 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 13 Apr 2003 16:57:33 -0000 Received: from int-mx2.corp.redhat.com (nat-pool-rdu-dmz.redhat.com [172.16.52.200] (may be forged)) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id h3DGvWD23436 for ; Sun, 13 Apr 2003 12:57:33 -0400 Received: from potter.sfbay.redhat.com (potter.sfbay.redhat.com [172.16.27.15]) by int-mx2.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h3DGvVW31838; Sun, 13 Apr 2003 12:57:31 -0400 Received: from redhat.com (reddwarf.sfbay.redhat.com [172.16.24.50]) by potter.sfbay.redhat.com (8.11.6/8.11.6) with ESMTP id h3DGvVS17184; Sun, 13 Apr 2003 09:57:31 -0700 Message-ID: <3E9996FB.58B22C50@redhat.com> Date: Sun, 13 Apr 2003 16:57:00 -0000 From: Michael Snyder Organization: Red Hat, Inc. X-Accept-Language: en MIME-Version: 1.0 To: Kazu Hirata CC: gdb-patches@sources.redhat.com, dvenkat@noida.hcltech.com, avolkov@transas.com Subject: Re: [PATCH/RFA] h8300 sim: add daa and das insns References: <3E926B1A.879C98CC@redhat.com> <20030412.172441.63131380.kazu@cs.umass.edu> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-SW-Source: 2003-04/txt/msg00271.txt.bz2 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.