aeabi_float.c revision 245655
1193323Sed/*
2193323Sed * Copyright (C) 2012 Andrew Turner
3193323Sed * All rights reserved.
4193323Sed *
5193323Sed * Redistribution and use in source and binary forms, with or without
6193323Sed * modification, are permitted provided that the following conditions
7193323Sed * are met:
8193323Sed * 1. Redistributions of source code must retain the above copyright
9193323Sed *    notice, this list of conditions and the following disclaimer.
10193323Sed * 2. Redistributions in binary form must reproduce the above copyright
11193323Sed *    notice, this list of conditions and the following disclaimer in the
12193323Sed *    documentation and/or other materials provided with the distribution.
13193323Sed *
14193323Sed * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15193323Sed * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16193323Sed * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17193323Sed * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18193323Sed * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19193323Sed * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20193323Sed * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21193323Sed * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22193323Sed * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23193323Sed * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24193323Sed * SUCH DAMAGE.
25193323Sed *
26193323Sed */
27210299Sed
28210299Sed#include <sys/cdefs.h>
29210299Sed__FBSDID("$FreeBSD: head/lib/libc/arm/aeabi/aeabi_float.c 245655 2013-01-19 05:33:55Z andrew $");
30210299Sed
31210299Sed#include "softfloat-for-gcc.h"
32210299Sed#include "milieu.h"
33210299Sed#include "softfloat.h"
34210299Sed
35210299Sedflag __unordsf2(float32, float32);
36210299Sed
37210299Sedint __aeabi_fcmpeq(float32 a, float32 b)
38210299Sed{
39210299Sed	return float32_eq(a, b);
40210299Sed}
41210299Sed
42210299Sedint __aeabi_fcmplt(float32 a, float32 b)
43210299Sed{
44210299Sed	return float32_lt(a, b);
45193323Sed}
46193323Sed
47193323Sedint __aeabi_fcmple(float32 a, float32 b)
48193323Sed{
49193323Sed	return float32_le(a, b);
50193323Sed}
51193323Sed
52193323Sedint __aeabi_fcmpge(float32 a, float32 b)
53193323Sed{
54193323Sed	return float32_le(b, a);
55193323Sed}
56193323Sed
57193323Sedint __aeabi_fcmpgt(float32 a, float32 b)
58193323Sed{
59193323Sed	return float32_lt(b, a);
60193323Sed}
61193323Sed
62193323Sedint __aeabi_fcmpun(float32 a, float32 b)
63193323Sed{
64193323Sed	return __unordsf2(a, b);
65193323Sed}
66193323Sed
67193323Sedint __aeabi_f2iz(float32 a)
68193323Sed{
69193323Sed	return float32_to_int32_round_to_zero(a);
70193323Sed}
71193323Sed
72193323Sedfloat32 __aeabi_f2d(float32 a)
73193323Sed{
74193323Sed	return float32_to_float64(a);
75193323Sed}
76193323Sed
77193323Sedfloat32 __aeabi_i2f(int a)
78193323Sed{
79193323Sed	return int32_to_float32(a);
80193323Sed}
81193323Sed
82193323Sedfloat32 __aeabi_fadd(float32 a, float32 b)
83193323Sed{
84193323Sed	return float32_add(a, b);
85193323Sed}
86193323Sed
87193323Sedfloat32 __aeabi_fdiv(float32 a, float32 b)
88193323Sed{
89198090Srdivacky	return float32_div(a, b);
90198090Srdivacky}
91193323Sed
92195098Sedfloat32 __aeabi_fmul(float32 a, float32 b)
93195098Sed{
94198090Srdivacky	return float32_mul(a, b);
95195098Sed}
96195098Sed
97195098Sedfloat32 __aeabi_fsub(float32 a, float32 b)
98195098Sed{
99198090Srdivacky	return float32_sub(a, b);
100195098Sed}
101195098Sed
102195098Sed