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