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