From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16118 invoked by alias); 8 May 2002 02:42:38 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 16054 invoked from network); 8 May 2002 02:42:33 -0000 Received: from unknown (HELO nile.gnat.com) (205.232.38.5) by sources.redhat.com with SMTP; 8 May 2002 02:42:33 -0000 Received: by nile.gnat.com (Postfix, from userid 338) id 72B75F28D0; Tue, 7 May 2002 22:42:31 -0400 (EDT) To: Arthur_I_Schwarz@raytheon.com, gcc@gcc.gnu.org, tej@melbpc.org.au Subject: Re: Algol Front end Message-Id: <20020508024231.72B75F28D0@nile.gnat.com> Date: Tue, 07 May 2002 19:53:00 -0000 From: dewar@gnat.com (Robert Dewar) X-SW-Source: 2002-05/txt/msg00546.txt.bz2 Table lookup is not the way to go for packed decimal addition. Basically you want to do a standard addition, and then deal with the carries. There are two cases of carries 1. Where there is a carry out of the four bits. Two subcases here 100? + 100? => overflow, easily detected by an AND 1001 + 0111 (or vice versa), detectable by some sequence of logical fiddling 2. Where the carry is within the four bits, i.e. the result is 11?? or 101? (again detectable by some logical fiddling) That's as far as I have time to get right now, but starting from this, you can figure out a series of logical operations to effect the carry adjust.