From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23260 invoked by alias); 12 Apr 2003 21:25:16 -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 23253 invoked from network); 12 Apr 2003 21:25:16 -0000 Received: from unknown (HELO mail.cs.umass.edu) (128.119.243.168) by sources.redhat.com with SMTP; 12 Apr 2003 21:25:16 -0000 Received: from localhost (IDENT:aQm4N6qmwUSMTYJTIIbnI9dbMwVRieaZ@loki.cs.umass.edu [128.119.243.168]) by mail.cs.umass.edu (8.12.6/8.12.5) with ESMTP id h3CLOejf002851; Sat, 12 Apr 2003 17:24:40 -0400 Date: Sat, 12 Apr 2003 21:25:00 -0000 Message-Id: <20030412.172441.63131380.kazu@cs.umass.edu> To: msnyder@redhat.com Cc: gdb-patches@sources.redhat.com, dvenkat@noida.hcltech.com, avolkov@transas.com Subject: Re: [PATCH/RFA] h8300 sim: add daa and das insns From: Kazu Hirata In-Reply-To: <3E926B1A.879C98CC@redhat.com> References: <3E926B1A.879C98CC@redhat.com> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Checked: This message probably not SPAM X-Spam-Score: -9.9, Required: 5 X-Spam-Tests: IN_REP_TO,REFERENCES X-Spam-Report: ---- Start SpamAssassin results -9.90 points, 5 required; * -6.6 -- Has a valid-looking References header * -3.3 -- Has a In-Reply-To header ---- End of SpamAssassin results X-Scanned-By: MIMEDefang 2.30 (www . roaringpenguin . com / mimedefang) X-SW-Source: 2003-04/txt/msg00257.txt.bz2 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