1/*- 2 * Copyright (c) 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Ralph Campbell. 7 * 8 * %sccs.include.redist.c% 9 */ 10 11#include <machine/machAsmDefs.h> 12 13#if defined(LIBC_SCCS) && !defined(lint) 14 ASMSTR("@(#)isinf.s 8.1 (Berkeley) 06/04/93") 15#endif /* LIBC_SCCS and not lint */ 16 17 18#define DEXP_INF 0x7ff 19 20 .set noreorder 21 22/* 23 * isnan(x) 24 * double x; 25 * 26 * Return true if x is a NAN. 27 */ 28LEAF(isnan) 29 mfc1 v1, $f13 # get MSW of x 30 mfc1 t3, $f12 # get LSW of x 31 sll t1, v1, 1 # get x exponent 32 srl t1, t1, 32 - 11 33 bne t1, DEXP_INF, 2f # is it a finite number? 34 sll t2, v1, 32 - 20 # get x fraction 35 bne t3, zero, 1f # is it a NAN? 36 nop 37 beq t2, zero, 2f # its infinity 38 nop 391: 40 j ra 41 li v0, 1 # x is a NAN 422: 43 j ra 44 move v0, zero # x is NOT a NAN 45END(isnan) 46 47/* 48 * isinf(x) 49 * double x; 50 * 51 * Return true if x is infinity. 52 */ 53LEAF(isinf) 54 mfc1 v1, $f13 # get MSW of x 55 mfc1 t3, $f12 # get LSW of x 56 sll t1, v1, 1 # get x exponent 57 srl t1, t1, 32 - 11 58 bne t1, DEXP_INF, 1f # is it a finite number? 59 sll t2, v1, 32 - 20 # get x fraction 60 bne t3, zero, 1f # is it a NAN? 61 nop 62 bne t2, zero, 1f # is it a NAN? 63 nop 64 j ra 65 li v0, 1 # x is infinity 661: 67 j ra 68 move v0, zero # x is NOT infinity 69END(isinf) 70