s_floor.S revision 1.6
11.6Sthorpej/* $NetBSD: s_floor.S,v 1.6 1999/11/10 16:45:34 thorpej Exp $ */ 21.6Sthorpej 31.1Sjtc/*- 41.1Sjtc * Copyright (c) 1990 The Regents of the University of California. 51.1Sjtc * All rights reserved. 61.1Sjtc * 71.1Sjtc * This code is derived from software contributed to Berkeley by 81.1Sjtc * the Systems Programming Group of the University of Utah Computer 91.1Sjtc * Science Department. 101.1Sjtc * 111.1Sjtc * Redistribution and use in source and binary forms, with or without 121.1Sjtc * modification, are permitted provided that the following conditions 131.1Sjtc * are met: 141.1Sjtc * 1. Redistributions of source code must retain the above copyright 151.1Sjtc * notice, this list of conditions and the following disclaimer. 161.1Sjtc * 2. Redistributions in binary form must reproduce the above copyright 171.1Sjtc * notice, this list of conditions and the following disclaimer in the 181.1Sjtc * documentation and/or other materials provided with the distribution. 191.1Sjtc * 3. All advertising materials mentioning features or use of this software 201.1Sjtc * must display the following acknowledgement: 211.1Sjtc * This product includes software developed by the University of 221.1Sjtc * California, Berkeley and its contributors. 231.1Sjtc * 4. Neither the name of the University nor the names of its contributors 241.1Sjtc * may be used to endorse or promote products derived from this software 251.1Sjtc * without specific prior written permission. 261.1Sjtc * 271.1Sjtc * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 281.1Sjtc * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 291.1Sjtc * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 301.1Sjtc * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 311.1Sjtc * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 321.1Sjtc * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 331.1Sjtc * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 341.1Sjtc * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 351.1Sjtc * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 361.1Sjtc * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 371.1Sjtc * SUCH DAMAGE. 381.1Sjtc */ 391.1Sjtc 401.1Sjtc#include <machine/asm.h> 411.1Sjtc 421.1Sjtc;_sccsid: 431.1Sjtc;.asciz "from: @(#)floor.s 5.1 (Berkeley) 5/17/90" 441.2Sjtc 451.6SthorpejRCSID("$NetBSD: s_floor.S,v 1.6 1999/11/10 16:45:34 thorpej Exp $") 461.1Sjtc 471.1Sjtc| floor(x) 481.1Sjtc| the largest integer no larger than x 491.1SjtcENTRY(floor) 501.6Sthorpej fmovel %fpcr,%d0 | save old FPCR 511.6Sthorpej fmoved %sp@(4),%fp0 | get argument 521.1Sjtc fbun Lret | if NaN, return NaN 531.1Sjtc fboge Lrtz | >=0, round to zero 541.6Sthorpej fmovel #0x20,%fpcr | <0, round to -inf 551.1Sjtc jra Ldoit 561.1SjtcLrtz: 571.6Sthorpej fmovel #0x10,%fpcr 581.1SjtcLdoit: 591.6Sthorpej fintd %sp@(4),%fp0 | truncate 601.6Sthorpej fmovel %d0,%fpcr | restore old FPCR 611.1SjtcLret: 621.4Skleink#ifndef __SVR4_ABI__ 631.6Sthorpej fmoved %fp0,%sp@- 641.6Sthorpej movel %sp@+,%d0 651.6Sthorpej movel %sp@+,%d1 661.4Skleink#endif 671.1Sjtc rts 68