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