aeabi_float.c revision 266314
119304Speter/*
219304Speter * Copyright (C) 2012 Andrew Turner
319304Speter * All rights reserved.
419304Speter *
519304Speter * Redistribution and use in source and binary forms, with or without
619304Speter * modification, are permitted provided that the following conditions
719304Speter * are met:
819304Speter * 1. Redistributions of source code must retain the above copyright
919304Speter *    notice, this list of conditions and the following disclaimer.
1019304Speter * 2. Redistributions in binary form must reproduce the above copyright
1119304Speter *    notice, this list of conditions and the following disclaimer in the
1219304Speter *    documentation and/or other materials provided with the distribution.
13254225Speter *
1419304Speter * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1519304Speter * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1619304Speter * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1719304Speter * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1819304Speter * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1919304Speter * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2019304Speter * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2119304Speter * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2219304Speter * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2319304Speter * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2419304Speter * SUCH DAMAGE.
2519304Speter *
2619304Speter */
2719304Speter
2819304Speter#include <sys/cdefs.h>
2919304Speter__FBSDID("$FreeBSD: stable/10/lib/libc/arm/aeabi/aeabi_float.c 266314 2014-05-17 14:22:37Z ian $");
3019304Speter
3119304Speter#include "softfloat-for-gcc.h"
3219304Speter#include "milieu.h"
3319304Speter#include "softfloat.h"
3419304Speter
3519304Speter#include "aeabi_vfp.h"
36254225Speter
3719304Speterextern int _libc_arm_fpu_present;
3819304Speter
3919304Speterflag __unordsf2(float32, float32);
4019304Speter
4119304Speter/* These are written in asm and are only called from this file */
4219304Speterint __aeabi_fcmpeq_vfp(float32, float32);
4319304Speterint __aeabi_fcmplt_vfp(float32, float32);
4419304Speterint __aeabi_fcmple_vfp(float32, float32);
4519304Speterint __aeabi_fcmpgt_vfp(float32, float32);
4619304Speterint __aeabi_fcmpge_vfp(float32, float32);
4719304Speterint __aeabi_fcmpun_vfp(float32, float32);
4819304Speterint __aeabi_f2iz_vfp(float32);
4919304Speterfloat64 __aeabi_f2d_vfp(float32);
5019304Speterfloat32 __aeabi_i2f_vfp(int);
5119304Speterfloat32 __aeabi_fadd_vfp(float32, float32);
5219304Speterfloat32 __aeabi_fdiv_vfp(float32, float32);
5319304Speterfloat32 __aeabi_fmul_vfp(float32, float32);
5419304Speterfloat32 __aeabi_fsub_vfp(float32, float32);
5519304Speter
5619304Speter/*
5719304Speter * Depending on the target these will:
5819304Speter *  On armv6 with a vfp call the above function, or
5919304Speter *  Call the softfloat function in the 3rd argument.
6019304Speter */
6119304Speterint AEABI_FUNC2(fcmpeq, float32, float32_eq)
6219304Speterint AEABI_FUNC2(fcmplt, float32, float32_lt)
6319304Speterint AEABI_FUNC2(fcmple, float32, float32_le)
6419304Speterint AEABI_FUNC2_REV(fcmpge, float32, float32_le)
6519304Speterint AEABI_FUNC2_REV(fcmpgt, float32, float32_lt)
6619304Speterint AEABI_FUNC2(fcmpun, float32, __unordsf2)
67254225Speter
6819304Speterint AEABI_FUNC(f2iz, float32, float32_to_int32_round_to_zero)
6919304Speterfloat64 AEABI_FUNC(f2d, float32, float32_to_float64)
7019304Speterfloat32 AEABI_FUNC(i2f, int, int32_to_float32)
7119304Speter
7219304Speterfloat32 AEABI_FUNC2(fadd, float32, float32_add)
7319304Speterfloat32 AEABI_FUNC2(fdiv, float32, float32_div)
7419304Speterfloat32 AEABI_FUNC2(fmul, float32, float32_mul)
7519304Speterfloat32 AEABI_FUNC2(fsub, float32, float32_sub)
7619304Speter
7719304Speter