xref: /original-bsd/lib/libm/vax/infnan.s (revision b9d18e58)
1/*
2 * Copyright (c) 1985 Regents of the University of California.
3 *
4 * Use and reproduction of this software are granted  in  accordance  with
5 * the terms and conditions specified in  the  Berkeley  Software  License
6 * Agreement (in particular, this entails acknowledgement of the programs'
7 * source, and inclusion of this notice) with the additional understanding
8 * that  all  recipients  should regard themselves as participants  in  an
9 * ongoing  research  project and hence should  feel  obligated  to report
10 * their  experiences (good or bad) with these elementary function  codes,
11 * using "sendbug 4bsd-bugs@BERKELEY", to the authors.
12 */
13	.data
14	.align	2
15_sccsid:
16.asciz	"@(#)infnan.s	1.1 (Berkeley) 8/21/85; 1.3 (ucb.elefunt) 09/12/85"
17
18/*
19 * infnan(arg) int arg;
20 * where arg :=    EDOM	if result is  NaN
21 *	     :=  ERANGE	if result is +INF
22 *	     := -ERANGE if result is -INF
23 *
24 * The Reserved Operand Fault is generated inside of this routine.
25 */
26	.globl	_infnan
27	.set	EDOM,33
28	.set	ERANGE,34
29	.text
30	.align 1
31_infnan:
32	.word	0x0
33	cmpl	4(ap),$ERANGE
34	bneq	1f
35	movl	$ERANGE,_errno
36	brb	2f
371:	movl	$EDOM,_errno
382:	emodd	$0,$0,$0x8000,r0,r0	# generates the reserved operand fault
39	ret
40