]> git.ipfire.org Git - thirdparty/gcc.git/blame - libgcc/config/arc/ieee-754/arc600-mul64/mulsf3.S
Update copyright years.
[thirdparty/gcc.git] / libgcc / config / arc / ieee-754 / arc600-mul64 / mulsf3.S
CommitLineData
83ffe9cd 1/* Copyright (C) 2008-2023 Free Software Foundation, Inc.
d38a64b4
JR
2 Contributor: Joern Rennecke <joern.rennecke@embecosm.com>
3 on behalf of Synopsys Inc.
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify it under
8the terms of the GNU General Public License as published by the Free
9Software Foundation; either version 3, or (at your option) any later
10version.
11
12GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13WARRANTY; without even the implied warranty of MERCHANTABILITY or
14FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15for more details.
16
17Under Section 7 of GPL version 3, you are granted additional
18permissions described in the GCC Runtime Library Exception, version
193.1, as published by the Free Software Foundation.
20
21You should have received a copy of the GNU General Public License and
22a copy of the GCC Runtime Library Exception along with this program;
23see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
24<http://www.gnu.org/licenses/>. */
25
26#include "../arc-ieee-754.h"
27
28#if 0 /* DEBUG */
29 .global __mulsf3
30 FUNC(__mulsf3)
31 .balign 4
32__mulsf3:
33 push_s blink
34 push_s r1
35 bl.d __mulsf3_c
36 push_s r0
37 ld_s r1,[sp,4]
38 st_s r0,[sp,4]
39 bl.d __mulsf3_asm
40 pop_s r0
41 pop_s r1
42 pop_s blink
43 cmp r0,r1
44 jeq_s [blink]
45 and r12,r0,r1
46 bic.f 0,0x7f800000,r12
47 bne 0f
48 bmsk.f 0,r0,22
49 bmsk.ne.f r1,r1,22
50 jne_s [blink] ; both NaN -> OK
510: bl abort
52 ENDFUNC(__mulsf3)
53#define __mulsf3 __mulsf3_asm
54#endif /* DEBUG */
55
56 .balign 4
57 .global __mulsf3
58 FUNC(__mulsf3)
59__mulsf3:
60 ld.as r9,[pcl,80]; [pcl,((.L7f800000-.+2)/4)]
61 bmsk r4,r1,22
62 bset r2,r0,23
63 asl_s r2,r2,8
64 bset r3,r4,23
65 mulu64 r2,r3
66 and r11,r0,r9
67 breq.d r11,0,.Ldenorm_dbl0
68 and r12,r1,r9
69 breq.d r12,0,.Ldenorm_dbl1
70 xor_s r0,r0,r1
71 breq.d r11,r9,.Linf_nan_dbl0
72 ld.as r4,[pcl,70]; [pcl,((.L7fffffff-.+2)/4)]
73 breq.d r12,r9,.Linf_nan_dbl1
74.Lpast_denorm:
75 asl.f 0,mhi,8
76 mov r6,mhi
77 mov r7,mlo
78 add.pl r6,r6,r6
79 bclr.pl r6,r6,23
80 add.pl.f r7,r7,r7
81 add.cs r6,r6,1
82 lsr.f 0,r6,1
83 add_s r12,r12,r11
84 adc.f 0,r7,r4
85 add_s r12,r12, \
86 -0x3f800000
87 adc.f r8,r6,r12
88 tst.pl r8,r9
89 bic r0,r0,r4
90 min r3,r8,r9
91 jpnz.d [blink]
92 add.pnz r0,r0,r3
93; infinity or denormal number
94 add.ne.f r3,r3,r3
95 asr_s r3,r3,23+1
96 bset r6,r6,23
97 bpnz.d .Linfinity
98 sub_s r3,r3,1
99 neg_s r2,r3
100 brhi.d r2,24,.Lret_r0 ; right shift shift > 24 -> return +-0
101 lsr r2,r6,r2
102 asl r9,r6,r3
103 lsr.f 0,r2,1
104 tst r7,r7
105 add_s r0,r0,r2
106 bset.ne r9,r9,0
107 adc.f 0,r9,r4
108 j_s.d [blink]
109 add.cs r0,r0,1
110.Linfinity:
111 j_s.d [blink]
112 add_s r0,r0,r9
113
114.Lret_r0: j_s [blink]
115
116 .balign 4
117.Ldenorm_dbl0:
118 bclr_s r2,r2,31
119 norm.f r4,r2
120 add_s r2,r2,r2
121 asl r2,r2,r4
122 mulu64 r2,r3
123 breq.d r12,r9,.Ldenorm_dbl0_inf_nan_dbl1
124 asl r4,r4,23
125 sub.ne.f r12,r12,r4
126 ld.as r4,[pcl,29]; [pcl,((.L7fffffff-.+2)/4)]
127 bhi.d .Lpast_denorm
128 xor_s r0,r0,r1
129 bmsk r1,r0,30
130 j_s.d [blink]
131 bic_s r0,r0,r1
132
133 .balign 4
134.Ldenorm_dbl0_inf_nan_dbl1:
135 bmsk.f 0,r0,30
136 beq_s .Lretnan
137 xor_s r0,r0,r1
138.Linf_nan_dbl1:
139 xor_s r1,r1,r0
140.Linf_nan_dbl0:
141 bclr_s r1,r1,31
142 cmp_s r1,r9
143 jls.d [blink]
144 xor_s r0,r0,r1
145; r1 NaN -> result NaN
146.Lretnan:
147 j_s.d [blink]
148 mov r0,-1
149
150 .balign 4
151.Ldenorm_dbl1:
152 breq.d r11,r9,.Linf_nan_dbl0_2
153 norm.f r3,r4
154 sub_s r3,r3,7
155 asl r4,r4,r3
156 mulu64 r2,r4
157 sub_s r3,r3,1
158 asl_s r3,r3,23
159 sub.ne.f r11,r11,r3
160 ld.as r4,[pcl,11]; [pcl,((.L7fffffff-.+2)/4)]
161 bhi.d .Lpast_denorm
162 bmsk r8,r0,30
163 j_s.d [blink]
164 bic r0,r0,r8
165
166 .balign 4
167.Linf_nan_dbl0_2:
168 bclr_s r1,r1,31
169 xor_s r0,r0,r1
170 sub.eq r1,r1,1 ; inf/nan * 0 -> nan
171 bic.f 0,r9,r1
172 j_s.d [blink]
173 or.eq r0,r0,r1 ; r1 nan -> result nan
174
175 .balign 4
176.L7f800000:
177 .long 0x7f800000
178.L7fffffff:
179 .long 0x7fffffff
180 ENDFUNC(__mulsf3)