Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!hplabs!hpfcso!hpfcda!jvm
From: jvm@hpfcda.HP.COM (Jack McClurg)
Newsgroups: comp.arch
Subject: Re: Fast conversions, another urban myth?
Message-ID: <5210001@hpfcda.HP.COM>
Date: 25 Sep 89 22:21:38 GMT
References: <832@dms.UUCP>
Organization: Hewlett-Packard, Fort Collins, CO
Lines: 26

From Mash's reference earlier I looked up a reference in the Hewlett-Packard
Journal.  On an IBM370 running COBOL programs, 1.6% of the instructions
exucuted are decimal math and 5.9% of the time spent.  This is from page 31
of the August 1986 Issue.

From the January 1986 issue, here is the instruction sequence to perform a
packed add:
		r1 and r2 contain packed decimal operands
		r3 contains 0x99999999
	UADDCM	1,3,31		; prebias operand into r31
	ADD   	2,31,31		; perform binary add
	DCOR  	31,31		; correct result

an unpacked add:
		r1 and r2 contain unpacked decimal operands
		r3 contains 0x96969696
		r4 contains 0x0f0f0f0f
		r5 contains 0x30303030
	ADD	3,1,31		; prebias operand into r31
	ADD	31,2,31		; binary add into r31
	DCOR	31,31		; correct result
	AND	4,31,31		; mask result
	OR	5,31,31		; restore sum to unpacked decimal

Jack McClurg
jvm%hpfcda@hplabs.hp.com