xref: /original-bsd/lib/libm/vax/infnan.s (revision 99919bf7)
1/*
2 * Copyright (c) 1985 Regents of the University of California.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms are permitted
6 * provided that the above copyright notice and this paragraph are
7 * duplicated in all such forms and that any documentation,
8 * advertising materials, and other materials related to such
9 * distribution and use acknowledge that the software was developed
10 * by the University of California, Berkeley.  The name of the
11 * University may not be used to endorse or promote products derived
12 * from this software without specific prior written permission.
13 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16 *
17 * All recipients should regard themselves as participants in an ongoing
18 * research project and hence should feel obligated to report their
19 * experiences (good or bad) with these elementary function codes, using
20 * the sendbug(8) program, to the authors.
21 *
22 *	@(#)infnan.s	5.3 (Berkeley) 06/30/88
23 */
24	.data
25	.align	2
26_sccsid:
27.asciz	"@(#)infnan.s	1.1 (Berkeley) 8/21/85; 5.3 (ucb.elefunt) 06/30/88"
28
29/*
30 * infnan(arg) int arg;
31 * where arg :=    EDOM	if result is  NaN
32 *	     :=  ERANGE	if result is +INF
33 *	     := -ERANGE if result is -INF
34 *
35 * The Reserved Operand Fault is generated inside of this routine.
36 */
37	.globl	_infnan
38	.set	EDOM,33
39	.set	ERANGE,34
40	.text
41	.align 1
42_infnan:
43	.word	0x0
44	cmpl	4(ap),$ERANGE
45	bneq	1f
46	movl	$ERANGE,_errno
47	brb	2f
481:	movl	$EDOM,_errno
492:	emodd	$0,$0,$0x8000,r0,r0	# generates the reserved operand fault
50	ret
51