1102697Stjr/*	$NetBSD: fabs.S,v 1.5 2018/11/07 22:21:42 riastradh Exp $	*/
2127944Stjr
3118595Stjr/*
4102697Stjr * Copyright (c) 1992, 1993
5102697Stjr *	The Regents of the University of California.  All rights reserved.
6102697Stjr *
7102697Stjr * This software was developed by the Computer Systems Engineering group
8102697Stjr * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
9102697Stjr * contributed to Berkeley.
10102697Stjr *
11102697Stjr * Redistribution and use in source and binary forms, with or without
12102697Stjr * modification, are permitted provided that the following conditions
13102697Stjr * are met:
14118595Stjr * 1. Redistributions of source code must retain the above copyright
15102697Stjr *    notice, this list of conditions and the following disclaimer.
16102697Stjr * 2. Redistributions in binary form must reproduce the above copyright
17118595Stjr *    notice, this list of conditions and the following disclaimer in the
18102697Stjr *    documentation and/or other materials provided with the distribution.
19102697Stjr * 3. Neither the name of the University nor the names of its contributors
20102697Stjr *    may be used to endorse or promote products derived from this software
21102697Stjr *    without specific prior written permission.
22102697Stjr *
23102697Stjr * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24102697Stjr * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25102697Stjr * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26102697Stjr * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27102697Stjr * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28102697Stjr * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29102697Stjr * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30127944Stjr * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31127944Stjr * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32102697Stjr * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33127944Stjr * SUCH DAMAGE.
34102697Stjr *
35102697Stjr * from: Header: fabs.s,v 1.4 91/10/07 23:59:05 torek Exp
36106032Stjr */
37102697Stjr
38127944Stjr#include <machine/asm.h>
39127944Stjr#if defined(LIBC_SCCS) && !defined(lint)
40127944Stjr#if 0
41102697Stjr	.asciz "@(#)fabs.s	8.1 (Berkeley) 6/4/93"
42127944Stjr#else
43127944Stjr	RCSID("$NetBSD: fabs.S,v 1.5 2018/11/07 22:21:42 riastradh Exp $")
44127944Stjr#endif
45127944Stjr#endif /* LIBC_SCCS and not lint */
46127944Stjr
47127944Stjr/* fabs - floating absolute value */
48127944Stjr
49127944StjrSTRONG_ALIAS(fabsl, fabs)
50127944Stjr
51127944StjrENTRY(fabs)
52127944Stjr	std	%o0, [%sp + 32]		! return value => %f0:f1
53127944Stjr	ldd	[%sp + 32], %f0		! (via kernel %o0/%o1 slot)
54127944Stjr	retl
55102697Stjr	 fabss	%f0, %f0		! return absolute value
56END(fabs)
57