2 * Copyright (c) 2013 The NetBSD Foundation, Inc.
5 * This code is derived from software contributed to The NetBSD Foundation
6 * by Matt Thomas of 3am Software Foundry.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
18 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
21 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 * POSSIBILITY OF SUCH DAMAGE.
32 RCSID("$NetBSD: vfpdf.S,v 1.2 2013/06/23 06:19:55 matt Exp $")
35 * This file provides softfloat compatible routines which use VFP instructions
36 * to do the actual work. This should give near hard-float performance while
37 * being compatible with soft-float code.
39 * This file implements the double precision floating point routines.
43 #define vmov_arg0 vmov d0, r0, r1
44 #define vmov_arg1 vmov d1, r2, r3
45 #define vmov_ret vmov r0, r1, d0
47 #define vmov_arg0 vmov d0, r1, r0
48 #define vmov_arg1 vmov d1, r3, r2
49 #define vmov_ret vmov r1, r0, d0
51 #define vmov_args vmov_arg0; vmov_arg1
54 #define __adddf3 __aeabi_dadd
55 #define __divdf3 __aeabi_ddiv
56 #define __muldf3 __aeabi_dmul
57 #define __subdf3 __aeabi_dsub
58 #define __negdf2 __aeabi_dneg
59 #define __extendsfdf2 __aeabi_f2d
60 #define __fixdfsi __aeabi_d2iz
61 #define __fixunsdfsi __aeabi_d2uiz
62 #define __floatsidf __aeabi_i2d
63 #define __floatunsidf __aeabi_ui2d
146 * Effect of a floating point comparision on the condition flags.
154 ENTRY(__aeabi_cdcmpeq)
157 vmrs APSR_nzcv, fpscr
161 ENTRY(__aeabi_cdcmple)
164 vmrs APSR_nzcv, fpscr
168 ENTRY(__aeabi_cdrcmple)
171 vmrs APSR_nzcv, fpscr
173 END(__aeabi_cdrcmple)
175 ENTRY(__aeabi_dcmpeq)
178 vmrs APSR_nzcv, fpscr
179 moveq r0, #1 /* (a == b) */
180 movne r0, #0 /* (a != b) or unordered */
184 ENTRY(__aeabi_dcmplt)
187 vmrs APSR_nzcv, fpscr
188 movlt r0, #1 /* (a < b) */
189 movcs r0, #0 /* (a >= b) or unordered */
193 ENTRY(__aeabi_dcmple)
196 vmrs APSR_nzcv, fpscr
197 movls r0, #1 /* (a <= b) */
198 movhi r0, #0 /* (a > b) or unordered */
202 ENTRY(__aeabi_dcmpge)
205 vmrs APSR_nzcv, fpscr
206 movge r0, #1 /* (a >= b) */
207 movlt r0, #0 /* (a < b) or unordered */
211 ENTRY(__aeabi_dcmpgt)
214 vmrs APSR_nzcv, fpscr
215 movgt r0, #1 /* (a > b) */
216 movle r0, #0 /* (a <= b) or unordered */
220 ENTRY(__aeabi_dcmpun)
223 vmrs APSR_nzcv, fpscr
224 movvs r0, #1 /* (isnan(a) || isnan(b)) */
225 movvc r0, #0 /* !isnan(a) && !isnan(b) */
230 /* N set if compare <= result */
231 /* Z set if compare = result */
232 /* C set if compare (=,>=,UNORD) result */
233 /* V set if compare UNORD result */
235 STRONG_ALIAS(__eqdf2, __nedf2)
239 vmrs APSR_nzcv, fpscr
240 moveq r0, #0 /* !(a == b) */
241 movne r0, #1 /* !(a == b) */
245 STRONG_ALIAS(__gedf2, __ltdf2)
249 vmrs APSR_nzcv, fpscr
250 mvnmi r0, #0 /* -(a < b) */
251 movpl r0, #0 /* -(a < b) */
255 STRONG_ALIAS(__gtdf2, __ledf2)
259 vmrs APSR_nzcv, fpscr
260 movgt r0, #1 /* (a > b) */
261 movle r0, #0 /* (a > b) */
268 vmrs APSR_nzcv, fpscr
269 movvs r0, #1 /* isnan(a) || isnan(b) */
270 movvc r0, #0 /* isnan(a) || isnan(b) */
273 #endif /* !__ARM_EABI__ */