xref: /openbsd/sys/arch/hppa/spmath/mpyaccu.c (revision d485f761)
1 /*	$OpenBSD: mpyaccu.c,v 1.5 2001/03/29 03:58:19 mickey Exp $	*/
2 
3 /*
4  * Copyright 1996 1995 by Open Software Foundation, Inc.
5  *              All Rights Reserved
6  *
7  * Permission to use, copy, modify, and distribute this software and
8  * its documentation for any purpose and without fee is hereby granted,
9  * provided that the above copyright notice appears in all copies and
10  * that both the copyright notice and this permission notice appear in
11  * supporting documentation.
12  *
13  * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
14  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
15  * FOR A PARTICULAR PURPOSE.
16  *
17  * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
18  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
19  * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
20  * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
21  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22  *
23  */
24 /*
25  * pmk1.1
26  */
27 /*
28  * (c) Copyright 1986 HEWLETT-PACKARD COMPANY
29  *
30  * To anyone who acknowledges that this file is provided "AS IS"
31  * without any express or implied warranty:
32  *     permission to use, copy, modify, and distribute this file
33  * for any purpose is hereby granted without fee, provided that
34  * the above copyright notice and this notice appears in all
35  * copies, and that the name of Hewlett-Packard Company not be
36  * used in advertising or publicity pertaining to distribution
37  * of the software without specific, written prior permission.
38  * Hewlett-Packard Company makes no representations about the
39  * suitability of this software for any purpose.
40  */
41 
42 
43 #include "md.h"
44 
45 void
46 mpyaccu(opnd1,opnd2,result)
47 
48 unsigned int opnd1, opnd2;
49 struct mdsfu_register *result;
50 {
51 	struct mdsfu_register temp;
52 	int carry;
53 
54 	impyu(&opnd1,&opnd2,&temp);
55 
56 	/* get result of low word add, and check for carry out */
57 	if ((result_lo += (unsigned)temp.rslt_lo) < (unsigned)temp.rslt_lo)
58 		carry = 1;
59 	else carry = 0;
60 
61 	/* get result of high word add, and determine overflow status */
62 	if ((result_hi += (unsigned)temp.rslt_hi + carry) <
63 		(unsigned)temp.rslt_hi) overflow = TRUE;
64 
65 	return;
66 }
67