xref: /openbsd-src/sys/arch/hppa/spmath/mpyaccu.c (revision 7eec34da5ce3d990cd99bf62b82bcd810afc1ed3)
1*7eec34daSmickey /*	$OpenBSD: mpyaccu.c,v 1.7 2003/04/10 17:27:58 mickey Exp $	*/
28a472b3eSmickey /*
3c2feb252Smickey   (c) Copyright 1986 HEWLETT-PACKARD COMPANY
4c2feb252Smickey   To anyone who acknowledges that this file is provided "AS IS"
5c2feb252Smickey   without any express or implied warranty:
6c2feb252Smickey       permission to use, copy, modify, and distribute this file
7c2feb252Smickey   for any purpose is hereby granted without fee, provided that
8c2feb252Smickey   the above copyright notice and this notice appears in all
9c2feb252Smickey   copies, and that the name of Hewlett-Packard Company not be
10c2feb252Smickey   used in advertising or publicity pertaining to distribution
11c2feb252Smickey   of the software without specific, written prior permission.
12c2feb252Smickey   Hewlett-Packard Company makes no representations about the
13c2feb252Smickey   suitability of this software for any purpose.
148a472b3eSmickey */
15c2feb252Smickey /* @(#)mpyaccu.c: Revision: 1.6.88.1 Date: 93/12/07 15:06:41 */
168a472b3eSmickey 
174f9f21c7Smickey #include "md.h"
188a472b3eSmickey 
19b94afd46Smickey void
mpyaccu(opnd1,opnd2,result)20b94afd46Smickey mpyaccu(opnd1,opnd2,result)
218a472b3eSmickey 	unsigned int opnd1, opnd2;
228a472b3eSmickey 	struct mdsfu_register *result;
238a472b3eSmickey {
248a472b3eSmickey 	struct mdsfu_register temp;
258a472b3eSmickey 	int carry;
268a472b3eSmickey 
27*7eec34daSmickey 	u_xmpy(&opnd1,&opnd2,&temp);
288a472b3eSmickey 
298a472b3eSmickey 	/* get result of low word add, and check for carry out */
308a472b3eSmickey 	if ((result_lo += (unsigned)temp.rslt_lo) < (unsigned)temp.rslt_lo)
318a472b3eSmickey 		carry = 1;
32c2feb252Smickey 	else
33c2feb252Smickey 		carry = 0;
348a472b3eSmickey 
358a472b3eSmickey 	/* get result of high word add, and determine overflow status */
368a472b3eSmickey 	if ((result_hi += (unsigned)temp.rslt_hi + carry) <
37c2feb252Smickey 	    (unsigned)temp.rslt_hi)
38c2feb252Smickey 		overflow = TRUE;
398a472b3eSmickey }
40