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

TOMOYO Linux Cross Reference
Linux/arch/m68k/fpsp040/sint.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/sint.S (Architecture sparc64) and /arch/sparc/fpsp040/sint.S (Architecture sparc)


  1 |                                                 
  2 |       sint.sa 3.1 12/10/90                      
  3 |                                                 
  4 |       The entry point sINT computes the roun    
  5 |       equivalent of the input argument, sINT    
  6 |       the integer rounded to zero of the inp    
  7 |                                                 
  8 |       Entry points sint and sintrz are calle    
  9 |       to emulate the fint and fintrz unimple    
 10 |       respectively.  Entry point sintdo is u    
 11 |                                                 
 12 |       Input: (Entry points sint and sintrz)     
 13 |               number X in the ETEMP space in    
 14 |               save stack.                       
 15 |              (Entry point sintdo) Double-ext    
 16 |               location pointed to by the add    
 17 |              (Entry point sintd) Double-exte    
 18 |               number X in the ETEMP space in    
 19 |               save stack.                       
 20 |                                                 
 21 |       Output: The function returns int(X) or    
 22 |                                                 
 23 |       Modifies: fp0.                            
 24 |                                                 
 25 |       Algorithm: (sint and sintrz)              
 26 |                                                 
 27 |       1. If exp(X) >= 63, return X.             
 28 |          If exp(X) < 0, return +/- 0 or +/-     
 29 |          the rounding mode.                     
 30 |                                                 
 31 |       2. (X is in range) set rsc = 63 - exp(    
 32 |          result to the exponent $403e.          
 33 |                                                 
 34 |       3. Round the result in the mode given     
 35 |          sintrz, force round-to-zero mode.      
 36 |                                                 
 37 |       4. Normalize the rounded result; store    
 38 |                                                 
 39 |       For the denormalized cases, force the     
 40 |       for the given sign and rounding mode.     
 41 |                                                 
 42 |                       Sign(X)                   
 43 |               RMODE   +    -                    
 44 |               -----  --------                   
 45 |                RN    +0   -0                    
 46 |                RZ    +0   -0                    
 47 |                RM    +0   -1                    
 48 |                RP    +1   -0                    
 49 |                                                 
 50 |                                                 
 51 |               Copyright (C) Motorola, Inc. 1    
 52 |                       All Rights Reserved       
 53 |                                                 
 54 |       For details on the license for this fi    
 55 |       file, README, in this same directory.     
 56                                                   
 57 |SINT    idnt    2,1 | Motorola 040 Floating P    
 58                                                   
 59         |section        8                         
 60                                                   
 61 #include "fpsp.h"                                 
 62                                                   
 63         |xref   dnrm_lp                           
 64         |xref   nrm_set                           
 65         |xref   round                             
 66         |xref   t_inx2                            
 67         |xref   ld_pone                           
 68         |xref   ld_mone                           
 69         |xref   ld_pzero                          
 70         |xref   ld_mzero                          
 71         |xref   snzrinx                           
 72                                                   
 73 |                                                 
 74 |       FINT                                      
 75 |                                                 
 76         .global sint                              
 77 sint:                                             
 78         bfextu  FPCR_MODE(%a6){#2:#2},%d1         
 79 |                                       ;impli    
 80 |                                       ;in up    
 81         movel   %d1,L_SCR1(%a6)         |save     
 82         bras    sintexc                           
 83                                                   
 84 |                                                 
 85 |       FINT with extended denorm inputs.         
 86 |                                                 
 87         .global sintd                             
 88 sintd:                                            
 89         btstb   #5,FPCR_MODE(%a6)                 
 90         beq     snzrinx         |if round near    
 91         btstb   #4,FPCR_MODE(%a6)                 
 92         beqs    rnd_mns                           
 93 rnd_pls:                                          
 94         btstb   #sign_bit,LOCAL_EX(%a0)           
 95         bnes    sintmz                            
 96         bsr     ld_pone         |if round plus    
 97         bra     t_inx2                            
 98 rnd_mns:                                          
 99         btstb   #sign_bit,LOCAL_EX(%a0)           
100         beqs    sintpz                            
101         bsr     ld_mone         |if round mns     
102         bra     t_inx2                            
103 sintpz:                                           
104         bsr     ld_pzero                          
105         bra     t_inx2                            
106 sintmz:                                           
107         bsr     ld_mzero                          
108         bra     t_inx2                            
109                                                   
110 |                                                 
111 |       FINTRZ                                    
112 |                                                 
113         .global sintrz                            
114 sintrz:                                           
115         movel   #1,L_SCR1(%a6)          |use r    
116 |                                       ;impli    
117 |                                       ;in up    
118         bras    sintexc                           
119 |                                                 
120 |       SINTDO                                    
121 |                                                 
122 |       Input:  a0 points to an IEEE extended     
123 |       Output: fp0 has the result                
124 |                                                 
125 | Exceptions:                                     
126 |                                                 
127 | If the subroutine results in an inexact oper    
128 | ainx bits in the USER_FPSR are set.             
129 |                                                 
130 |                                                 
131         .global sintdo                            
132 sintdo:                                           
133         bfextu  FPCR_MODE(%a6){#2:#2},%d1         
134 |                                       ;impli    
135 |                                       ;in up    
136         movel   %d1,L_SCR1(%a6)         |save     
137 |                                                 
138 | Real work of sint is in sintexc                 
139 |                                                 
140 sintexc:                                          
141         bclrb   #sign_bit,LOCAL_EX(%a0) |conve    
142 |                                       ;forma    
143         sne     LOCAL_SGN(%a0)                    
144         cmpw    #0x403e,LOCAL_EX(%a0)   |check    
145         bgts    out_rnge                          
146         cmpw    #0x3ffd,LOCAL_EX(%a0)   |check    
147         bgt     in_rnge                 |if 63    
148 |                                                 
149 | Input is less than zero.  Restore sign, and     
150 | rounding modes.  L_SCR1 contains the rmode i    
151 |                                                 
152 un_rnge:                                          
153         btstb   #1,L_SCR1+3(%a6)                  
154         beqs    un_rnrz                           
155         tstb    LOCAL_SGN(%a0)          |check    
156         bnes    un_rmrp_neg                       
157 |                                                 
158 | Sign is +.  If rp, load +1.0, if rm, load +0    
159 |                                                 
160         cmpib   #3,L_SCR1+3(%a6)                  
161         beqs    un_ldpone               |if rp    
162         bsr     ld_pzero                |if rm    
163         bra     t_inx2                            
164 un_ldpone:                                        
165         bsr     ld_pone                           
166         bra     t_inx2                            
167 |                                                 
168 | Sign is -.  If rm, load -1.0, if rp, load -0    
169 |                                                 
170 un_rmrp_neg:                                      
171         cmpib   #2,L_SCR1+3(%a6)                  
172         beqs    un_ldmone               |if rm    
173         bsr     ld_mzero                |if rp    
174         bra     t_inx2                            
175 un_ldmone:                                        
176         bsr     ld_mone                           
177         bra     t_inx2                            
178 |                                                 
179 | Rmode is rn or rz; return signed zero           
180 |                                                 
181 un_rnrz:                                          
182         tstb    LOCAL_SGN(%a0)          |check    
183         bnes    un_rnrz_neg                       
184         bsr     ld_pzero                          
185         bra     t_inx2                            
186 un_rnrz_neg:                                      
187         bsr     ld_mzero                          
188         bra     t_inx2                            
189                                                   
190 |                                                 
191 | Input is greater than 2^63.  All bits are si    
192 | the input.                                      
193 |                                                 
194 out_rnge:                                         
195         bfclr   LOCAL_SGN(%a0){#0:#8}   |chang    
196         beqs    intps                             
197         bsetb   #sign_bit,LOCAL_EX(%a0)           
198 intps:                                            
199         fmovel  %fpcr,-(%sp)                      
200         fmovel  #0,%fpcr                          
201         fmovex LOCAL_EX(%a0),%fp0       |if ex    
202 |                                       ;then     
203 |                                       ;there    
204         fmovel  (%sp)+,%fpcr                      
205         rts                                       
206                                                   
207 in_rnge:                                          
208 |                                       ;shift    
209         clrl    %d0                     |clear    
210 |                                       ;dnrm_    
211         movel   #0x403e,%d1             |set t    
212 |                                       ;assum    
213         bsr     dnrm_lp                           
214 |                                       ;retur    
215 |                                       ;point    
216 |                                       ;outpu    
217 |                                       ;used     
218         movel   L_SCR1(%a6),%d1         |use s    
219 |                                                 
220 |                                                 
221         bsr     round                   |round    
222 |                                       ;input    
223 |                                       ;         
224 |                                       ;         
225 |                                       ;outpu    
226 |                                       ;inexa    
227 |                                       ;if in    
228 |                                                 
229 | normalize the rounded result and store value    
230 |                                                 
231         bsr     nrm_set                 |norma    
232 |                                       ;Input    
233 |                                       ;be no    
234 |                                       ;Outpu    
235 |                                       ;resul    
236         bfclr   LOCAL_SGN(%a0){#0:#8}             
237         beqs    nrmrndp                           
238         bsetb   #sign_bit,LOCAL_EX(%a0) |retur    
239 nrmrndp:                                          
240         fmovel  %fpcr,-(%sp)                      
241         fmovel  #0,%fpcr                          
242         fmovex LOCAL_EX(%a0),%fp0       |move     
243         fmovel  (%sp)+,%fpcr                      
244         rts                                       
245                                                   
246         |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