modf.S revision 1.1
11.1Smatt/*	$NetBSD: modf.S,v 1.1 2013/07/17 06:39:06 matt Exp $	*/
21.1Smatt
31.1Smatt/*-
41.1Smatt * Copyright (c) 1990 The Regents of the University of California.
51.1Smatt * All rights reserved.
61.1Smatt *
71.1Smatt * This code is derived from software contributed to Berkeley by
81.1Smatt * the Systems Programming Group of the University of Utah Computer
91.1Smatt * Science Department.
101.1Smatt *
111.1Smatt * Redistribution and use in source and binary forms, with or without
121.1Smatt * modification, are permitted provided that the following conditions
131.1Smatt * are met:
141.1Smatt * 1. Redistributions of source code must retain the above copyright
151.1Smatt *    notice, this list of conditions and the following disclaimer.
161.1Smatt * 2. Redistributions in binary form must reproduce the above copyright
171.1Smatt *    notice, this list of conditions and the following disclaimer in the
181.1Smatt *    documentation and/or other materials provided with the distribution.
191.1Smatt * 3. Neither the name of the University nor the names of its contributors
201.1Smatt *    may be used to endorse or promote products derived from this software
211.1Smatt *    without specific prior written permission.
221.1Smatt *
231.1Smatt * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
241.1Smatt * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
251.1Smatt * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
261.1Smatt * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
271.1Smatt * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
281.1Smatt * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
291.1Smatt * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
301.1Smatt * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
311.1Smatt * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
321.1Smatt * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
331.1Smatt * SUCH DAMAGE.
341.1Smatt */
351.1Smatt
361.1Smatt#include <machine/asm.h>
371.1Smatt
381.1Smatt#if defined(LIBC_SCCS) && !defined(lint)
391.1Smatt#if 0
401.1Smatt	RCSID("from: @(#)modf.s	5.1 (Berkeley) 5/12/90")
411.1Smatt#else
421.1Smatt	RCSID("$NetBSD: modf.S,v 1.1 2013/07/17 06:39:06 matt Exp $")
431.1Smatt#endif
441.1Smatt#endif /* LIBC_SCCS and not lint */
451.1Smatt
461.1Smatt/*
471.1Smatt * double modf(val, iptr)
481.1Smatt * returns: xxx and n (in *iptr) where val == n.xxx
491.1Smatt */
501.1SmattENTRY(modf)
511.1Smatt	fmoved	4(%sp),%fp0
521.1Smatt	movel	12(%sp),%a0
531.1Smatt	fintrzx	%fp0,%fp1
541.1Smatt	fmoved	%fp1,(%a0)
551.1Smatt	fsubx	%fp1,%fp0
561.1Smatt#ifndef __SVR4_ABI__
571.1Smatt	fmoved	%fp0,-(%sp)
581.1Smatt	movel	(%sp)+,%d0
591.1Smatt	movel	(%sp)+,%d1
601.1Smatt#endif
611.1Smatt	rts
621.1SmattEND(modf)
63