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

TOMOYO Linux Cross Reference
Linux/arch/powerpc/boot/div64.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/powerpc/boot/div64.S (Version linux-6.12-rc7) and /arch/m68k/boot/div64.S (Version linux-5.8.18)


  1 /* SPDX-License-Identifier: GPL-2.0-or-later *    
  2 /*                                                
  3  * Divide a 64-bit unsigned number by a 32-bit    
  4  * This routine assumes that the top 32 bits o    
  5  * non-zero to start with.                        
  6  * On entry, r3 points to the dividend, which     
  7  * the 64-bit quotient, and r4 contains the di    
  8  * On exit, r3 contains the remainder.            
  9  *                                                
 10  * Copyright (C) 2002 Paul Mackerras, IBM Corp    
 11  */                                               
 12 #include "ppc_asm.h"                              
 13                                                   
 14         .globl __div64_32                         
 15 __div64_32:                                       
 16         lwz     r5,0(r3)        # get the divi    
 17         lwz     r6,4(r3)                          
 18         cmplw   r5,r4                             
 19         li      r7,0                              
 20         li      r8,0                              
 21         blt     1f                                
 22         divwu   r7,r5,r4        # if dividend.    
 23         mullw   r0,r7,r4        # quotient.hi     
 24         subf.   r5,r0,r5        # dividend.hi     
 25         beq     3f                                
 26 1:      mr      r11,r5          # here dividen    
 27         andis.  r0,r5,0xc000                      
 28         bne     2f                                
 29         cntlzw  r0,r5           # we are shift    
 30         li      r10,-1          # to make it <    
 31         srw     r10,r10,r0      # the divisor     
 32         addc    r9,r4,r10       # rounding up     
 33         andc    r11,r6,r10      # ever be too     
 34         andc    r9,r9,r10                         
 35         addze   r9,r9                             
 36         or      r11,r5,r11                        
 37         rotlw   r9,r9,r0                          
 38         rotlw   r11,r11,r0                        
 39         divwu   r11,r11,r9      # then we divi    
 40 2:      mullw   r10,r11,r4      # to get an es    
 41         mulhwu  r9,r11,r4       # multiply the    
 42         subfc   r6,r10,r6       # take the pro    
 43         add     r8,r8,r11       # and add the     
 44         subfe.  r5,r9,r5        # quotient        
 45         bne     1b                                
 46 3:      cmplw   r6,r4                             
 47         blt     4f                                
 48         divwu   r0,r6,r4        # perform the     
 49         mullw   r10,r0,r4       # and get the     
 50         add     r8,r8,r0                          
 51         subf    r6,r10,r6                         
 52 4:      stw     r7,0(r3)        # return the q    
 53         stw     r8,4(r3)                          
 54         mr      r3,r6           # return the r    
 55         blr                                       
 56                                                   
 57 /*                                                
 58  * Extended precision shifts.                     
 59  *                                                
 60  * Updated to be valid for shift counts from 0    
 61  * -- Gabriel                                     
 62  *                                                
 63  * R3/R4 has 64 bit value                         
 64  * R5    has shift count                          
 65  * result in R3/R4                                
 66  *                                                
 67  *  ashrdi3: arithmetic right shift (sign prop    
 68  *  lshrdi3: logical right shift                  
 69  *  ashldi3: left shift                           
 70  */                                               
 71         .globl __ashrdi3                          
 72 __ashrdi3:                                        
 73         subfic  r6,r5,32                          
 74         srw     r4,r4,r5        # LSW = count     
 75         addi    r7,r5,32        # could be xor    
 76         slw     r6,r3,r6        # t1 = count >    
 77         rlwinm  r8,r7,0,32      # t3 = (count     
 78         sraw    r7,r3,r7        # t2 = MSW >>     
 79         or      r4,r4,r6        # LSW |= t1       
 80         slw     r7,r7,r8        # t2 = (count     
 81         sraw    r3,r3,r5        # MSW = MSW >>    
 82         or      r4,r4,r7        # LSW |= t2       
 83         blr                                       
 84                                                   
 85         .globl __ashldi3                          
 86 __ashldi3:                                        
 87         subfic  r6,r5,32                          
 88         slw     r3,r3,r5        # MSW = count     
 89         addi    r7,r5,32        # could be xor    
 90         srw     r6,r4,r6        # t1 = count >    
 91         slw     r7,r4,r7        # t2 = count <    
 92         or      r3,r3,r6        # MSW |= t1       
 93         slw     r4,r4,r5        # LSW = LSW <<    
 94         or      r3,r3,r7        # MSW |= t2       
 95         blr                                       
 96                                                   
 97         .globl __lshrdi3                          
 98 __lshrdi3:                                        
 99         subfic  r6,r5,32                          
100         srw     r4,r4,r5        # LSW = count     
101         addi    r7,r5,32        # could be xor    
102         slw     r6,r3,r6        # t1 = count >    
103         srw     r7,r3,r7        # t2 = count <    
104         or      r4,r4,r6        # LSW |= t1       
105         srw     r3,r3,r5        # MSW = MSW >>    
106         or      r4,r4,r7        # LSW |= t2       
107         blr                                       
                                                      

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