xref: /netbsd-src/lib/libm/arch/m68k/s_finite.S (revision b6653282bf1ec3b92e9659acb55bdee61d137865)
1*b6653282Sriastradh/*	$NetBSD: s_finite.S,v 1.8 2024/05/08 01:05:25 riastradh Exp $	*/
2bebf6897Sthorpej
3c81875b7Sis/*-
4c81875b7Sis * Copyright (c) 1990 The Regents of the University of California.
5c81875b7Sis * All rights reserved.
6c81875b7Sis *
7c81875b7Sis * This code is derived from software contributed to Berkeley by
8c81875b7Sis * the Systems Programming Group of the University of Utah Computer
9c81875b7Sis * Science Department.
10c81875b7Sis *
11c81875b7Sis * Redistribution and use in source and binary forms, with or without
12c81875b7Sis * modification, are permitted provided that the following conditions
13c81875b7Sis * are met:
14c81875b7Sis * 1. Redistributions of source code must retain the above copyright
15c81875b7Sis *    notice, this list of conditions and the following disclaimer.
16c81875b7Sis * 2. Redistributions in binary form must reproduce the above copyright
17c81875b7Sis *    notice, this list of conditions and the following disclaimer in the
18c81875b7Sis *    documentation and/or other materials provided with the distribution.
19eb7c1594Sagc * 3. Neither the name of the University nor the names of its contributors
20c81875b7Sis *    may be used to endorse or promote products derived from this software
21c81875b7Sis *    without specific prior written permission.
22c81875b7Sis *
23c81875b7Sis * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24c81875b7Sis * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25c81875b7Sis * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26c81875b7Sis * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27c81875b7Sis * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28c81875b7Sis * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29c81875b7Sis * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30c81875b7Sis * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31c81875b7Sis * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32c81875b7Sis * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33c81875b7Sis * SUCH DAMAGE.
34c81875b7Sis */
35c81875b7Sis
36c81875b7Sis#include <machine/asm.h>
37c81875b7Sis
38c81875b7Sis;_sccsid:
39c81875b7Sis;.asciz	"from: @(#)support.s	5.2 (Berkeley) 5/17/90"
40c81875b7Sis
41*b6653282SriastradhRCSID("$NetBSD: s_finite.S,v 1.8 2024/05/08 01:05:25 riastradh Exp $")
42c81875b7Sis
43c81875b7Sis| finite(x)
44c81875b7Sis| returns the value TRUE if -INF < x < +INF and returns FALSE otherwise.
45*b6653282SriastradhWEAK_ALIAS(finite, _finite)
46*b6653282SriastradhENTRY(_finite)
47bebf6897Sthorpej	movw	%sp@(4),%d0
48bebf6897Sthorpej	movw	#0x7FF0,%d1
49bebf6897Sthorpej	andw	%d1,%d0
50bebf6897Sthorpej	cmpw	%d1,%d0
51bebf6897Sthorpej	sne	%d0
52bebf6897Sthorpej	extbl	%d0
53bebf6897Sthorpej	negl	%d0
54c81875b7Sis	rts
55*b6653282SriastradhEND(_finite)
56