xref: /minix3/lib/libc/arch/m68k/hardfloat/modf.S (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc/*	$NetBSD: modf.S,v 1.3 2014/03/18 18:20:37 riastradh Exp $	*/
284d9c625SLionel Sambuc
384d9c625SLionel Sambuc/*-
484d9c625SLionel Sambuc * Copyright (c) 1990 The Regents of the University of California.
584d9c625SLionel Sambuc * All rights reserved.
684d9c625SLionel Sambuc *
784d9c625SLionel Sambuc * This code is derived from software contributed to Berkeley by
884d9c625SLionel Sambuc * the Systems Programming Group of the University of Utah Computer
984d9c625SLionel Sambuc * Science Department.
1084d9c625SLionel Sambuc *
1184d9c625SLionel Sambuc * Redistribution and use in source and binary forms, with or without
1284d9c625SLionel Sambuc * modification, are permitted provided that the following conditions
1384d9c625SLionel Sambuc * are met:
1484d9c625SLionel Sambuc * 1. Redistributions of source code must retain the above copyright
1584d9c625SLionel Sambuc *    notice, this list of conditions and the following disclaimer.
1684d9c625SLionel Sambuc * 2. Redistributions in binary form must reproduce the above copyright
1784d9c625SLionel Sambuc *    notice, this list of conditions and the following disclaimer in the
1884d9c625SLionel Sambuc *    documentation and/or other materials provided with the distribution.
1984d9c625SLionel Sambuc * 3. Neither the name of the University nor the names of its contributors
2084d9c625SLionel Sambuc *    may be used to endorse or promote products derived from this software
2184d9c625SLionel Sambuc *    without specific prior written permission.
2284d9c625SLionel Sambuc *
2384d9c625SLionel Sambuc * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2484d9c625SLionel Sambuc * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2584d9c625SLionel Sambuc * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2684d9c625SLionel Sambuc * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2784d9c625SLionel Sambuc * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2884d9c625SLionel Sambuc * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2984d9c625SLionel Sambuc * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3084d9c625SLionel Sambuc * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3184d9c625SLionel Sambuc * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3284d9c625SLionel Sambuc * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3384d9c625SLionel Sambuc * SUCH DAMAGE.
3484d9c625SLionel Sambuc */
3584d9c625SLionel Sambuc
3684d9c625SLionel Sambuc#include <machine/asm.h>
3784d9c625SLionel Sambuc
3884d9c625SLionel Sambuc#if defined(LIBC_SCCS) && !defined(lint)
3984d9c625SLionel Sambuc#if 0
4084d9c625SLionel Sambuc	RCSID("from: @(#)modf.s	5.1 (Berkeley) 5/12/90")
4184d9c625SLionel Sambuc#else
42*0a6a1f1dSLionel Sambuc	RCSID("$NetBSD: modf.S,v 1.3 2014/03/18 18:20:37 riastradh Exp $")
4384d9c625SLionel Sambuc#endif
4484d9c625SLionel Sambuc#endif /* LIBC_SCCS and not lint */
4584d9c625SLionel Sambuc
4684d9c625SLionel Sambuc/*
4784d9c625SLionel Sambuc * double modf(val, iptr)
4884d9c625SLionel Sambuc * returns: xxx and n (in *iptr) where val == n.xxx
4984d9c625SLionel Sambuc */
5084d9c625SLionel SambucENTRY(modf)
5184d9c625SLionel Sambuc	fmoved	4(%sp),%fp0
5284d9c625SLionel Sambuc	movel	12(%sp),%a0
5384d9c625SLionel Sambuc#ifdef __mcoldfire__
5484d9c625SLionel Sambuc	fintrzd	%fp0,%fp1
5584d9c625SLionel Sambuc#else
5684d9c625SLionel Sambuc	fintrzx	%fp0,%fp1
5784d9c625SLionel Sambuc#endif
5884d9c625SLionel Sambuc	fmoved	%fp1,(%a0)
5984d9c625SLionel Sambuc#ifdef __mcoldfire__
6084d9c625SLionel Sambuc	fsubd	%fp1,%fp0
6184d9c625SLionel Sambuc#else
6284d9c625SLionel Sambuc	fsubx	%fp1,%fp0
6384d9c625SLionel Sambuc#endif
6484d9c625SLionel Sambuc#ifndef __SVR4_ABI__
6584d9c625SLionel Sambuc	fmoved	%fp0,-(%sp)
6684d9c625SLionel Sambuc	movel	(%sp)+,%d0
6784d9c625SLionel Sambuc	movel	(%sp)+,%d1
6884d9c625SLionel Sambuc#endif
6984d9c625SLionel Sambuc	rts
7084d9c625SLionel SambucEND(modf)
71