fixunsdfsi.S revision 1.3
11.3Sriastrad/*	$NetBSD: fixunsdfsi.S,v 1.3 2014/03/18 18:20:37 riastradh 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: @(#)fixunsdfsi.s	5.1 (Berkeley) 6/7/90")
411.1Smatt#else
421.3Sriastrad	RCSID("$NetBSD: fixunsdfsi.S,v 1.3 2014/03/18 18:20:37 riastradh Exp $")
431.1Smatt#endif
441.1Smatt#endif /* LIBC_SCCS and not lint */
451.1Smatt
461.2Smatt#ifdef __mcoldfire__
471.2Smatt	.section .rodata,"a"
481.2Smatt	.p2align 4
491.2SmattL2G:	.double 0r2147483648.0
501.2Smatt#endif
511.2Smatt
521.1Smatt/* (unsigned) double */
531.1SmattENTRY(__fixunsdfsi)
541.1Smatt	fintrzd	4(%sp),%fp0
551.2Smatt#ifdef __mcoldfire__
561.2Smatt	LEA_LCL(L2G,%a0)
571.2Smatt	fmoved	(%a0),%fp1
581.2Smatt	fcmpd	%fp1,%fp0
591.2Smatt#else
601.2Smatt	fmoved	#0r2147483648.0,%fp1
611.2Smatt	fcmpx	%fp1,%fp0
621.2Smatt#endif
631.1Smatt	fbge	Lwaybig
641.1Smatt	fmovel	%fp0,%d0
651.1Smatt	rts
661.1SmattLwaybig:
671.2Smatt#ifdef __mcoldfire__
681.2Smatt	fsubd	%fp1,%fp0
691.2Smatt#else
701.2Smatt	fsubx	%fp1,%fp0
711.2Smatt#endif
721.1Smatt	fmovel	%fp0,%d0
731.1Smatt	bset	#31,%d0
741.1Smatt	rts
751.1SmattEND(__fixunsdfsi)
76