xref: /netbsd-src/lib/libc/arch/m68k/hardfloat/floatunsidf.S (revision 6cb10275d08f045e872662c371fe2f2724f2f6e6)
1*6cb10275Sriastradh/*	$NetBSD: floatunsidf.S,v 1.2 2014/03/18 18:20:37 riastradh Exp $	*/
2a2501075Smatt
3a2501075Smatt/*-
4a2501075Smatt * Copyright (c) 2013 The NetBSD Foundation, Inc.
5a2501075Smatt * All rights reserved.
6a2501075Smatt *
7a2501075Smatt * This code is derived from software contributed to The NetBSD Foundation
8a2501075Smatt * by Matt Thomas of 3am Software Foundry.
9a2501075Smatt *
10a2501075Smatt * Redistribution and use in source and binary forms, with or without
11a2501075Smatt * modification, are permitted provided that the following conditions
12a2501075Smatt * are met:
13a2501075Smatt * 1. Redistributions of source code must retain the above copyright
14a2501075Smatt *    notice, this list of conditions and the following disclaimer.
15a2501075Smatt * 2. Redistributions in binary form must reproduce the above copyright
16a2501075Smatt *    notice, this list of conditions and the following disclaimer in the
17a2501075Smatt *    documentation and/or other materials provided with the distribution.
18a2501075Smatt *
19a2501075Smatt * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20a2501075Smatt * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21a2501075Smatt * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22a2501075Smatt * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23a2501075Smatt * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24a2501075Smatt * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25a2501075Smatt * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26a2501075Smatt * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27a2501075Smatt * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28a2501075Smatt * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29a2501075Smatt * POSSIBILITY OF SUCH DAMAGE.
30a2501075Smatt */
31a2501075Smatt
32a2501075Smatt#include <machine/asm.h>
33a2501075Smatt
34a2501075Smatt#if defined(LIBC_SCCS) && !defined(lint)
35*6cb10275SriastradhRCSID("$NetBSD: floatunsidf.S,v 1.2 2014/03/18 18:20:37 riastradh Exp $")
36a2501075Smatt#endif /* LIBC_SCCS and not lint */
37a2501075Smatt
38a2501075Smatt#ifdef __mcoldfire__
39a2501075Smatt	.section .rodata,"a"
40a2501075Smatt	.p2align 2
41a2501075SmattL2G:	.double 0r2147483648.0
42a2501075Smatt#endif
43a2501075Smatt
44a2501075Smatt/* LINTSTUB: double __floatunsidf(unsigned int); */
45a2501075SmattENTRY(__floatunsidf)
46a2501075Smatt	movl	4(%sp),%d0
47a2501075Smatt	jpl	1f
48a2501075Smatt	fmovel	%d0,%fp0
49a2501075Smatt#ifdef __SVR4_ABI__
50a2501075Smatt	rts
51a2501075Smatt#else
52a2501075Smatt	jra	Lret
53a2501075Smatt#endif
54a2501075Smatt1:
55a2501075Smatt	bclr	#31,%d0
56a2501075Smatt	fmovel	%d0,%fp0
57a2501075Smatt#ifdef __mcoldfire__
58a2501075Smatt	LEA_LCL(L2G,%a0)
59a2501075Smatt	faddd	(%a0),%fp0
60a2501075Smatt#else
61a2501075Smatt	faddd	#0r2147483648.0,%fp0
62a2501075Smatt#endif
63a2501075Smatt#ifndef __SVR4_ABI__
64a2501075SmattLret:
65a2501075Smatt	fmoved	%fp0,-(%sp)
66a2501075Smatt	movel	(%sp)+,%d0
67a2501075Smatt	movel	(%sp)+,%d1
68a2501075Smatt#endif
69a2501075Smatt	rts
70a2501075SmattEND(__floatunsidf)
71