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

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


  1 |                                                 
  2 |       x_unfl.sa 3.4 7/1/91                      
  3 |                                                 
  4 |       fpsp_unfl --- FPSP handler for underfl    
  5 |                                                 
  6 | Trap disabled results                           
  7 |       For 881/2 compatibility, sw must denor    
  8 | result, then store the result.  Denormalizat    
  9 | by taking the intermediate result (which is     
 10 | shifting the mantissa right while incrementi    
 11 | it is equal to the denormalized exponent for    
 12 | format.  After denormalization, the result i    
 13 | destination format.                             
 14 |                                                 
 15 | Trap enabled results                            
 16 |       All trap disabled code applies. In add    
 17 | operand needs to made available to the user     
 18 | added to the exponent.                          
 19 |                                                 
 20                                                   
 21 |               Copyright (C) Motorola, Inc. 1    
 22 |                       All Rights Reserved       
 23 |                                                 
 24 |       For details on the license for this fi    
 25 |       file, README, in this same directory.     
 26                                                   
 27 X_UNFL: |idnt    2,1 | Motorola 040 Floating P    
 28                                                   
 29         |section        8                         
 30                                                   
 31 #include "fpsp.h"                                 
 32                                                   
 33         |xref   denorm                            
 34         |xref   round                             
 35         |xref   store                             
 36         |xref   g_rndpr                           
 37         |xref   g_opcls                           
 38         |xref   g_dfmtou                          
 39         |xref   real_unfl                         
 40         |xref   real_inex                         
 41         |xref   fpsp_done                         
 42         |xref   b1238_fix                         
 43                                                   
 44         .global fpsp_unfl                         
 45 fpsp_unfl:                                        
 46         link            %a6,#-LOCAL_SIZE          
 47         fsave           -(%a7)                    
 48         moveml          %d0-%d1/%a0-%a1,USER_D    
 49         fmovemx %fp0-%fp3,USER_FP0(%a6)           
 50         fmoveml %fpcr/%fpsr/%fpiar,USER_FPCR(%    
 51                                                   
 52 |                                                 
 53         bsrl            unf_res |denormalize,     
 54 |                                                 
 55 | If underflow exceptions are not enabled, che    
 56 | exception                                       
 57 |                                                 
 58         btstb           #unfl_bit,FPCR_ENABLE(    
 59         beqs            ck_inex                   
 60                                                   
 61         btstb           #E3,E_BYTE(%a6)           
 62         beqs            no_e3_1                   
 63 |                                                 
 64 | Clear dirty bit on dest resister in the fram    
 65 | to b1238_fix.                                   
 66 |                                                 
 67         bfextu          CMDREG3B(%a6){#6:#3},%    
 68         bclrb           %d0,FPR_DIRTY_BITS(%a6    
 69         bsrl            b1238_fix                 
 70         movel           USER_FPSR(%a6),FPSR_SH    
 71         orl             #sx_mask,E_BYTE(%a6)      
 72 no_e3_1:                                          
 73         moveml          USER_DA(%a6),%d0-%d1/%    
 74         fmovemx USER_FP0(%a6),%fp0-%fp3           
 75         fmoveml USER_FPCR(%a6),%fpcr/%fpsr/%fp    
 76         frestore        (%a7)+                    
 77         unlk            %a6                       
 78         bral            real_unfl                 
 79 |                                                 
 80 | It is possible to have either inex2 or inex1    
 81 | unfl.  If the inex enable bit is set in the     
 82 | inex2 or inex1 occurred, we must clean up an    
 83 | real inex handler.                              
 84 |                                                 
 85 ck_inex:                                          
 86         moveb           FPCR_ENABLE(%a6),%d0      
 87         andb            FPSR_EXCEPT(%a6),%d0      
 88         andib           #0x3,%d0                  
 89         beqs            unfl_done                 
 90                                                   
 91 |                                                 
 92 | Inexact enabled and reported, and we must ta    
 93 |                                                 
 94 take_inex:                                        
 95         btstb           #E3,E_BYTE(%a6)           
 96         beqs            no_e3_2                   
 97 |                                                 
 98 | Clear dirty bit on dest resister in the fram    
 99 | to b1238_fix.                                   
100 |                                                 
101         bfextu          CMDREG3B(%a6){#6:#3},%    
102         bclrb           %d0,FPR_DIRTY_BITS(%a6    
103         bsrl            b1238_fix                 
104         movel           USER_FPSR(%a6),FPSR_SH    
105         orl             #sx_mask,E_BYTE(%a6)      
106 no_e3_2:                                          
107         moveb           #INEX_VEC,EXC_VEC+1(%a    
108         moveml         USER_DA(%a6),%d0-%d1/%a    
109         fmovemx        USER_FP0(%a6),%fp0-%fp3    
110         fmoveml        USER_FPCR(%a6),%fpcr/%f    
111         frestore        (%a7)+                    
112         unlk            %a6                       
113         bral            real_inex                 
114                                                   
115 unfl_done:                                        
116         bclrb           #E3,E_BYTE(%a6)           
117         beqs            e1_set          |if se    
118 |                                                 
119 | Clear dirty bit on dest resister in the fram    
120 | to b1238_fix.                                   
121 |                                                 
122         bfextu          CMDREG3B(%a6){#6:#3},%    
123         bclrb           %d0,FPR_DIRTY_BITS(%a6    
124         bsrl            b1238_fix                 
125         movel           USER_FPSR(%a6),FPSR_SH    
126         orl             #sx_mask,E_BYTE(%a6)      
127         moveml          USER_DA(%a6),%d0-%d1/%    
128         fmovemx USER_FP0(%a6),%fp0-%fp3           
129         fmoveml USER_FPCR(%a6),%fpcr/%fpsr/%fp    
130         frestore        (%a7)+                    
131         unlk            %a6                       
132         bral            fpsp_done                 
133 e1_set:                                           
134         moveml          USER_DA(%a6),%d0-%d1/%    
135         fmovemx USER_FP0(%a6),%fp0-%fp3           
136         fmoveml USER_FPCR(%a6),%fpcr/%fpsr/%fp    
137         unlk            %a6                       
138         bral            fpsp_done                 
139 |                                                 
140 |       unf_res --- underflow result calculati    
141 |                                                 
142 unf_res:                                          
143         bsrl            g_rndpr         |retur    
144 |                                       ;1=sgl    
145 |                                       ;we ne    
146 |                                       ;upper    
147         movew           #0,-(%a7)                 
148         movew           %d0,-(%a7)      |copy     
149 |                                                 
150 |                                                 
151 | If the exception bit set is E3, the exceptio    
152 | fpu is in WBTEMP; else it is in FPTEMP.         
153 |                                                 
154         btstb           #E3,E_BYTE(%a6)           
155         beqs            unf_E1                    
156 unf_E3:                                           
157         lea             WBTEMP(%a6),%a0 |a0 no    
158 |                                                 
159 | Test for fsgldiv and fsglmul.  If the inst w    
160 | force the precision to extended for the deno    
161 | the user's precision for the round routine.     
162 |                                                 
163         movew           CMDREG3B(%a6),%d1         
164         andiw           #0x7f,%d1                 
165         cmpiw           #0x30,%d1                 
166         beqs            unf_sgl                   
167         cmpiw           #0x33,%d1                 
168         bnes            unf_cont        |if no    
169 unf_sgl:                                          
170         clrl            %d0                       
171         movew           #0x1,(%a7)      |overr    
172 |                                       ;force    
173         bras            unf_cont                  
174 unf_E1:                                           
175         lea             FPTEMP(%a6),%a0 |a0 no    
176 unf_cont:                                         
177         bclrb           #sign_bit,LOCAL_EX(%a0    
178         sne             LOCAL_SGN(%a0)            
179                                                   
180         bsrl            denorm          |retur    
181 |                                                 
182 | WARNING:                                        
183 |                               ;d0 has guard,    
184 |                               ;make sure tha    
185 |                               ;before it rea    
186 |                               ;also ensure t    
187                                                   
188 |                                                 
189 | Set up d1 for round subroutine d1 contains t    
190 | information respectively on upper/lower regi    
191 |                                                 
192         bfextu          FPCR_MODE(%a6){#2:#2},    
193 |                                                 
194         addl            (%a7)+,%d1                
195 |                                                 
196 | WARNING: a0 and d0 are assumed to be intact     
197 | round subroutines. All code between these tw    
198 | must not corrupt a0 and d0.                     
199 |                                                 
200 |                                                 
201 | Perform Round                                   
202 |       Input:          a0 points to input ope    
203 |                       d0{31:29} has guard, r    
204 |                       d1{01:00} has rounding    
205 |                       d1{17:16} has rounding    
206 |       Output:         a0 points to rounded o    
207 |                                                 
208                                                   
209         bsrl            round           |retur    
210 |                                                 
211 | Differentiate between store to memory vs. st    
212 |                                                 
213 unf_store:                                        
214         bsrl            g_opcls         |retur    
215         cmpib           #0x3,%d0                  
216         bnes            not_opc011                
217 |                                                 
218 | At this point, a store to memory is pending     
219 |                                                 
220 opc011:                                           
221         bsrl            g_dfmtou                  
222         tstb            %d0                       
223         beqs            ext_opc011      |If ex    
224 |                               ;If destinatio    
225         tstb            LOCAL_HI(%a0)   |If ro    
226 |                                       ;subtr    
227         bmis            ext_opc011                
228         subqw           #1,LOCAL_EX(%a0)          
229 |                               ;normalized bi    
230 |                               ;          nor    
231 |                               ;single           
232 |                               ;double           
233 |                                                 
234 ext_opc011:                                       
235         bsrl            store           |store    
236         bras            unf_done        |finis    
237                                                   
238 |                                                 
239 | At this point, a store to a float register i    
240 |                                                 
241 not_opc011:                                       
242         bsrl            store   |stores to flo    
243 |                               ;a0 is not cor    
244 |                               ;float registe    
245 |                                                 
246 | Set the condition codes according to result     
247 |                                                 
248         tstl            LOCAL_HI(%a0)   |check    
249         bnes            ck_sgn                    
250         tstl            LOCAL_LO(%a0)   |check    
251         bnes            ck_sgn                    
252         bsetb           #z_bit,FPSR_CC(%a6) |s    
253 ck_sgn:                                           
254         btstb           #sign_bit,LOCAL_EX(%a0    
255         beqs            unf_done                  
256         bsetb           #neg_bit,FPSR_CC(%a6)     
257                                                   
258 |                                                 
259 | Finish.                                         
260 |                                                 
261 unf_done:                                         
262         btstb           #inex2_bit,FPSR_EXCEPT    
263         beqs            no_aunfl                  
264         bsetb           #aunfl_bit,FPSR_AEXCEP    
265 no_aunfl:                                         
266         rts                                       
267                                                   
268         |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