1251881Speter/* $NetBSD: n_infnan.S,v 1.7 2024/05/07 15:15:10 riastradh Exp $ */ 2251881Speter/* 3251881Speter * Copyright (c) 1985, 1993 4251881Speter * The Regents of the University of California. All rights reserved. 5251881Speter * 6251881Speter * Redistribution and use in source and binary forms, with or without 7251881Speter * modification, are permitted provided that the following conditions 8251881Speter * are met: 9251881Speter * 1. Redistributions of source code must retain the above copyright 10251881Speter * notice, this list of conditions and the following disclaimer. 11251881Speter * 2. Redistributions in binary form must reproduce the above copyright 12251881Speter * notice, this list of conditions and the following disclaimer in the 13251881Speter * documentation and/or other materials provided with the distribution. 14251881Speter * 3. Neither the name of the University nor the names of its contributors 15251881Speter * may be used to endorse or promote products derived from this software 16251881Speter * without specific prior written permission. 17251881Speter * 18251881Speter * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 19251881Speter * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20251881Speter * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21251881Speter * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 22251881Speter * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23251881Speter * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24251881Speter * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25251881Speter * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26251881Speter * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27251881Speter * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28251881Speter * SUCH DAMAGE. 29251881Speter * 30251881Speter * @(#)infnan.s 8.1 (Berkeley) 6/4/93 31251881Speter */ 32251881Speter#include <machine/asm.h> 33251881Speter 34251881Speter .text 35251881Speter_sccsid: 36251881Speter .asciz "@(#)infnan.s\t1.1 (Berkeley) 8/21/85; 8.1 (ucb.elefunt) 6/4/93" 37251881Speter 38251881Speter/* 39251881Speter * infnan(arg) int arg; 40251881Speter * where arg := EDOM if result is NaN 41251881Speter * := ERANGE if result is +INF 42251881Speter * := -ERANGE if result is -INF 43251881Speter * 44251881Speter * The Reserved Operand Fault is generated inside of this routine. 45251881Speter */ 46251881Speter .set EDOM,33 47251881Speter .set ERANGE,34 48251881Speter 49251881SpeterENTRY(infnan, 0) 50251881Speter cmpl 4(%ap),$ERANGE 51251881Speter bneq 1f 52251881Speter movl $ERANGE,_C_LABEL(errno) 53251881Speter brb 2f 54251881Speter1: movl $EDOM,_C_LABEL(errno) 55251881Speter2: emodd $0,$0,$0x8000,%r0,%r0 # generates the reserved operand fault 56251881Speter ret 57251881SpeterEND(infnan) 58251881Speter