aarch64/fpu: Add vector variants of tanh
[glibc.git] / sysdeps / hppa / udiv_qrnnd.S
blob78bd05dada1b8d88a692c0b065422fbd78525673
1 ;! HP-PA  __udiv_qrnnd division support, used from longlong.h.
2 ;! This version runs fast on pre-PA7000 CPUs.
4 ;! Copyright (C) 1993-2024 Free Software Foundation, Inc.
6 ;! This file is part of the GNU MP Library.
8 ;! The GNU MP Library is free software; you can redistribute it and/or modify
9 ;! it under the terms of the GNU Lesser General Public License as published by
10 ;! the Free Software Foundation; either version 2.1 of the License, or (at your
11 ;! option) any later version.
13 ;! The GNU MP Library is distributed in the hope that it will be useful, but
14 ;! WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 ;! or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
16 ;! License for more details.
18 ;! You should have received a copy of the GNU Lesser General Public License
19 ;! along with the GNU MP Library.  If not, see
20 ;! <https://www.gnu.org/licenses/>.
23 ;! INPUT PARAMETERS
24 ;! rem_ptr      gr26
25 ;! n1           gr25
26 ;! n0           gr24
27 ;! d            gr23
29 ;! The code size is a bit excessive.  We could merge the last two ds;addc
30 ;! sequences by simply moving the "bb,< Odd" instruction down.  The only
31 ;! trouble is the FFFFFFFF code that would need some hacking.
33         .text
34         .export         __udiv_qrnnd
35 __udiv_qrnnd:
36         .proc
37         .callinfo       frame=0,no_calls
38         .entry
40         comb,<          %r23,%r0,L$largedivisor
41          sub            %r0,%r23,%r1            ;! clear cy as side-effect
42         ds              %r0,%r1,%r0
43         addc            %r24,%r24,%r24
44         ds              %r25,%r23,%r25
45         addc            %r24,%r24,%r24
46         ds              %r25,%r23,%r25
47         addc            %r24,%r24,%r24
48         ds              %r25,%r23,%r25
49         addc            %r24,%r24,%r24
50         ds              %r25,%r23,%r25
51         addc            %r24,%r24,%r24
52         ds              %r25,%r23,%r25
53         addc            %r24,%r24,%r24
54         ds              %r25,%r23,%r25
55         addc            %r24,%r24,%r24
56         ds              %r25,%r23,%r25
57         addc            %r24,%r24,%r24
58         ds              %r25,%r23,%r25
59         addc            %r24,%r24,%r24
60         ds              %r25,%r23,%r25
61         addc            %r24,%r24,%r24
62         ds              %r25,%r23,%r25
63         addc            %r24,%r24,%r24
64         ds              %r25,%r23,%r25
65         addc            %r24,%r24,%r24
66         ds              %r25,%r23,%r25
67         addc            %r24,%r24,%r24
68         ds              %r25,%r23,%r25
69         addc            %r24,%r24,%r24
70         ds              %r25,%r23,%r25
71         addc            %r24,%r24,%r24
72         ds              %r25,%r23,%r25
73         addc            %r24,%r24,%r24
74         ds              %r25,%r23,%r25
75         addc            %r24,%r24,%r24
76         ds              %r25,%r23,%r25
77         addc            %r24,%r24,%r24
78         ds              %r25,%r23,%r25
79         addc            %r24,%r24,%r24
80         ds              %r25,%r23,%r25
81         addc            %r24,%r24,%r24
82         ds              %r25,%r23,%r25
83         addc            %r24,%r24,%r24
84         ds              %r25,%r23,%r25
85         addc            %r24,%r24,%r24
86         ds              %r25,%r23,%r25
87         addc            %r24,%r24,%r24
88         ds              %r25,%r23,%r25
89         addc            %r24,%r24,%r24
90         ds              %r25,%r23,%r25
91         addc            %r24,%r24,%r24
92         ds              %r25,%r23,%r25
93         addc            %r24,%r24,%r24
94         ds              %r25,%r23,%r25
95         addc            %r24,%r24,%r24
96         ds              %r25,%r23,%r25
97         addc            %r24,%r24,%r24
98         ds              %r25,%r23,%r25
99         addc            %r24,%r24,%r24
100         ds              %r25,%r23,%r25
101         addc            %r24,%r24,%r24
102         ds              %r25,%r23,%r25
103         addc            %r24,%r24,%r24
104         ds              %r25,%r23,%r25
105         addc            %r24,%r24,%r28
106         ds              %r25,%r23,%r25
107         comclr,>=       %r25,%r0,%r0
108         addl            %r25,%r23,%r25
109         stws            %r25,0(%r26)
110         bv              0(%r2)
111          addc           %r28,%r28,%r28
113 L$largedivisor:
114         extru           %r24,31,1,%r20          ;! r20 = n0 & 1
115         bb,<            %r23,31,L$odd
116          extru          %r23,30,31,%r22         ;! r22 = d >> 1
117         shd             %r25,%r24,1,%r24        ;! r24 = new n0
118         extru           %r25,30,31,%r25         ;! r25 = new n1
119         sub             %r0,%r22,%r21
120         ds              %r0,%r21,%r0
121         addc            %r24,%r24,%r24
122         ds              %r25,%r22,%r25
123         addc            %r24,%r24,%r24
124         ds              %r25,%r22,%r25
125         addc            %r24,%r24,%r24
126         ds              %r25,%r22,%r25
127         addc            %r24,%r24,%r24
128         ds              %r25,%r22,%r25
129         addc            %r24,%r24,%r24
130         ds              %r25,%r22,%r25
131         addc            %r24,%r24,%r24
132         ds              %r25,%r22,%r25
133         addc            %r24,%r24,%r24
134         ds              %r25,%r22,%r25
135         addc            %r24,%r24,%r24
136         ds              %r25,%r22,%r25
137         addc            %r24,%r24,%r24
138         ds              %r25,%r22,%r25
139         addc            %r24,%r24,%r24
140         ds              %r25,%r22,%r25
141         addc            %r24,%r24,%r24
142         ds              %r25,%r22,%r25
143         addc            %r24,%r24,%r24
144         ds              %r25,%r22,%r25
145         addc            %r24,%r24,%r24
146         ds              %r25,%r22,%r25
147         addc            %r24,%r24,%r24
148         ds              %r25,%r22,%r25
149         addc            %r24,%r24,%r24
150         ds              %r25,%r22,%r25
151         addc            %r24,%r24,%r24
152         ds              %r25,%r22,%r25
153         addc            %r24,%r24,%r24
154         ds              %r25,%r22,%r25
155         addc            %r24,%r24,%r24
156         ds              %r25,%r22,%r25
157         addc            %r24,%r24,%r24
158         ds              %r25,%r22,%r25
159         addc            %r24,%r24,%r24
160         ds              %r25,%r22,%r25
161         addc            %r24,%r24,%r24
162         ds              %r25,%r22,%r25
163         addc            %r24,%r24,%r24
164         ds              %r25,%r22,%r25
165         addc            %r24,%r24,%r24
166         ds              %r25,%r22,%r25
167         addc            %r24,%r24,%r24
168         ds              %r25,%r22,%r25
169         addc            %r24,%r24,%r24
170         ds              %r25,%r22,%r25
171         addc            %r24,%r24,%r24
172         ds              %r25,%r22,%r25
173         addc            %r24,%r24,%r24
174         ds              %r25,%r22,%r25
175         addc            %r24,%r24,%r24
176         ds              %r25,%r22,%r25
177         addc            %r24,%r24,%r24
178         ds              %r25,%r22,%r25
179         addc            %r24,%r24,%r24
180         ds              %r25,%r22,%r25
181         addc            %r24,%r24,%r24
182         ds              %r25,%r22,%r25
183         addc            %r24,%r24,%r24
184         ds              %r25,%r22,%r25
185         comclr,>=       %r25,%r0,%r0
186         addl            %r25,%r22,%r25
187         sh1addl         %r25,%r20,%r25
188         stws            %r25,0(%r26)
189         bv              0(%r2)
190          addc           %r24,%r24,%r28
192 L$odd:  addib,sv,n      1,%r22,L$FF..           ;! r22 = (d / 2 + 1)
193         shd             %r25,%r24,1,%r24        ;! r24 = new n0
194         extru           %r25,30,31,%r25         ;! r25 = new n1
195         sub             %r0,%r22,%r21
196         ds              %r0,%r21,%r0
197         addc            %r24,%r24,%r24
198         ds              %r25,%r22,%r25
199         addc            %r24,%r24,%r24
200         ds              %r25,%r22,%r25
201         addc            %r24,%r24,%r24
202         ds              %r25,%r22,%r25
203         addc            %r24,%r24,%r24
204         ds              %r25,%r22,%r25
205         addc            %r24,%r24,%r24
206         ds              %r25,%r22,%r25
207         addc            %r24,%r24,%r24
208         ds              %r25,%r22,%r25
209         addc            %r24,%r24,%r24
210         ds              %r25,%r22,%r25
211         addc            %r24,%r24,%r24
212         ds              %r25,%r22,%r25
213         addc            %r24,%r24,%r24
214         ds              %r25,%r22,%r25
215         addc            %r24,%r24,%r24
216         ds              %r25,%r22,%r25
217         addc            %r24,%r24,%r24
218         ds              %r25,%r22,%r25
219         addc            %r24,%r24,%r24
220         ds              %r25,%r22,%r25
221         addc            %r24,%r24,%r24
222         ds              %r25,%r22,%r25
223         addc            %r24,%r24,%r24
224         ds              %r25,%r22,%r25
225         addc            %r24,%r24,%r24
226         ds              %r25,%r22,%r25
227         addc            %r24,%r24,%r24
228         ds              %r25,%r22,%r25
229         addc            %r24,%r24,%r24
230         ds              %r25,%r22,%r25
231         addc            %r24,%r24,%r24
232         ds              %r25,%r22,%r25
233         addc            %r24,%r24,%r24
234         ds              %r25,%r22,%r25
235         addc            %r24,%r24,%r24
236         ds              %r25,%r22,%r25
237         addc            %r24,%r24,%r24
238         ds              %r25,%r22,%r25
239         addc            %r24,%r24,%r24
240         ds              %r25,%r22,%r25
241         addc            %r24,%r24,%r24
242         ds              %r25,%r22,%r25
243         addc            %r24,%r24,%r24
244         ds              %r25,%r22,%r25
245         addc            %r24,%r24,%r24
246         ds              %r25,%r22,%r25
247         addc            %r24,%r24,%r24
248         ds              %r25,%r22,%r25
249         addc            %r24,%r24,%r24
250         ds              %r25,%r22,%r25
251         addc            %r24,%r24,%r24
252         ds              %r25,%r22,%r25
253         addc            %r24,%r24,%r24
254         ds              %r25,%r22,%r25
255         addc            %r24,%r24,%r24
256         ds              %r25,%r22,%r25
257         addc            %r24,%r24,%r24
258         ds              %r25,%r22,%r25
259         addc            %r24,%r24,%r24
260         ds              %r25,%r22,%r25
261         addc            %r24,%r24,%r28
262         comclr,>=       %r25,%r0,%r0
263         addl            %r25,%r22,%r25
264         sh1addl         %r25,%r20,%r25
265 ;! We have computed (n1,,n0) / (d + 1), q' = r28, r' = r25
266         add,nuv         %r28,%r25,%r25
267         addl            %r25,%r1,%r25
268         addc            %r0,%r28,%r28
269         sub,<<          %r25,%r23,%r0
270         addl            %r25,%r1,%r25
271         stws            %r25,0(%r26)
272         bv              0(%r2)
273          addc           %r0,%r28,%r28
275 ;! This is just a special case of the code above.
276 ;! We come here when d == 0xFFFFFFFF
277 L$FF..: add,uv          %r25,%r24,%r24
278         sub,<<          %r24,%r23,%r0
279         ldo             1(%r24),%r24
280         stws            %r24,0(%r26)
281         bv              0(%r2)
282          addc           %r0,%r25,%r28
284         .exit
285         .procend