xref: /netbsd-src/lib/libc/arch/m68k/gen/fabs.S (revision a5dfc9a7f2d601c6efcb9b30e76888c3ba55c1b3)
1*a5dfc9a7Sdholland/*	$NetBSD: fabs.S,v 1.14 2019/01/27 02:42:32 dholland Exp $	*/
29f1ee9aeSthorpej
35f709618Spaulus/*-
416e8217fSjtc * Copyright (c) 1996 The NetBSD Foundation, Inc.
55f709618Spaulus * All rights reserved.
65f709618Spaulus *
716e8217fSjtc * This code is derived from software contributed to The NetBSD Foundation
816e8217fSjtc * by
95f709618Spaulus *
105f709618Spaulus * Redistribution and use in source and binary forms, with or without
115f709618Spaulus * modification, are permitted provided that the following conditions
125f709618Spaulus * are met:
135f709618Spaulus * 1. Redistributions of source code must retain the above copyright
145f709618Spaulus *    notice, this list of conditions and the following disclaimer.
155f709618Spaulus * 2. Redistributions in binary form must reproduce the above copyright
165f709618Spaulus *    notice, this list of conditions and the following disclaimer in the
175f709618Spaulus *    documentation and/or other materials provided with the distribution.
185f709618Spaulus *
1916e8217fSjtc * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
2016e8217fSjtc * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
2116e8217fSjtc * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
229f3b240eSjtc * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
239f3b240eSjtc * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2416e8217fSjtc * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2516e8217fSjtc * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2616e8217fSjtc * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2716e8217fSjtc * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2816e8217fSjtc * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2916e8217fSjtc * POSSIBILITY OF SUCH DAMAGE.
305f709618Spaulus */
315f709618Spaulus
3216e8217fSjtc#include <machine/asm.h>
33cdb65da5Sriastradh#include <machine/math.h>
349f1ee9aeSthorpej
35*a5dfc9a7SdhollandRCSID("$NetBSD: fabs.S,v 1.14 2019/01/27 02:42:32 dholland Exp $")
36cdb65da5Sriastradh
37cdb65da5Sriastradh#ifndef __HAVE_LONG_DOUBLE
38cdb65da5SriastradhSTRONG_ALIAS(fabsl, fabs)
39cdb65da5Sriastradh#endif
405f709618Spaulus
415f709618SpaulusENTRY(fabs)
42c1bc7edeSmatt#if defined(__SVR4_ABI__) && defined(__HAVE_FPU__)
4307a0a325Smatt	bclr	#31,4(%sp)
4407a0a325Smatt	fmoved	4(%sp),%fp0
45d658cafbSkleink#else
4607a0a325Smatt	movl	4(%sp),%d0
4707a0a325Smatt	movl	8(%sp),%d1
483b435a73Sthorpej	bclr	#31,%d0
49d658cafbSkleink#endif
505f709618Spaulus	rts
5194258182SmattEND(fabs)
52