11.7Sriastrad/* $NetBSD: n_infnan.S,v 1.7 2024/05/07 15:15:10 riastradh Exp $ */ 21.1Sragge/* 31.1Sragge * Copyright (c) 1985, 1993 41.1Sragge * The Regents of the University of California. All rights reserved. 51.1Sragge * 61.1Sragge * Redistribution and use in source and binary forms, with or without 71.1Sragge * modification, are permitted provided that the following conditions 81.1Sragge * are met: 91.1Sragge * 1. Redistributions of source code must retain the above copyright 101.1Sragge * notice, this list of conditions and the following disclaimer. 111.1Sragge * 2. Redistributions in binary form must reproduce the above copyright 121.1Sragge * notice, this list of conditions and the following disclaimer in the 131.1Sragge * documentation and/or other materials provided with the distribution. 141.6Sagc * 3. Neither the name of the University nor the names of its contributors 151.1Sragge * may be used to endorse or promote products derived from this software 161.1Sragge * without specific prior written permission. 171.1Sragge * 181.1Sragge * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 191.1Sragge * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 201.1Sragge * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 211.1Sragge * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 221.1Sragge * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 231.1Sragge * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 241.1Sragge * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 251.1Sragge * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 261.1Sragge * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 271.1Sragge * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 281.1Sragge * SUCH DAMAGE. 291.1Sragge * 301.1Sragge * @(#)infnan.s 8.1 (Berkeley) 6/4/93 311.1Sragge */ 321.4Smatt#include <machine/asm.h> 331.4Smatt 341.4Smatt .text 351.1Sragge_sccsid: 361.4Smatt .asciz "@(#)infnan.s\t1.1 (Berkeley) 8/21/85; 8.1 (ucb.elefunt) 6/4/93" 371.1Sragge 381.1Sragge/* 391.1Sragge * infnan(arg) int arg; 401.1Sragge * where arg := EDOM if result is NaN 411.1Sragge * := ERANGE if result is +INF 421.1Sragge * := -ERANGE if result is -INF 431.1Sragge * 441.1Sragge * The Reserved Operand Fault is generated inside of this routine. 451.3Ssimonb */ 461.1Sragge .set EDOM,33 471.1Sragge .set ERANGE,34 481.4Smatt 491.4SmattENTRY(infnan, 0) 501.5Smatt cmpl 4(%ap),$ERANGE 511.1Sragge bneq 1f 521.4Smatt movl $ERANGE,_C_LABEL(errno) 531.1Sragge brb 2f 541.4Smatt1: movl $EDOM,_C_LABEL(errno) 551.5Smatt2: emodd $0,$0,$0x8000,%r0,%r0 # generates the reserved operand fault 561.1Sragge ret 571.7SriastradEND(infnan) 58