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

TOMOYO Linux Cross Reference
Linux/arch/x86/math-emu/reg_mul.c

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ 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.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /arch/x86/math-emu/reg_mul.c (Architecture sparc64) and /arch/i386/math-emu/reg_mul.c (Architecture i386)


  1 // SPDX-License-Identifier: GPL-2.0                 1 
  2 /*--------------------------------------------    
  3  |  reg_mul.c                                     
  4  |                                                
  5  | Multiply one FPU_REG by another, put the re    
  6  |                                                
  7  | Copyright (C) 1992,1993,1997                   
  8  |                  W. Metzenthen, 22 Parker S    
  9  |                  E-mail   billm@suburbia.ne    
 10  |                                                
 11  | Returns the tag of the result if no excepti    
 12  |                                                
 13  +--------------------------------------------    
 14                                                   
 15 /*--------------------------------------------    
 16  | The destination may be any FPU_REG, includi    
 17  +--------------------------------------------    
 18                                                   
 19 #include "fpu_emu.h"                              
 20 #include "exception.h"                            
 21 #include "reg_constant.h"                         
 22 #include "fpu_system.h"                           
 23                                                   
 24 /*                                                
 25   Multiply two registers to give a register re    
 26   The sources are st(deststnr) and (b,tagb,sig    
 27   The destination is st(deststnr).                
 28   */                                              
 29 /* This routine must be called with non-empty     
 30 int FPU_mul(FPU_REG const *b, u_char tagb, int    
 31 {                                                 
 32         FPU_REG *a = &st(deststnr);               
 33         FPU_REG *dest = a;                        
 34         u_char taga = FPU_gettagi(deststnr);      
 35         u_char saved_sign = getsign(dest);        
 36         u_char sign = (getsign(a) ^ getsign(b)    
 37         int tag;                                  
 38                                                   
 39         if (!(taga | tagb)) {                     
 40                 /* Both regs Valid, this shoul    
 41                                                   
 42                 tag =                             
 43                     FPU_u_mul(a, b, dest, cont    
 44                               exponent(a) + ex    
 45                 if (tag < 0) {                    
 46                         setsign(dest, saved_si    
 47                         return tag;               
 48                 }                                 
 49                 FPU_settagi(deststnr, tag);       
 50                 return tag;                       
 51         }                                         
 52                                                   
 53         if (taga == TAG_Special)                  
 54                 taga = FPU_Special(a);            
 55         if (tagb == TAG_Special)                  
 56                 tagb = FPU_Special(b);            
 57                                                   
 58         if (((taga == TAG_Valid) && (tagb == T    
 59             || ((taga == TW_Denormal) && (tagb    
 60             || ((taga == TW_Denormal) && (tagb    
 61                 FPU_REG x, y;                     
 62                 if (denormal_operand() < 0)       
 63                         return FPU_Exception;     
 64                                                   
 65                 FPU_to_exp16(a, &x);              
 66                 FPU_to_exp16(b, &y);              
 67                 tag = FPU_u_mul(&x, &y, dest,     
 68                                 exponent16(&x)    
 69                 if (tag < 0) {                    
 70                         setsign(dest, saved_si    
 71                         return tag;               
 72                 }                                 
 73                 FPU_settagi(deststnr, tag);       
 74                 return tag;                       
 75         } else if ((taga <= TW_Denormal) && (t    
 76                 if (((tagb == TW_Denormal) ||     
 77                     && (denormal_operand() < 0    
 78                         return FPU_Exception;     
 79                                                   
 80                 /* Must have either both argum    
 81                    one valid and the other zer    
 82                    The result is therefore zer    
 83                 FPU_copy_to_regi(&CONST_Z, TAG    
 84                 /* The 80486 book says that th    
 85                    80486 behaves this way.        
 86                    IEEE-754 apparently says it    
 87                 setsign(dest, sign);              
 88                 return TAG_Zero;                  
 89         }                                         
 90         /* Must have infinities, NaNs, etc */     
 91         else if ((taga == TW_NaN) || (tagb ==     
 92                 return real_2op_NaN(b, tagb, d    
 93         } else if (((taga == TW_Infinity) && (    
 94                    || ((tagb == TW_Infinity) &    
 95                 return arith_invalid(deststnr)    
 96         } else if (((taga == TW_Denormal) || (    
 97                    && (denormal_operand() < 0)    
 98                 return FPU_Exception;             
 99         } else if (taga == TW_Infinity) {         
100                 FPU_copy_to_regi(a, TAG_Specia    
101                 setsign(dest, sign);              
102                 return TAG_Special;               
103         } else if (tagb == TW_Infinity) {         
104                 FPU_copy_to_regi(b, TAG_Specia    
105                 setsign(dest, sign);              
106                 return TAG_Special;               
107         }                                         
108 #ifdef PARANOID                                   
109         else {                                    
110                 EXCEPTION(EX_INTERNAL | 0x102)    
111                 return FPU_Exception;             
112         }                                         
113 #endif /* PARANOID */                             
114                                                   
115         return 0;                                 
116 }                                                 
117                                                   

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