1245655Sandrew/*
2245655Sandrew * Copyright (C) 2012 Andrew Turner
3245655Sandrew * All rights reserved.
4245655Sandrew *
5245655Sandrew * Redistribution and use in source and binary forms, with or without
6245655Sandrew * modification, are permitted provided that the following conditions
7245655Sandrew * are met:
8245655Sandrew * 1. Redistributions of source code must retain the above copyright
9245655Sandrew *    notice, this list of conditions and the following disclaimer.
10245655Sandrew * 2. Redistributions in binary form must reproduce the above copyright
11245655Sandrew *    notice, this list of conditions and the following disclaimer in the
12245655Sandrew *    documentation and/or other materials provided with the distribution.
13245655Sandrew *
14245655Sandrew * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15245655Sandrew * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16245655Sandrew * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17245655Sandrew * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18245655Sandrew * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19245655Sandrew * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20245655Sandrew * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21245655Sandrew * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22245655Sandrew * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23245655Sandrew * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24245655Sandrew * SUCH DAMAGE.
25245655Sandrew *
26245655Sandrew */
27245655Sandrew
28245655Sandrew#include <sys/cdefs.h>
29245655Sandrew__FBSDID("$FreeBSD$");
30245655Sandrew
31245655Sandrew#include "softfloat-for-gcc.h"
32245655Sandrew#include "milieu.h"
33245655Sandrew#include "softfloat.h"
34245655Sandrew
35266314Sian#include "aeabi_vfp.h"
36245655Sandrew
37266314Sianextern int _libc_arm_fpu_present;
38245655Sandrew
39266314Sianflag __unorddf2(float64, float64);
40245655Sandrew
41266314Sian/* These are written in asm and are only called from this file */
42266314Sianint __aeabi_dcmpeq_vfp(float64, float64);
43266314Sianint __aeabi_dcmplt_vfp(float64, float64);
44266314Sianint __aeabi_dcmple_vfp(float64, float64);
45266314Sianint __aeabi_dcmpgt_vfp(float64, float64);
46266314Sianint __aeabi_dcmpge_vfp(float64, float64);
47266314Sianint __aeabi_dcmpun_vfp(float64, float64);
48266314Sianint __aeabi_d2iz_vfp(float64);
49266314Sianfloat32 __aeabi_d2f_vfp(float64);
50266314Sianfloat64 __aeabi_i2d_vfp(int);
51266314Sianfloat64 __aeabi_dadd_vfp(float64, float64);
52266314Sianfloat64 __aeabi_ddiv_vfp(float64, float64);
53266314Sianfloat64 __aeabi_dmul_vfp(float64, float64);
54266314Sianfloat64 __aeabi_dsub_vfp(float64, float64);
55245655Sandrew
56266314Sian/*
57266314Sian * Depending on the target these will:
58266314Sian *  On armv6 with a vfp call the above function, or
59266314Sian *  Call the softfloat function in the 3rd argument.
60266314Sian */
61266314Sianint AEABI_FUNC2(dcmpeq, float64, float64_eq)
62266314Sianint AEABI_FUNC2(dcmplt, float64, float64_lt)
63266314Sianint AEABI_FUNC2(dcmple, float64, float64_le)
64266314Sianint AEABI_FUNC2_REV(dcmpge, float64, float64_le)
65266314Sianint AEABI_FUNC2_REV(dcmpgt, float64, float64_lt)
66266314Sianint AEABI_FUNC2(dcmpun, float64, __unorddf2)
67245655Sandrew
68266314Sianint AEABI_FUNC(d2iz, float64, float64_to_int32_round_to_zero)
69266314Sianfloat32 AEABI_FUNC(d2f, float64, float64_to_float32)
70266314Sianfloat64 AEABI_FUNC(i2d, int, int32_to_float64)
71245655Sandrew
72266314Sianfloat64 AEABI_FUNC2(dadd, float64, float64_add)
73266314Sianfloat64 AEABI_FUNC2(ddiv, float64, float64_div)
74266314Sianfloat64 AEABI_FUNC2(dmul, float64, float64_mul)
75266314Sianfloat64 AEABI_FUNC2(dsub, float64, float64_sub)
76245655Sandrew
77