xref: /onnv-gate/usr/src/lib/libc/sparc/gen/ladd.s (revision 7298:b69e27387f74)
10Sstevel@tonic-gate/*
20Sstevel@tonic-gate * CDDL HEADER START
30Sstevel@tonic-gate *
40Sstevel@tonic-gate * The contents of this file are subject to the terms of the
56812Sraf * Common Development and Distribution License (the "License").
66812Sraf * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate *
80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate * See the License for the specific language governing permissions
110Sstevel@tonic-gate * and limitations under the License.
120Sstevel@tonic-gate *
130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate *
190Sstevel@tonic-gate * CDDL HEADER END
200Sstevel@tonic-gate */
216812Sraf
226812Sraf/*
236812Sraf * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
246812Sraf * Use is subject to license terms.
256812Sraf */
266812Sraf
270Sstevel@tonic-gate/*	Copyright (c) 1988 AT&T	*/
280Sstevel@tonic-gate/*	  All Rights Reserved	*/
290Sstevel@tonic-gate
30*7298SMark.J.Nelson@Sun.COM	.file	"ladd.s"
310Sstevel@tonic-gate
320Sstevel@tonic-gate/*
330Sstevel@tonic-gate * Double long add routine.  Ported from pdp 11/70 version
340Sstevel@tonic-gate * with considerable effort.  All supplied comments were ported.
350Sstevel@tonic-gate *
360Sstevel@tonic-gate * Ported from m32 version to sparc. No comments about difficulty.
370Sstevel@tonic-gate *
380Sstevel@tonic-gate *	dl_t
390Sstevel@tonic-gate *	ladd (lop, rop)
400Sstevel@tonic-gate *		dl_t	lop;
410Sstevel@tonic-gate *		dl_t	rop;
420Sstevel@tonic-gate */
430Sstevel@tonic-gate
446812Sraf#include "SYS.h"
450Sstevel@tonic-gate
460Sstevel@tonic-gate	ENTRY(ladd)
470Sstevel@tonic-gate
480Sstevel@tonic-gate	ld	[%o7+8],%o4		! Instruction at ret-addr should be a
490Sstevel@tonic-gate	cmp     %o4,8			! 'unimp 8' indicating a valid call.
500Sstevel@tonic-gate	be	1f			! if OK, go forward.
510Sstevel@tonic-gate	nop				! delay instruction.
520Sstevel@tonic-gate	jmp	%o7+8			! return
530Sstevel@tonic-gate	nop				! delay instruction.
540Sstevel@tonic-gate
550Sstevel@tonic-gate1:
560Sstevel@tonic-gate	ld	[%o0+0],%o2		! fetch lop.dl_hop
570Sstevel@tonic-gate	ld	[%o0+4],%o3		! fetch lop.dl_lop
580Sstevel@tonic-gate	ld	[%o1+0],%o4		! fetch rop.dl_hop
590Sstevel@tonic-gate	ld	[%o1+4],%o5		! fetch rop.dl_lop
600Sstevel@tonic-gate	addcc	%o3,%o5,%o3		! lop.dl_lop + rop.dl_lop (set carry)
610Sstevel@tonic-gate	addxcc	%o2,%o4,%o2		! lop.dl_hop + rop.dl_hop + <carry>
620Sstevel@tonic-gate	ld	[%sp+(16*4)],%o0	! address to store result into
630Sstevel@tonic-gate	st	%o2,[%o0+0]		! store result, dl_hop
640Sstevel@tonic-gate	jmp	%o7+12			! return
650Sstevel@tonic-gate	st	%o3,[%o0+4]		! store result, dl_lop
660Sstevel@tonic-gate
670Sstevel@tonic-gate	SET_SIZE(ladd)
68