xref: /openbsd-src/lib/libc/arch/m88k/gen/fabs.S (revision 89aacaf081fe6829126af4771ffd2cfeea3aa2da)
1*89aacaf0Smiod/* $OpenBSD: fabs.S,v 1.13 2024/03/02 16:51:00 miod Exp $ */
2aeb694e3Smartynas/*-
3aeb694e3Smartynas * Copyright (c) 1996 Nivas Madhur
4aeb694e3Smartynas * All rights reserved.
5aeb694e3Smartynas *
6aeb694e3Smartynas * Redistribution and use in source and binary forms, with or without
7aeb694e3Smartynas * modification, are permitted provided that the following conditions
8aeb694e3Smartynas * are met:
9aeb694e3Smartynas * 1. Redistributions of source code must retain the above copyright
10aeb694e3Smartynas *    notice, this list of conditions and the following disclaimer.
11aeb694e3Smartynas * 2. Redistributions in binary form must reproduce the above copyright
12aeb694e3Smartynas *    notice, this list of conditions and the following disclaimer in the
13aeb694e3Smartynas *    documentation and/or other materials provided with the distribution.
14aeb694e3Smartynas * 3. All advertising materials mentioning features or use of this software
15aeb694e3Smartynas *    must display the following acknowledgement:
16aeb694e3Smartynas *      This product includes software developed by Nivas Madhur.
17aeb694e3Smartynas * 4. The name of the author may not be used to endorse or promote products
18aeb694e3Smartynas *    derived from this software without specific prior written permission.
19aeb694e3Smartynas *
20aeb694e3Smartynas * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21aeb694e3Smartynas * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22aeb694e3Smartynas * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23aeb694e3Smartynas * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24aeb694e3Smartynas * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25aeb694e3Smartynas * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26aeb694e3Smartynas * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27aeb694e3Smartynas * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28aeb694e3Smartynas * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29aeb694e3Smartynas * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30aeb694e3Smartynas */
31aeb694e3Smartynas
32aeb694e3Smartynas#include "DEFS.h"
33aeb694e3Smartynas
34aeb694e3Smartynas/*
35aeb694e3Smartynas * Will work only if the argument passed is in IEEE format!
36aeb694e3Smartynas */
37aeb694e3Smartynas
387ec0ade3SmiodSTRONG_ALIAS(fabsl, fabs)
39aeb694e3SmartynasENTRY(fabs)
400b514a07Smiod	jmp.n	%r1
41*89aacaf0Smiod	 and.u	%r2, %r2, 0x7fff	/* set sign bit to 0 */
42c90cd26bSmiodEND(fabs)
43