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

TOMOYO Linux Cross Reference
Linux/arch/m68k/fpsp040/binstr.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/binstr.S (Version linux-6.12-rc7) and /arch/i386/fpsp040/binstr.S (Version linux-5.19.17)


  1 |                                                 
  2 |       binstr.sa 3.3 12/19/90                    
  3 |                                                 
  4 |                                                 
  5 |       Description: Converts a 64-bit binary     
  6 |                                                 
  7 |       Input: 64-bit binary integer in d2:d3,    
  8 |          d0, and a  pointer to start in memo    
  9 |          in d0. (This pointer must point to     
 10 |          lword of the packed decimal memory     
 11 |                                                 
 12 |       Output: LEN bcd digits representing th    
 13 |                                                 
 14 |       Algorithm:                                
 15 |               The 64-bit binary is assumed t    
 16 |               bit 63.  The fraction is multi    
 17 |               shift and a mul by 8 shift.  T    
 18 |               msb form a decimal digit.  Thi    
 19 |               LEN digits are formed.            
 20 |                                                 
 21 |       A1. Init d7 to 1.  D7 is the byte digi    
 22 |               digit formed will be assumed t    
 23 |               to force the first byte formed    
 24 |                                                 
 25 |       A2. Beginning of the loop:                
 26 |               Copy the fraction in d2:d3 to     
 27 |                                                 
 28 |       A3. Multiply the fraction in d2:d3 by     
 29 |               extracts and shifts.  The thre    
 30 |               d1.                               
 31 |                                                 
 32 |       A4. Multiply the fraction in d4:d5 by     
 33 |               will be collected by the carry    
 34 |                                                 
 35 |       A5. Add using the carry the 64-bit qua    
 36 |               into d2:d3.  D1 will contain t    
 37 |                                                 
 38 |       A6. Test d7.  If zero, the digit forme    
 39 |               zero, it is the ls digit.  Put    
 40 |               upper word of d0.  If it is th    
 41 |               from d0 to memory.                
 42 |                                                 
 43 |       A7. Decrement d6 (LEN counter) and rep    
 44 |                                                 
 45 |       Implementation Notes:                     
 46 |                                                 
 47 |       The registers are used as follows:        
 48 |                                                 
 49 |               d0: LEN counter                   
 50 |               d1: temp used to form the digi    
 51 |               d2: upper 32-bits of fraction     
 52 |               d3: lower 32-bits of fraction     
 53 |               d4: upper 32-bits of fraction     
 54 |               d5: lower 32-bits of fraction     
 55 |               d6: temp for bit-field extract    
 56 |               d7: byte digit formation word;    
 57 |               a0: pointer into memory for pa    
 58 |                                                 
 59                                                   
 60 |               Copyright (C) Motorola, Inc. 1    
 61 |                       All Rights Reserved       
 62 |                                                 
 63 |       For details on the license for this fi    
 64 |       file, README, in this same directory.     
 65                                                   
 66 |BINSTR    idnt    2,1 | Motorola 040 Floating    
 67                                                   
 68         |section        8                         
 69                                                   
 70 #include "fpsp.h"                                 
 71                                                   
 72         .global binstr                            
 73 binstr:                                           
 74         moveml  %d0-%d7,-(%a7)                    
 75 |                                                 
 76 | A1: Init d7                                     
 77 |                                                 
 78         moveql  #1,%d7                  |init     
 79         subql   #1,%d0                  |for d    
 80 |                                                 
 81 | A2. Copy d2:d3 to d4:d5.  Start loop.           
 82 |                                                 
 83 loop:                                             
 84         movel   %d2,%d4                 |copy     
 85         movel   %d3,%d5                 |to d4    
 86 |                                                 
 87 | A3. Multiply d2:d3 by 8; extract msbs into d    
 88 |                                                 
 89         bfextu  %d2{#0:#3},%d1          |copy     
 90         asll    #3,%d2                  |shift    
 91         bfextu  %d3{#0:#3},%d6          |copy     
 92         asll    #3,%d3                  |shift    
 93         orl     %d6,%d2                 |or in    
 94 |                                                 
 95 | A4. Multiply d4:d5 by 2; add carry out to d1    
 96 |                                                 
 97         asll    #1,%d5                  |mul d    
 98         roxll   #1,%d4                  |mul d    
 99         swap    %d6                     |put 0    
100         addxw   %d6,%d1                 |add i    
101 |                                                 
102 | A5. Add mul by 8 to mul by 2.  D1 contains t    
103 |                                                 
104         addl    %d5,%d3                 |add l    
105         nop                             |ERRAT    
106         addxl   %d4,%d2                 |add w    
107         nop                             |ERRAT    
108         addxw   %d6,%d1                 |add i    
109         swap    %d6                     |with     
110 |                                                 
111 | A6. Test d7 and branch.                         
112 |                                                 
113         tstw    %d7                     |if ze    
114         beqs    first_d                 |if no    
115 sec_d:                                            
116         swap    %d7                     |bring    
117         aslw    #4,%d7                  |first    
118         addw    %d1,%d7                 |add i    
119         moveb   %d7,(%a0)+              |store    
120         swap    %d7                     |put L    
121         clrw    %d7                     |set d    
122         dbf     %d0,loop                |do lo    
123         bras    end_bstr                |finis    
124 first_d:                                          
125         swap    %d7                     |put d    
126         movew   %d1,%d7                 |put n    
127         swap    %d7                     |put L    
128         addqw   #1,%d7                  |set d    
129         dbf     %d0,loop                |do lo    
130         swap    %d7                     |put l    
131         lslw    #4,%d7                  |move     
132         moveb   %d7,(%a0)+              |store    
133 |                                                 
134 | Clean up and return with result in fp0.         
135 |                                                 
136 end_bstr:                                         
137         moveml  (%a7)+,%d0-%d7                    
138         rts                                       
139         |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