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

TOMOYO Linux Cross Reference
Linux/arch/mips/math-emu/dp_tlong.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_tlong.c (Architecture sparc64) and /arch/sparc/math-emu/dp_tlong.c (Architecture sparc)


  1 // SPDX-License-Identifier: GPL-2.0-only            1 
  2 /* IEEE754 floating point arithmetic              
  3  * double precision: common utilities             
  4  */                                               
  5 /*                                                
  6  * MIPS floating point support                    
  7  * Copyright (C) 1994-2000 Algorithmics Ltd.      
  8  */                                               
  9                                                   
 10 #include "ieee754dp.h"                            
 11                                                   
 12 s64 ieee754dp_tlong(union ieee754dp x)            
 13 {                                                 
 14         u64 residue;                              
 15         int round;                                
 16         int sticky;                               
 17         int odd;                                  
 18                                                   
 19         COMPXDP;                                  
 20                                                   
 21         ieee754_clearcx();                        
 22                                                   
 23         EXPLODEXDP;                               
 24         FLUSHXDP;                                 
 25                                                   
 26         switch (xc) {                             
 27         case IEEE754_CLASS_SNAN:                  
 28         case IEEE754_CLASS_QNAN:                  
 29                 ieee754_setcx(IEEE754_INVALID_    
 30                 return ieee754di_indef();         
 31                                                   
 32         case IEEE754_CLASS_INF:                   
 33                 ieee754_setcx(IEEE754_INVALID_    
 34                 return ieee754di_overflow(xs);    
 35                                                   
 36         case IEEE754_CLASS_ZERO:                  
 37                 return 0;                         
 38                                                   
 39         case IEEE754_CLASS_DNORM:                 
 40         case IEEE754_CLASS_NORM:                  
 41                 break;                            
 42         }                                         
 43         if (xe >= 63) {                           
 44                 /* look for valid corner case     
 45                 if (xe == 63 && xs && xm == DP    
 46                         return -0x800000000000    
 47                 /* Set invalid. We will only u    
 48                    point overflow */              
 49                 ieee754_setcx(IEEE754_INVALID_    
 50                 return ieee754di_overflow(xs);    
 51         }                                         
 52         /* oh gawd */                             
 53         if (xe > DP_FBITS) {                      
 54                 xm <<= xe - DP_FBITS;             
 55         } else if (xe < DP_FBITS) {               
 56                 if (xe < -1) {                    
 57                         residue = xm;             
 58                         round = 0;                
 59                         sticky = residue != 0;    
 60                         xm = 0;                   
 61                 } else {                          
 62                         /* Shifting a u64 64 t    
 63                         * so we do it in two s    
 64                         * may be -1 */            
 65                         residue = xm << (xe +     
 66                         residue <<= 63 - DP_FB    
 67                         round = (residue >> 63    
 68                         sticky = (residue << 1    
 69                         xm >>= DP_FBITS - xe;     
 70                 }                                 
 71                 odd = (xm & 0x1) != 0x0;          
 72                 switch (ieee754_csr.rm) {         
 73                 case FPU_CSR_RN:                  
 74                         if (round && (sticky |    
 75                                 xm++;             
 76                         break;                    
 77                 case FPU_CSR_RZ:                  
 78                         break;                    
 79                 case FPU_CSR_RU:        /* tow    
 80                         if ((round || sticky)     
 81                                 xm++;             
 82                         break;                    
 83                 case FPU_CSR_RD:        /* tow    
 84                         if ((round || sticky)     
 85                                 xm++;             
 86                         break;                    
 87                 }                                 
 88                 if ((xm >> 63) != 0) {            
 89                         /* This can happen aft    
 90                         ieee754_setcx(IEEE754_    
 91                         return ieee754di_overf    
 92                 }                                 
 93                 if (round || sticky)              
 94                         ieee754_setcx(IEEE754_    
 95         }                                         
 96         if (xs)                                   
 97                 return -xm;                       
 98         else                                      
 99                 return xm;                        
100 }                                                 
101                                                   

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