~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/m68k/fpsp040/stwotox.S

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /arch/m68k/fpsp040/stwotox.S (Version linux-6.12-rc7) and /arch/sparc64/fpsp040/stwotox.S (Version linux-4.15.18)


  1 |                                                 
  2 |       stwotox.sa 3.1 12/10/90                   
  3 |                                                 
  4 |       stwotox  --- 2**X                         
  5 |       stwotoxd --- 2**X for denormalized X      
  6 |       stentox  --- 10**X                        
  7 |       stentoxd --- 10**X for denormalized X     
  8 |                                                 
  9 |       Input: Double-extended number X in loc    
 10 |               by address register a0.           
 11 |                                                 
 12 |       Output: The function values are return    
 13 |                                                 
 14 |       Accuracy and Monotonicity: The returne    
 15 |               64 significant bit, i.e. withi    
 16 |               result is subsequently rounded    
 17 |               result is provably monotonic i    
 18 |                                                 
 19 |       Speed: The program stwotox takes appro    
 20 |               program stentox takes approxim    
 21 |                                                 
 22 |       Algorithm:                                
 23 |                                                 
 24 |       twotox                                    
 25 |       1. If |X| > 16480, go to ExpBig.          
 26 |                                                 
 27 |       2. If |X| < 2**(-70), go to ExpSm.        
 28 |                                                 
 29 |       3. Decompose X as X = N/64 + r where |    
 30 |               decompose N as                    
 31 |                N = 64(M + M') + j,  j = 0,1,    
 32 |                                                 
 33 |       4. Overwrite r := r * log2. Then          
 34 |               2**X = 2**(M') * 2**(M) * 2**(    
 35 |               Go to expr to compute that exp    
 36 |                                                 
 37 |       tentox                                    
 38 |       1. If |X| > 16480*log_10(2) (base 10 l    
 39 |                                                 
 40 |       2. If |X| < 2**(-70), go to ExpSm.        
 41 |                                                 
 42 |       3. Set y := X*log_2(10)*64 (base 2 log    
 43 |               N := round-to-int(y). Decompos    
 44 |                N = 64(M + M') + j,  j = 0,1,    
 45 |                                                 
 46 |       4. Define r as                            
 47 |               r := ((X - N*L1)-N*L2) * L10      
 48 |               where L1, L2 are the leading a    
 49 |               and L10 is the natural log of     
 50 |               10**X = 2**(M') * 2**(M) * 2**    
 51 |               Go to expr to compute that exp    
 52 |                                                 
 53 |       expr                                      
 54 |       1. Fetch 2**(j/64) from table as Fact1    
 55 |                                                 
 56 |       2. Overwrite Fact1 and Fact2 by           
 57 |               Fact1 := 2**(M) * Fact1           
 58 |               Fact2 := 2**(M) * Fact2           
 59 |               Thus Fact1 + Fact2 = 2**(M) *     
 60 |                                                 
 61 |       3. Calculate P where 1 + P approximate    
 62 |               P = r + r*r*(A1+r*(A2+...+r*A5    
 63 |                                                 
 64 |       4. Let AdjFact := 2**(M'). Return         
 65 |               AdjFact * ( Fact1 + ((Fact1*P)    
 66 |               Exit.                             
 67 |                                                 
 68 |       ExpBig                                    
 69 |       1. Generate overflow by Huge * Huge if    
 70 |               underflow by Tiny * Tiny.         
 71 |                                                 
 72 |       ExpSm                                     
 73 |       1. Return 1 + X.                          
 74 |                                                 
 75                                                   
 76 |               Copyright (C) Motorola, Inc. 1    
 77 |                       All Rights Reserved       
 78 |                                                 
 79 |       For details on the license for this fi    
 80 |       file, README, in this same directory.     
 81                                                   
 82 |STWOTOX        idnt    2,1 | Motorola 040 Flo    
 83                                                   
 84         |section        8                         
 85                                                   
 86 #include "fpsp.h"                                 
 87                                                   
 88 BOUNDS1:        .long 0x3FB98000,0x400D80C0 |     
 89 BOUNDS2:        .long 0x3FB98000,0x400B9B07 |     
 90                                                   
 91 L2TEN64:        .long 0x406A934F,0x0979A371 |     
 92 L10TWO1:        .long 0x3F734413,0x509F8000 |     
 93                                                   
 94 L10TWO2:        .long 0xBFCD0000,0xC0219DC1,0x    
 95                                                   
 96 LOG10:  .long 0x40000000,0x935D8DDD,0xAAA8AC17    
 97                                                   
 98 LOG2:   .long 0x3FFE0000,0xB17217F7,0xD1CF79AC    
 99                                                   
100 EXPA5:  .long 0x3F56C16D,0x6F7BD0B2               
101 EXPA4:  .long 0x3F811112,0x302C712C               
102 EXPA3:  .long 0x3FA55555,0x55554CC1               
103 EXPA2:  .long 0x3FC55555,0x55554A54               
104 EXPA1:  .long 0x3FE00000,0x00000000,0x00000000    
105                                                   
106 HUGE:   .long 0x7FFE0000,0xFFFFFFFF,0xFFFFFFFF    
107 TINY:   .long 0x00010000,0xFFFFFFFF,0xFFFFFFFF    
108                                                   
109 EXPTBL:                                           
110         .long  0x3FFF0000,0x80000000,0x0000000    
111         .long  0x3FFF0000,0x8164D1F3,0xBC03077    
112         .long  0x3FFF0000,0x82CD8698,0xAC2BA1D    
113         .long  0x3FFF0000,0x843A28C3,0xACDE404    
114         .long  0x3FFF0000,0x85AAC367,0xCC487B1    
115         .long  0x3FFF0000,0x871F6196,0x9E8D101    
116         .long  0x3FFF0000,0x88980E80,0x92DA852    
117         .long  0x3FFF0000,0x8A14D575,0x496EFD9    
118         .long  0x3FFF0000,0x8B95C1E3,0xEA8BD6E    
119         .long  0x3FFF0000,0x8D1ADF5B,0x7E5BA9E    
120         .long  0x3FFF0000,0x8EA4398B,0x45CD53C    
121         .long  0x3FFF0000,0x9031DC43,0x1466B1D    
122         .long  0x3FFF0000,0x91C3D373,0xAB11C33    
123         .long  0x3FFF0000,0x935A2B2F,0x13E6E92    
124         .long  0x3FFF0000,0x94F4EFA8,0xFEF7096    
125         .long  0x3FFF0000,0x96942D37,0x20185A0    
126         .long  0x3FFF0000,0x9837F051,0x8DB8A96    
127         .long  0x3FFF0000,0x99E04593,0x20B7FA6    
128         .long  0x3FFF0000,0x9B8D39B9,0xD54E553    
129         .long  0x3FFF0000,0x9D3ED9A7,0x2CFFB75    
130         .long  0x3FFF0000,0x9EF53260,0x91A111A    
131         .long  0x3FFF0000,0xA0B0510F,0xB9714FC    
132         .long  0x3FFF0000,0xA2704303,0x0C49681    
133         .long  0x3FFF0000,0xA43515AE,0x09E6809    
134         .long  0x3FFF0000,0xA5FED6A9,0xB15138E    
135         .long  0x3FFF0000,0xA7CD93B4,0xE965356    
136         .long  0x3FFF0000,0xA9A15AB4,0xEA7C0EF    
137         .long  0x3FFF0000,0xAB7A39B5,0xA93ED33    
138         .long  0x3FFF0000,0xAD583EEA,0x42A14AC    
139         .long  0x3FFF0000,0xAF3B78AD,0x690A437    
140         .long  0x3FFF0000,0xB123F581,0xD2AC259    
141         .long  0x3FFF0000,0xB311C412,0xA911248    
142         .long  0x3FFF0000,0xB504F333,0xF9DE648    
143         .long  0x3FFF0000,0xB6FD91E3,0x28D1779    
144         .long  0x3FFF0000,0xB8FBAF47,0x62FB9EE    
145         .long  0x3FFF0000,0xBAFF5AB2,0x133E45F    
146         .long  0x3FFF0000,0xBD08A39F,0x580C36B    
147         .long  0x3FFF0000,0xBF1799B6,0x7A73108    
148         .long  0x3FFF0000,0xC12C4CCA,0x6670945    
149         .long  0x3FFF0000,0xC346CCDA,0x2497640    
150         .long  0x3FFF0000,0xC5672A11,0x5506DAD    
151         .long  0x3FFF0000,0xC78D74C8,0xABB9B15    
152         .long  0x3FFF0000,0xC9B9BD86,0x6E2F27A    
153         .long  0x3FFF0000,0xCBEC14FE,0xF2727C5    
154         .long  0x3FFF0000,0xCE248C15,0x1F8480E    
155         .long  0x3FFF0000,0xD06333DA,0xEF2B259    
156         .long  0x3FFF0000,0xD2A81D91,0xF12AE45    
157         .long  0x3FFF0000,0xD4F35AAB,0xCFEDFA1    
158         .long  0x3FFF0000,0xD744FCCA,0xD69D6AF    
159         .long  0x3FFF0000,0xD99D15C2,0x78AFD7B    
160         .long  0x3FFF0000,0xDBFBB797,0xDAF2375    
161         .long  0x3FFF0000,0xDE60F482,0x5E0E912    
162         .long  0x3FFF0000,0xE0CCDEEC,0x2A94E11    
163         .long  0x3FFF0000,0xE33F8972,0xBE8A5A5    
164         .long  0x3FFF0000,0xE5B906E7,0x7C8348A    
165         .long  0x3FFF0000,0xE8396A50,0x3C4BDC6    
166         .long  0x3FFF0000,0xEAC0C6E7,0xDD24392    
167         .long  0x3FFF0000,0xED4F301E,0xD9942B8    
168         .long  0x3FFF0000,0xEFE4B99B,0xDCDAF5C    
169         .long  0x3FFF0000,0xF281773C,0x59FFB13    
170         .long  0x3FFF0000,0xF5257D15,0x2486CC2    
171         .long  0x3FFF0000,0xF7D0DF73,0x0AD13BB    
172         .long  0x3FFF0000,0xFA83B2DB,0x722A033    
173         .long  0x3FFF0000,0xFD3E0C0C,0xF486C17    
174                                                   
175         .set    N,L_SCR1                          
176                                                   
177         .set    X,FP_SCR1                         
178         .set    XDCARE,X+2                        
179         .set    XFRAC,X+4                         
180                                                   
181         .set    ADJFACT,FP_SCR2                   
182                                                   
183         .set    FACT1,FP_SCR3                     
184         .set    FACT1HI,FACT1+4                   
185         .set    FACT1LOW,FACT1+8                  
186                                                   
187         .set    FACT2,FP_SCR4                     
188         .set    FACT2HI,FACT2+4                   
189         .set    FACT2LOW,FACT2+8                  
190                                                   
191         | xref  t_unfl                            
192         |xref   t_ovfl                            
193         |xref   t_frcinx                          
194                                                   
195         .global stwotoxd                          
196 stwotoxd:                                         
197 |--ENTRY POINT FOR 2**(X) FOR DENORMALIZED ARG    
198                                                   
199         fmovel          %d1,%fpcr                 
200         fmoves          #0x3F800000,%fp0  | ..    
201         movel           (%a0),%d0                 
202         orl             #0x00800001,%d0           
203         fadds           %d0,%fp0                  
204         bra             t_frcinx                  
205                                                   
206         .global stwotox                           
207 stwotox:                                          
208 |--ENTRY POINT FOR 2**(X), HERE X IS FINITE, N    
209         fmovemx (%a0),%fp0-%fp0 | ...LOAD INPU    
210                                                   
211         movel           (%a0),%d0                 
212         movew           4(%a0),%d0                
213         fmovex          %fp0,X(%a6)               
214         andil           #0x7FFFFFFF,%d0           
215                                                   
216         cmpil           #0x3FB98000,%d0           
217         bges            TWOOK1                    
218         bra             EXPBORS                   
219                                                   
220 TWOOK1:                                           
221         cmpil           #0x400D80C0,%d0           
222         bles            TWOMAIN                   
223         bra             EXPBORS                   
224                                                   
225                                                   
226 TWOMAIN:                                          
227 |--USUAL CASE, 2^(-70) <= |X| <= 16480            
228                                                   
229         fmovex          %fp0,%fp1                 
230         fmuls           #0x42800000,%fp1  | ..    
231                                                   
232         fmovel          %fp1,N(%a6)               
233         movel           %d2,-(%sp)                
234         lea             EXPTBL,%a1      | ...L    
235         fmovel          N(%a6),%fp1               
236         movel           N(%a6),%d0                
237         movel           %d0,%d2                   
238         andil           #0x3F,%d0                 
239         asll            #4,%d0          | ...D    
240         addal           %d0,%a1         | ...A    
241         asrl            #6,%d2          | ...d    
242         movel           %d2,%d0                   
243         asrl            #1,%d0          | ...D    
244         subl            %d0,%d2         | ...d    
245         addil           #0x3FFF,%d2               
246         movew           %d2,ADJFACT(%a6)          
247         movel           (%sp)+,%d2                
248 |--SUMMARY: a1 IS ADDRESS FOR THE LEADING PORT    
249 |--D0 IS M WHERE N = 64(M+M') + J. NOTE THAT |    
250 |--ADJFACT = 2^(M').                              
251 |--REGISTERS SAVED SO FAR ARE (IN ORDER) FPCR,    
252                                                   
253         fmuls           #0x3C800000,%fp1  | ..    
254         movel           (%a1)+,FACT1(%a6)         
255         movel           (%a1)+,FACT1HI(%a6)       
256         movel           (%a1)+,FACT1LOW(%a6)      
257         movew           (%a1)+,FACT2(%a6)         
258         clrw            FACT2+2(%a6)              
259                                                   
260         fsubx           %fp1,%fp0                 
261                                                   
262         movew           (%a1)+,FACT2HI(%a6)       
263         clrw            FACT2HI+2(%a6)            
264         clrl            FACT2LOW(%a6)             
265         addw            %d0,FACT1(%a6)            
266                                                   
267         fmulx           LOG2,%fp0       | ...F    
268         addw            %d0,FACT2(%a6)            
269                                                   
270         bra             expr                      
271                                                   
272 EXPBORS:                                          
273 |--FPCR, D0 SAVED                                 
274         cmpil           #0x3FFF8000,%d0           
275         bgts            EXPBIG                    
276                                                   
277 EXPSM:                                            
278 |--|X| IS SMALL, RETURN 1 + X                     
279                                                   
280         fmovel          %d1,%FPCR                 
281         fadds           #0x3F800000,%fp0  | ..    
282                                                   
283         bra             t_frcinx                  
284                                                   
285 EXPBIG:                                           
286 |--|X| IS LARGE, GENERATE OVERFLOW IF X > 0; E    
287 |--REGISTERS SAVE SO FAR ARE FPCR AND  D0         
288         movel           X(%a6),%d0                
289         cmpil           #0,%d0                    
290         blts            EXPNEG                    
291                                                   
292         bclrb           #7,(%a0)                  
293         bra             t_ovfl                    
294                                                   
295 EXPNEG:                                           
296         bclrb           #7,(%a0)                  
297         bra             t_unfl                    
298                                                   
299         .global stentoxd                          
300 stentoxd:                                         
301 |--ENTRY POINT FOR 10**(X) FOR DENORMALIZED AR    
302                                                   
303         fmovel          %d1,%fpcr                 
304         fmoves          #0x3F800000,%fp0  | ..    
305         movel           (%a0),%d0                 
306         orl             #0x00800001,%d0           
307         fadds           %d0,%fp0                  
308         bra             t_frcinx                  
309                                                   
310         .global stentox                           
311 stentox:                                          
312 |--ENTRY POINT FOR 10**(X), HERE X IS FINITE,     
313         fmovemx (%a0),%fp0-%fp0 | ...LOAD INPU    
314                                                   
315         movel           (%a0),%d0                 
316         movew           4(%a0),%d0                
317         fmovex          %fp0,X(%a6)               
318         andil           #0x7FFFFFFF,%d0           
319                                                   
320         cmpil           #0x3FB98000,%d0           
321         bges            TENOK1                    
322         bra             EXPBORS                   
323                                                   
324 TENOK1:                                           
325         cmpil           #0x400B9B07,%d0           
326         bles            TENMAIN                   
327         bra             EXPBORS                   
328                                                   
329 TENMAIN:                                          
330 |--USUAL CASE, 2^(-70) <= |X| <= 16480 LOG 2 /    
331                                                   
332         fmovex          %fp0,%fp1                 
333         fmuld           L2TEN64,%fp1    | ...X    
334                                                   
335         fmovel          %fp1,N(%a6)               
336         movel           %d2,-(%sp)                
337         lea             EXPTBL,%a1      | ...L    
338         fmovel          N(%a6),%fp1               
339         movel           N(%a6),%d0                
340         movel           %d0,%d2                   
341         andil           #0x3F,%d0                 
342         asll            #4,%d0          | ...D    
343         addal           %d0,%a1         | ...A    
344         asrl            #6,%d2          | ...d    
345         movel           %d2,%d0                   
346         asrl            #1,%d0          | ...D    
347         subl            %d0,%d2         | ...d    
348         addil           #0x3FFF,%d2               
349         movew           %d2,ADJFACT(%a6)          
350         movel           (%sp)+,%d2                
351                                                   
352 |--SUMMARY: a1 IS ADDRESS FOR THE LEADING PORT    
353 |--D0 IS M WHERE N = 64(M+M') + J. NOTE THAT |    
354 |--ADJFACT = 2^(M').                              
355 |--REGISTERS SAVED SO FAR ARE (IN ORDER) FPCR,    
356                                                   
357         fmovex          %fp1,%fp2                 
358                                                   
359         fmuld           L10TWO1,%fp1    | ...N    
360         movel           (%a1)+,FACT1(%a6)         
361                                                   
362         fmulx           L10TWO2,%fp2    | ...N    
363                                                   
364         movel           (%a1)+,FACT1HI(%a6)       
365         movel           (%a1)+,FACT1LOW(%a6)      
366         fsubx           %fp1,%fp0                 
367         movew           (%a1)+,FACT2(%a6)         
368                                                   
369         fsubx           %fp2,%fp0                 
370                                                   
371         clrw            FACT2+2(%a6)              
372         movew           (%a1)+,FACT2HI(%a6)       
373         clrw            FACT2HI+2(%a6)            
374         clrl            FACT2LOW(%a6)             
375                                                   
376         fmulx           LOG10,%fp0      | ...F    
377                                                   
378         addw            %d0,FACT1(%a6)            
379         addw            %d0,FACT2(%a6)            
380                                                   
381 expr:                                             
382 |--FPCR, FP2, FP3 ARE SAVED IN ORDER AS SHOWN.    
383 |--ADJFACT CONTAINS 2**(M'), FACT1 + FACT2 = 2    
384 |--FP0 IS R. THE FOLLOWING CODE COMPUTES          
385 |--     2**(M'+M) * 2**(J/64) * EXP(R)            
386                                                   
387         fmovex          %fp0,%fp1                 
388         fmulx           %fp1,%fp1                 
389                                                   
390         fmoved          EXPA5,%fp2      | ...F    
391         fmoved          EXPA4,%fp3      | ...F    
392                                                   
393         fmulx           %fp1,%fp2                 
394         fmulx           %fp1,%fp3                 
395                                                   
396         faddd           EXPA3,%fp2      | ...F    
397         faddd           EXPA2,%fp3      | ...F    
398                                                   
399         fmulx           %fp1,%fp2                 
400         fmulx           %fp1,%fp3                 
401                                                   
402         faddd           EXPA1,%fp2      | ...F    
403         fmulx           %fp0,%fp3                 
404                                                   
405         fmulx           %fp1,%fp2                 
406         faddx           %fp3,%fp0                 
407                                                   
408         faddx           %fp2,%fp0                 
409                                                   
410                                                   
411 |--FINAL RECONSTRUCTION PROCESS                   
412 |--EXP(X) = 2^M*2^(J/64) + 2^M*2^(J/64)*(EXP(R    
413                                                   
414         fmulx           FACT1(%a6),%fp0           
415         faddx           FACT2(%a6),%fp0           
416         faddx           FACT1(%a6),%fp0           
417                                                   
418         fmovel          %d1,%FPCR                 
419         clrw            ADJFACT+2(%a6)            
420         movel           #0x80000000,ADJFACT+4(    
421         clrl            ADJFACT+8(%a6)            
422         fmulx           ADJFACT(%a6),%fp0         
423                                                   
424         bra             t_frcinx                  
425                                                   
426         |end                                      
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php