xref: /titanic_50/usr/src/lib/libc/sparc/gen/ladd.s (revision b9bd317cda1afb3a01f4812de73e8cec888cbbd7)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22/*
23 * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24 * Use is subject to license terms.
25 */
26
27/*	Copyright (c) 1988 AT&T	*/
28/*	  All Rights Reserved	*/
29
30#pragma ident	"%Z%%M%	%I%	%E% SMI"
31
32	.file	"%M%"
33
34/*
35 * Double long add routine.  Ported from pdp 11/70 version
36 * with considerable effort.  All supplied comments were ported.
37 *
38 * Ported from m32 version to sparc. No comments about difficulty.
39 *
40 *	dl_t
41 *	ladd (lop, rop)
42 *		dl_t	lop;
43 *		dl_t	rop;
44 */
45
46#include "SYS.h"
47
48	ENTRY(ladd)
49
50	ld	[%o7+8],%o4		! Instruction at ret-addr should be a
51	cmp     %o4,8			! 'unimp 8' indicating a valid call.
52	be	1f			! if OK, go forward.
53	nop				! delay instruction.
54	jmp	%o7+8			! return
55	nop				! delay instruction.
56
571:
58	ld	[%o0+0],%o2		! fetch lop.dl_hop
59	ld	[%o0+4],%o3		! fetch lop.dl_lop
60	ld	[%o1+0],%o4		! fetch rop.dl_hop
61	ld	[%o1+4],%o5		! fetch rop.dl_lop
62	addcc	%o3,%o5,%o3		! lop.dl_lop + rop.dl_lop (set carry)
63	addxcc	%o2,%o4,%o2		! lop.dl_hop + rop.dl_hop + <carry>
64	ld	[%sp+(16*4)],%o0	! address to store result into
65	st	%o2,[%o0+0]		! store result, dl_hop
66	jmp	%o7+12			! return
67	st	%o3,[%o0+4]		! store result, dl_lop
68
69	SET_SIZE(ladd)
70