1 /* Copyright (C) 2008-2019 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"
53 #define __divsf3 __divsf3_asm
57 __divdf3_support: /* This label makes debugger output saner. */
60 norm.f r12,r2 ; flag for 0/x -> 0 check
61 bic.ne.f 0,0x60000000,r1 ; denorm/large number -> 0
68 bne.d .Lpast_denorm_fp0
70 /* r0 is subnormal, r1 is subnormal or 0. */
74 norm.f r12,r3 ; flag for x/0 -> Inf check
75 bic.ne.f 0,0x60000000,r0 ; large number/denorm -> Inf
85 bclr.f 0,r1,31 ; 0/0 -> NaN
92 .long 0x7f800000 ; exponent mask
100 breq.d r11,0,.Ldenorm_fp0
102 breq r11,r9,.Linf_nan_fp0
105 breq r11,0,.Ldenorm_fp1
106 breq r11,r9,.Linf_nan_fp1
114 bclr r8,r9,30 ; exponent bias
115 bclr.lo r8,r8,23 ; reduce exp by one if fraction is shifted
122 sub_s r2,r2,r3 ; discard implicit 1
154 tst r1,-0x7e ; 0xffffff82, test for rest or odd
156 add_s r0,r0,r2 ; assemble fraction
157 add_s r0,r0,r4 ; add in sign & exponent
159 add.ne r0,r0,r1 ; round to nearest / even
163 bic.f 0,r9,r1 ; fp1 Inf -> result NaN
164 bic r1,r5,r9 ; fp1 sign
169 bic r0,r4,r9 ; fp0 sign
170 bmsk.f 0,r1,22 ; x/inf -> 0, x/nan -> nan
188 add r1,pcl,42; .Ldenorm_tab-.
195 .byte .Ldenorm_tab-.Lret_r4
196 .byte .Ldenorm_tab-.Ldiv_0bit
197 .byte .Ldenorm_tab-.Ldiv_3bit-8
198 .byte .Ldenorm_tab-.Ldiv_3bit-4
199 .byte .Ldenorm_tab-.Ldiv_3bit
200 .byte .Ldenorm_tab-.Ldiv_10bit-24
201 .byte .Ldenorm_tab-.Ldiv_10bit-20
202 .byte .Ldenorm_tab-.Ldiv_10bit-16
203 .byte .Ldenorm_tab-.Ldiv_10bit-12
204 .byte .Ldenorm_tab-.Ldiv_10bit-8
205 .byte .Ldenorm_tab-.Ldiv_10bit-4
206 .byte .Ldenorm_tab-.Ldiv_10bit
207 .byte .Ldenorm_tab-.Ldiv_17bit-24
208 .byte .Ldenorm_tab-.Ldiv_17bit-20
209 .byte .Ldenorm_tab-.Ldiv_17bit-16
210 .byte .Ldenorm_tab-.Ldiv_17bit-12
211 .byte .Ldenorm_tab-.Ldiv_17bit-8
212 .byte .Ldenorm_tab-.Ldiv_17bit-4
213 .byte .Ldenorm_tab-.Ldiv_17bit
214 .byte .Ldenorm_tab-.Ldiv_23bit-20
215 .byte .Ldenorm_tab-.Ldiv_23bit-16
216 .byte .Ldenorm_tab-.Ldiv_23bit-12
217 .byte .Ldenorm_tab-.Ldiv_23bit-8
218 .byte .Ldenorm_tab-.Ldiv_23bit-4
220 .byte .Ldenorm_tab-.Ldiv_23bit