xref: /onnv-gate/usr/src/lib/libc/sparc/gen/ladd.s (revision 6812:febeba71273d)
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
5*6812Sraf * Common Development and Distribution License (the "License").
6*6812Sraf * 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 */
21*6812Sraf
22*6812Sraf/*
23*6812Sraf * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24*6812Sraf * Use is subject to license terms.
25*6812Sraf */
26*6812Sraf
270Sstevel@tonic-gate/*	Copyright (c) 1988 AT&T	*/
280Sstevel@tonic-gate/*	  All Rights Reserved	*/
290Sstevel@tonic-gate
30*6812Sraf#pragma ident	"%Z%%M%	%I%	%E% SMI"
310Sstevel@tonic-gate
32*6812Sraf	.file	"%M%"
330Sstevel@tonic-gate
340Sstevel@tonic-gate/*
350Sstevel@tonic-gate * Double long add routine.  Ported from pdp 11/70 version
360Sstevel@tonic-gate * with considerable effort.  All supplied comments were ported.
370Sstevel@tonic-gate *
380Sstevel@tonic-gate * Ported from m32 version to sparc. No comments about difficulty.
390Sstevel@tonic-gate *
400Sstevel@tonic-gate *	dl_t
410Sstevel@tonic-gate *	ladd (lop, rop)
420Sstevel@tonic-gate *		dl_t	lop;
430Sstevel@tonic-gate *		dl_t	rop;
440Sstevel@tonic-gate */
450Sstevel@tonic-gate
46*6812Sraf#include "SYS.h"
470Sstevel@tonic-gate
480Sstevel@tonic-gate	ENTRY(ladd)
490Sstevel@tonic-gate
500Sstevel@tonic-gate	ld	[%o7+8],%o4		! Instruction at ret-addr should be a
510Sstevel@tonic-gate	cmp     %o4,8			! 'unimp 8' indicating a valid call.
520Sstevel@tonic-gate	be	1f			! if OK, go forward.
530Sstevel@tonic-gate	nop				! delay instruction.
540Sstevel@tonic-gate	jmp	%o7+8			! return
550Sstevel@tonic-gate	nop				! delay instruction.
560Sstevel@tonic-gate
570Sstevel@tonic-gate1:
580Sstevel@tonic-gate	ld	[%o0+0],%o2		! fetch lop.dl_hop
590Sstevel@tonic-gate	ld	[%o0+4],%o3		! fetch lop.dl_lop
600Sstevel@tonic-gate	ld	[%o1+0],%o4		! fetch rop.dl_hop
610Sstevel@tonic-gate	ld	[%o1+4],%o5		! fetch rop.dl_lop
620Sstevel@tonic-gate	addcc	%o3,%o5,%o3		! lop.dl_lop + rop.dl_lop (set carry)
630Sstevel@tonic-gate	addxcc	%o2,%o4,%o2		! lop.dl_hop + rop.dl_hop + <carry>
640Sstevel@tonic-gate	ld	[%sp+(16*4)],%o0	! address to store result into
650Sstevel@tonic-gate	st	%o2,[%o0+0]		! store result, dl_hop
660Sstevel@tonic-gate	jmp	%o7+12			! return
670Sstevel@tonic-gate	st	%o3,[%o0+4]		! store result, dl_lop
680Sstevel@tonic-gate
690Sstevel@tonic-gate	SET_SIZE(ladd)
70