1 /* Copyright (C) 2008-2013 Free Software Foundation, Inc.
2 Contributor: Joern Rennecke <joern.rennecke@embecosm.com>
3 on behalf of Synopsys Inc.
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 3, or (at your option) any later
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 Under Section 7 of GPL version 3, you are granted additional
18 permissions described in the GCC Runtime Library Exception, version
19 3.1, as published by the Free Software Foundation.
21 You should have received a copy of the GNU General Public License and
22 a copy of the GCC Runtime Library Exception along with this program;
23 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
24 <http://www.gnu.org/licenses/>. */
26 #include "../arc-ieee-754.h"
46 bic.f 0,0x7f800000,r12 ; both NaN -> OK
50 #define __divsf3 __divsf3_asm
54 __divdf3_support: /* This label makes debugger output saner. */
57 norm.f r12,r2 ; flag for 0/x -> 0 check
58 bic.ne.f 0,0x60000000,r1 ; denorm/large number -> 0
65 bne.d .Lpast_denorm_fp0
67 /* r0 is subnormal, r1 is subnormal or 0. */
71 norm.f r12,r3 ; flag for x/0 -> Inf check
72 bic.ne.f 0,0x60000000,r0 ; large number/denorm -> Inf
82 bclr.f 0,r1,31 ; 0/0 -> NaN
89 bic.f 0,r9,r1 ; fp1 Inf -> result NaN
90 bic r1,r5,r9 ; fp1 sign
95 bic r0,r4,r9 ; fp0 sign
96 bmsk.f 0,r1,22 ; x/inf -> 0, x/nan -> nan
103 .long 0x7f800000 ; exponent mask
111 breq.d r11,0,.Ldenorm_fp0
113 breq r11,r9,.Linf_nan_fp0
116 breq r11,0,.Ldenorm_fp1
117 breq r11,r9,.Linf_nan_fp1
125 bclr r8,r9,30 ; exponent bias
126 bclr.lo r8,r8,23 ; reduce exp by one if fraction is shifted
133 sub_s r2,r2,r3 ; discard implicit 1
134 rsub r3,r3,1 ; prime r3 for two-insn divide-step use
171 tst r1,-0x7e ; 0xffffff82, test for rest or odd
173 add_s r0,r0,r2 ; assemble fraction
174 add_s r0,r0,r4 ; add in sign & exponent
176 add.ne r0,r0,r1 ; round to nearest / even
194 add r1,pcl,68; .Ldenorm_tab-.
201 .short .Ldenorm_tab-.Lret_r4
202 .short .Ldenorm_tab-.Ldiv_0bit
203 .short .Ldenorm_tab-.Ldiv_3bit-2*8
204 .short .Ldenorm_tab-.Ldiv_3bit-1*8
205 .short .Ldenorm_tab-.Ldiv_3bit
206 .short .Ldenorm_tab-.Ldiv_10bit-6*8
207 .short .Ldenorm_tab-.Ldiv_10bit-5*8
208 .short .Ldenorm_tab-.Ldiv_10bit-3*8
209 .short .Ldenorm_tab-.Ldiv_10bit-3*8
210 .short .Ldenorm_tab-.Ldiv_10bit-2*8
211 .short .Ldenorm_tab-.Ldiv_10bit-1*8
212 .short .Ldenorm_tab-.Ldiv_10bit
213 .short .Ldenorm_tab-.Ldiv_17bit-6*8
214 .short .Ldenorm_tab-.Ldiv_17bit-5*8
215 .short .Ldenorm_tab-.Ldiv_17bit-4*8
216 .short .Ldenorm_tab-.Ldiv_17bit-3*8
217 .short .Ldenorm_tab-.Ldiv_17bit-2*8
218 .short .Ldenorm_tab-.Ldiv_17bit-1*8
219 .short .Ldenorm_tab-.Ldiv_17bit
220 .short .Ldenorm_tab-.Ldiv_23bit-5*8
221 .short .Ldenorm_tab-.Ldiv_23bit-4*8
222 .short .Ldenorm_tab-.Ldiv_23bit-3*8
223 .short .Ldenorm_tab-.Ldiv_23bit-2*8
224 .short .Ldenorm_tab-.Ldiv_23bit-1*8
226 .short .Ldenorm_tab-.Ldiv_23bit