8354 sync regcomp(3C) with upstream (fix make catalog)
[unleashed/tickless.git] / usr / src / lib / libc / sparc / gen / lsub.s
blob204a654270f4c26a0f14f392a2c9ee377d5fdc30
1 /*
2 * CDDL HEADER START
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.
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.
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]
19 * CDDL HEADER END
23 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 /* Copyright (c) 1988 AT&T */
28 /* All Rights Reserved */
30 .file "lsub.s"
33 * Double long subtraction routine. Ported from pdp 11/70 version
34 * with considerable effort. All supplied comments were ported.
35 * Ported from m32 version to sparc. No comments about difficulty.
37 * dl_t
38 * lsub (lop, rop)
39 * dl_t lop;
40 * dl_t rop;
43 #include "SYS.h"
45 ENTRY(lsub)
47 ld [%o7+8],%o4 ! Instruction at ret-addr should be a
48 cmp %o4,8 ! 'unimp 8' indicating a valid call.
49 be 1f ! if OK, go forward.
50 nop ! delay instruction.
51 jmp %o7+8 ! return
52 nop ! delay instruction.
55 ld [%o0+0],%o2 ! fetch lop.dl_hop
56 ld [%o0+4],%o3 ! fetch lop.dl_lop
57 ld [%o1+0],%o4 ! fetch rop.dl_hop
58 ld [%o1+4],%o5 ! fetch rop.dl_lop
59 subcc %o3,%o5,%o3 ! lop.dl_lop - rop.dl_lop (set carry)
60 subxcc %o2,%o4,%o2 ! lop.dl_hop - rop.dl_hop - <carry>
61 ld [%sp+(16*4)],%o0 ! address to store result into
62 st %o2,[%o0] ! store result.dl_hop
63 jmp %o7+12 ! return
64 st %o3,[%o0+4] ! store result.dl_lop
66 SET_SIZE(lsub)