xref: /netbsd/lib/libm/arch/vax/n_infnan.S (revision eb7c1594)
1*eb7c1594Sagc/*      $NetBSD: n_infnan.S,v 1.6 2003/08/07 16:44:45 agc Exp $ */
2d76e5e0aSragge/*
3d76e5e0aSragge * Copyright (c) 1985, 1993
4d76e5e0aSragge *	The Regents of the University of California.  All rights reserved.
5d76e5e0aSragge *
6d76e5e0aSragge * Redistribution and use in source and binary forms, with or without
7d76e5e0aSragge * modification, are permitted provided that the following conditions
8d76e5e0aSragge * are met:
9d76e5e0aSragge * 1. Redistributions of source code must retain the above copyright
10d76e5e0aSragge *    notice, this list of conditions and the following disclaimer.
11d76e5e0aSragge * 2. Redistributions in binary form must reproduce the above copyright
12d76e5e0aSragge *    notice, this list of conditions and the following disclaimer in the
13d76e5e0aSragge *    documentation and/or other materials provided with the distribution.
14*eb7c1594Sagc * 3. Neither the name of the University nor the names of its contributors
15d76e5e0aSragge *    may be used to endorse or promote products derived from this software
16d76e5e0aSragge *    without specific prior written permission.
17d76e5e0aSragge *
18d76e5e0aSragge * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19d76e5e0aSragge * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20d76e5e0aSragge * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21d76e5e0aSragge * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22d76e5e0aSragge * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23d76e5e0aSragge * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24d76e5e0aSragge * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25d76e5e0aSragge * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26d76e5e0aSragge * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27d76e5e0aSragge * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28d76e5e0aSragge * SUCH DAMAGE.
29d76e5e0aSragge *
30d76e5e0aSragge *	@(#)infnan.s	8.1 (Berkeley) 6/4/93
31d76e5e0aSragge */
32584a2f53Smatt#include <machine/asm.h>
33584a2f53Smatt
34584a2f53Smatt	.text
35d76e5e0aSragge_sccsid:
36584a2f53Smatt	.asciz	"@(#)infnan.s\t1.1 (Berkeley) 8/21/85; 8.1 (ucb.elefunt) 6/4/93"
37d76e5e0aSragge
38d76e5e0aSragge/*
39d76e5e0aSragge * infnan(arg) int arg;
40d76e5e0aSragge * where arg :=    EDOM	if result is  NaN
41d76e5e0aSragge *	     :=  ERANGE	if result is +INF
42d76e5e0aSragge *	     := -ERANGE if result is -INF
43d76e5e0aSragge *
44d76e5e0aSragge * The Reserved Operand Fault is generated inside of this routine.
45d76e5e0aSragge */
46d76e5e0aSragge	.set	EDOM,33
47d76e5e0aSragge	.set	ERANGE,34
48584a2f53Smatt
49584a2f53SmattENTRY(infnan, 0)
500ce5ca14Smatt	cmpl	4(%ap),$ERANGE
51d76e5e0aSragge	bneq	1f
52584a2f53Smatt	movl	$ERANGE,_C_LABEL(errno)
53d76e5e0aSragge	brb	2f
54584a2f53Smatt1:	movl	$EDOM,_C_LABEL(errno)
550ce5ca14Smatt2:	emodd	$0,$0,$0x8000,%r0,%r0	# generates the reserved operand fault
56d76e5e0aSragge	ret
57