xref: /titanic_51/usr/src/lib/libc/sparc/gen/ladd.s (revision 20ed34cc7e9de957ef6251e20c0f2d8e43847ea0)
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	.file	"ladd.s"
31
32/*
33 * Double long add routine.  Ported from pdp 11/70 version
34 * with considerable effort.  All supplied comments were ported.
35 *
36 * Ported from m32 version to sparc. No comments about difficulty.
37 *
38 *	dl_t
39 *	ladd (lop, rop)
40 *		dl_t	lop;
41 *		dl_t	rop;
42 */
43
44#include "SYS.h"
45
46	ENTRY(ladd)
47
48	ld	[%o7+8],%o4		! Instruction at ret-addr should be a
49	cmp     %o4,8			! 'unimp 8' indicating a valid call.
50	be	1f			! if OK, go forward.
51	nop				! delay instruction.
52	jmp	%o7+8			! return
53	nop				! delay instruction.
54
551:
56	ld	[%o0+0],%o2		! fetch lop.dl_hop
57	ld	[%o0+4],%o3		! fetch lop.dl_lop
58	ld	[%o1+0],%o4		! fetch rop.dl_hop
59	ld	[%o1+4],%o5		! fetch rop.dl_lop
60	addcc	%o3,%o5,%o3		! lop.dl_lop + rop.dl_lop (set carry)
61	addxcc	%o2,%o4,%o2		! lop.dl_hop + rop.dl_hop + <carry>
62	ld	[%sp+(16*4)],%o0	! address to store result into
63	st	%o2,[%o0+0]		! store result, dl_hop
64	jmp	%o7+12			! return
65	st	%o3,[%o0+4]		! store result, dl_lop
66
67	SET_SIZE(ladd)
68