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

TOMOYO Linux Cross Reference
Linux/arch/mips/math-emu/dp_fmax.c

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/mips/math-emu/dp_fmax.c (Architecture mips) and /arch/m68k/math-emu/dp_fmax.c (Architecture m68k)


  1 // SPDX-License-Identifier: GPL-2.0-only            1 
  2 /*                                                
  3  * IEEE754 floating point arithmetic              
  4  * double precision: MIN{,A}.f                    
  5  * MIN : Scalar Floating-Point Minimum            
  6  * MINA: Scalar Floating-Point argument with M    
  7  *                                                
  8  * MIN.D : FPR[fd] = minNum(FPR[fs],FPR[ft])      
  9  * MINA.D: FPR[fd] = maxNumMag(FPR[fs],FPR[ft]    
 10  *                                                
 11  * MIPS floating point support                    
 12  * Copyright (C) 2015 Imagination Technologies    
 13  * Author: Markos Chandras <markos.chandras@im    
 14  */                                               
 15                                                   
 16 #include "ieee754dp.h"                            
 17                                                   
 18 union ieee754dp ieee754dp_fmax(union ieee754dp    
 19 {                                                 
 20         COMPXDP;                                  
 21         COMPYDP;                                  
 22                                                   
 23         EXPLODEXDP;                               
 24         EXPLODEYDP;                               
 25                                                   
 26         FLUSHXDP;                                 
 27         FLUSHYDP;                                 
 28                                                   
 29         ieee754_clearcx();                        
 30                                                   
 31         switch (CLPAIR(xc, yc)) {                 
 32         case CLPAIR(IEEE754_CLASS_QNAN, IEEE75    
 33         case CLPAIR(IEEE754_CLASS_ZERO, IEEE75    
 34         case CLPAIR(IEEE754_CLASS_NORM, IEEE75    
 35         case CLPAIR(IEEE754_CLASS_DNORM, IEEE7    
 36         case CLPAIR(IEEE754_CLASS_INF, IEEE754    
 37                 return ieee754dp_nanxcpt(y);      
 38                                                   
 39         case CLPAIR(IEEE754_CLASS_SNAN, IEEE75    
 40         case CLPAIR(IEEE754_CLASS_SNAN, IEEE75    
 41         case CLPAIR(IEEE754_CLASS_SNAN, IEEE75    
 42         case CLPAIR(IEEE754_CLASS_SNAN, IEEE75    
 43         case CLPAIR(IEEE754_CLASS_SNAN, IEEE75    
 44         case CLPAIR(IEEE754_CLASS_SNAN, IEEE75    
 45                 return ieee754dp_nanxcpt(x);      
 46                                                   
 47         /*                                        
 48          * Quiet NaN handling                     
 49          */                                       
 50                                                   
 51         /*                                        
 52          *    The case of both inputs quiet Na    
 53          */                                       
 54         case CLPAIR(IEEE754_CLASS_QNAN, IEEE75    
 55                 return x;                         
 56                                                   
 57         /*                                        
 58          *    The cases of exactly one input q    
 59          *    are here preferred as returned v    
 60          */                                       
 61         case CLPAIR(IEEE754_CLASS_ZERO, IEEE75    
 62         case CLPAIR(IEEE754_CLASS_NORM, IEEE75    
 63         case CLPAIR(IEEE754_CLASS_DNORM, IEEE7    
 64         case CLPAIR(IEEE754_CLASS_INF, IEEE754    
 65                 return x;                         
 66                                                   
 67         case CLPAIR(IEEE754_CLASS_QNAN, IEEE75    
 68         case CLPAIR(IEEE754_CLASS_QNAN, IEEE75    
 69         case CLPAIR(IEEE754_CLASS_QNAN, IEEE75    
 70         case CLPAIR(IEEE754_CLASS_QNAN, IEEE75    
 71                 return y;                         
 72                                                   
 73         /*                                        
 74          * Infinity and zero handling             
 75          */                                       
 76         case CLPAIR(IEEE754_CLASS_INF, IEEE754    
 77         case CLPAIR(IEEE754_CLASS_INF, IEEE754    
 78         case CLPAIR(IEEE754_CLASS_INF, IEEE754    
 79         case CLPAIR(IEEE754_CLASS_NORM, IEEE75    
 80         case CLPAIR(IEEE754_CLASS_DNORM, IEEE7    
 81                 return xs ? y : x;                
 82                                                   
 83         case CLPAIR(IEEE754_CLASS_INF, IEEE754    
 84         case CLPAIR(IEEE754_CLASS_NORM, IEEE75    
 85         case CLPAIR(IEEE754_CLASS_DNORM, IEEE7    
 86         case CLPAIR(IEEE754_CLASS_ZERO, IEEE75    
 87         case CLPAIR(IEEE754_CLASS_ZERO, IEEE75    
 88         case CLPAIR(IEEE754_CLASS_ZERO, IEEE75    
 89                 return ys ? x : y;                
 90                                                   
 91         case CLPAIR(IEEE754_CLASS_ZERO, IEEE75    
 92                 return ieee754dp_zero(xs & ys)    
 93                                                   
 94         case CLPAIR(IEEE754_CLASS_DNORM, IEEE7    
 95                 DPDNORMX;                         
 96                 fallthrough;                      
 97         case CLPAIR(IEEE754_CLASS_NORM, IEEE75    
 98                 DPDNORMY;                         
 99                 break;                            
100                                                   
101         case CLPAIR(IEEE754_CLASS_DNORM, IEEE7    
102                 DPDNORMX;                         
103         }                                         
104                                                   
105         /* Finally get to do some computation     
106                                                   
107         assert(xm & DP_HIDDEN_BIT);               
108         assert(ym & DP_HIDDEN_BIT);               
109                                                   
110         /* Compare signs */                       
111         if (xs > ys)                              
112                 return y;                         
113         else if (xs < ys)                         
114                 return x;                         
115                                                   
116         /* Signs of inputs are equal, let's co    
117         if (xs == 0) {                            
118                 /* Inputs are both positive */    
119                 if (xe > ye)                      
120                         return x;                 
121                 else if (xe < ye)                 
122                         return y;                 
123         } else {                                  
124                 /* Inputs are both negative */    
125                 if (xe > ye)                      
126                         return y;                 
127                 else if (xe < ye)                 
128                         return x;                 
129         }                                         
130                                                   
131         /* Signs and exponents of inputs are e    
132         if (xs == 0) {                            
133                 /* Inputs are both positive, w    
134                 if (xm <= ym)                     
135                         return y;                 
136                 return x;                         
137         }                                         
138         /* Inputs are both negative, with equa    
139         if (xm <= ym)                             
140                 return x;                         
141         return y;                                 
142 }                                                 
143                                                   
144 union ieee754dp ieee754dp_fmaxa(union ieee754d    
145 {                                                 
146         COMPXDP;                                  
147         COMPYDP;                                  
148                                                   
149         EXPLODEXDP;                               
150         EXPLODEYDP;                               
151                                                   
152         FLUSHXDP;                                 
153         FLUSHYDP;                                 
154                                                   
155         ieee754_clearcx();                        
156                                                   
157         switch (CLPAIR(xc, yc)) {                 
158         case CLPAIR(IEEE754_CLASS_QNAN, IEEE75    
159         case CLPAIR(IEEE754_CLASS_ZERO, IEEE75    
160         case CLPAIR(IEEE754_CLASS_NORM, IEEE75    
161         case CLPAIR(IEEE754_CLASS_DNORM, IEEE7    
162         case CLPAIR(IEEE754_CLASS_INF, IEEE754    
163                 return ieee754dp_nanxcpt(y);      
164                                                   
165         case CLPAIR(IEEE754_CLASS_SNAN, IEEE75    
166         case CLPAIR(IEEE754_CLASS_SNAN, IEEE75    
167         case CLPAIR(IEEE754_CLASS_SNAN, IEEE75    
168         case CLPAIR(IEEE754_CLASS_SNAN, IEEE75    
169         case CLPAIR(IEEE754_CLASS_SNAN, IEEE75    
170         case CLPAIR(IEEE754_CLASS_SNAN, IEEE75    
171                 return ieee754dp_nanxcpt(x);      
172                                                   
173         /*                                        
174          * Quiet NaN handling                     
175          */                                       
176                                                   
177         /*                                        
178          *    The case of both inputs quiet Na    
179          */                                       
180         case CLPAIR(IEEE754_CLASS_QNAN, IEEE75    
181                 return x;                         
182                                                   
183         /*                                        
184          *    The cases of exactly one input q    
185          *    are here preferred as returned v    
186          */                                       
187         case CLPAIR(IEEE754_CLASS_ZERO, IEEE75    
188         case CLPAIR(IEEE754_CLASS_NORM, IEEE75    
189         case CLPAIR(IEEE754_CLASS_DNORM, IEEE7    
190         case CLPAIR(IEEE754_CLASS_INF, IEEE754    
191                 return x;                         
192                                                   
193         case CLPAIR(IEEE754_CLASS_QNAN, IEEE75    
194         case CLPAIR(IEEE754_CLASS_QNAN, IEEE75    
195         case CLPAIR(IEEE754_CLASS_QNAN, IEEE75    
196         case CLPAIR(IEEE754_CLASS_QNAN, IEEE75    
197                 return y;                         
198                                                   
199         /*                                        
200          * Infinity and zero handling             
201          */                                       
202         case CLPAIR(IEEE754_CLASS_INF, IEEE754    
203                 return ieee754dp_inf(xs & ys);    
204                                                   
205         case CLPAIR(IEEE754_CLASS_INF, IEEE754    
206         case CLPAIR(IEEE754_CLASS_INF, IEEE754    
207         case CLPAIR(IEEE754_CLASS_INF, IEEE754    
208         case CLPAIR(IEEE754_CLASS_NORM, IEEE75    
209         case CLPAIR(IEEE754_CLASS_DNORM, IEEE7    
210                 return x;                         
211                                                   
212         case CLPAIR(IEEE754_CLASS_NORM, IEEE75    
213         case CLPAIR(IEEE754_CLASS_DNORM, IEEE7    
214         case CLPAIR(IEEE754_CLASS_ZERO, IEEE75    
215         case CLPAIR(IEEE754_CLASS_ZERO, IEEE75    
216         case CLPAIR(IEEE754_CLASS_ZERO, IEEE75    
217                 return y;                         
218                                                   
219         case CLPAIR(IEEE754_CLASS_ZERO, IEEE75    
220                 return ieee754dp_zero(xs & ys)    
221                                                   
222         case CLPAIR(IEEE754_CLASS_DNORM, IEEE7    
223                 DPDNORMX;                         
224                 fallthrough;                      
225         case CLPAIR(IEEE754_CLASS_NORM, IEEE75    
226                 DPDNORMY;                         
227                 break;                            
228                                                   
229         case CLPAIR(IEEE754_CLASS_DNORM, IEEE7    
230                 DPDNORMX;                         
231         }                                         
232                                                   
233         /* Finally get to do some computation     
234                                                   
235         assert(xm & DP_HIDDEN_BIT);               
236         assert(ym & DP_HIDDEN_BIT);               
237                                                   
238         /* Compare exponent */                    
239         if (xe > ye)                              
240                 return x;                         
241         else if (xe < ye)                         
242                 return y;                         
243                                                   
244         /* Compare mantissa */                    
245         if (xm < ym)                              
246                 return y;                         
247         else if (xm > ym)                         
248                 return x;                         
249         else if (xs == 0)                         
250                 return x;                         
251         return y;                                 
252 }                                                 
253                                                   

~ [ 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