Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!ames!apple!mips!mash
From: mash@mips.COM (John Mashey)
Newsgroups: comp.arch
Subject: Re: COBOL Decimal Arithmetic
Message-ID: <28134@winchester.mips.COM>
Date: 24 Sep 89 20:09:33 GMT
References: <943@rd1632.Dayton.NCR.COM>
Reply-To: mash@mips.COM (John Mashey)
Organization: MIPS Computer Systems, Inc.
Lines: 46

In article <943@rd1632.Dayton.NCR.COM> otto@rd1632.UUCP (Jerome A. Otto) writes:
>A comment on COBOL decimal support in hardware...
.....Lots of good stuff, from somebody who really knows a lot about
this topic.
....
>Unsigned ASCII characters can be added using a 32-bit binary adder 
>by the following algorithm:
>
>1. Add the constant 96969696 (base16) to one of the operands.  This 
....etc.
This is what we (and I suspect many others) do.
......
>In general, using the compiler to determine special cases at 
>compile time and generating the best code results in faster code 
>than supporting a general decimal arithmetic instructions in 
>hardware.  Not having decimal instructions is not a 7 to 1 
>performance penalty at all!  Using the decimal instructions as 
>implemented on many machines is a lose.

>Aren't these just RISC ideas?

Yep, Although it would appear that differing RISCs appear to have made
differing amounts of emphasis on such support, which would include:
	a) Decimal arithmetic assists.
	b) Unaligned operations, which are far more important in COBOL
	(and PL/1) than in C/PASCAL/FORTRAN.

OPINION: in order of support for COBOL, I think the following is
	a reasonable ordering, but more comments from people who know
	more would help:

	1. HP PA: has Decimal Correct and Intermediate Decimal Correct,
	Store unaligned  (which stores 1-4 bytes, anywhere in word)
	(maybe somebody from HO could explain a little more?)
	See COMPUTER, January 1989 article by Ruby Lee.
	2. MIPS R3000: has Load Word (left & Right), Store Word (Left &
	Right), to help all of the unaligned operations and moves.
	3. Motorola 88K - some of the bitfield operations might be helpful.
	4. SPARC

COBOL was clearly a major consideration for HP; at least somewhat for R3000.
-- 
-john mashey	DISCLAIMER: 
UUCP: 	{ames,decwrl,prls,pyramid}!mips!mash  OR  mash@mips.com
DDD:  	408-991-0253 or 408-720-1700, x253
USPS: 	MIPS Computer Systems, 930 E. Arques, Sunnyvale, CA 94086