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

TOMOYO Linux Cross Reference
Linux/arch/sh/lib/udivsi3_i4i-Os.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 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0+ WITH GCC-exception-2.0
  2  *
  3  * Copyright (C) 2006 Free Software Foundation, Inc.
  4  */
  5 
  6 /* Moderately Space-optimized libgcc routines for the Renesas SH /
  7    STMicroelectronics ST40 CPUs.
  8    Contributed by J"orn Rennecke joern.rennecke@st.com.  */
  9 
 10 /* Size: 186 bytes jointly for udivsi3_i4i and sdivsi3_i4i
 11    sh4-200 run times:
 12    udiv small divisor: 55 cycles
 13    udiv large divisor: 52 cycles
 14    sdiv small divisor, positive result: 59 cycles
 15    sdiv large divisor, positive result: 56 cycles
 16    sdiv small divisor, negative result: 65 cycles (*)
 17    sdiv large divisor, negative result: 62 cycles (*)
 18    (*): r2 is restored in the rts delay slot and has a lingering latency
 19         of two more cycles.  */
 20         .balign 4
 21         .global __udivsi3_i4i
 22         .global __udivsi3_i4
 23         .set    __udivsi3_i4, __udivsi3_i4i
 24         .type   __udivsi3_i4i, @function
 25         .type   __sdivsi3_i4i, @function
 26 __udivsi3_i4i:
 27         sts pr,r1
 28         mov.l r4,@-r15
 29         extu.w r5,r0
 30         cmp/eq r5,r0
 31         swap.w r4,r0
 32         shlr16 r4
 33         bf/s large_divisor
 34         div0u
 35         mov.l r5,@-r15
 36         shll16 r5
 37 sdiv_small_divisor:
 38         div1 r5,r4
 39         bsr div6
 40         div1 r5,r4
 41         div1 r5,r4
 42         bsr div6
 43         div1 r5,r4
 44         xtrct r4,r0
 45         xtrct r0,r4
 46         bsr div7
 47         swap.w r4,r4
 48         div1 r5,r4
 49         bsr div7
 50         div1 r5,r4
 51         xtrct r4,r0
 52         mov.l @r15+,r5
 53         swap.w r0,r0
 54         mov.l @r15+,r4
 55         jmp @r1
 56         rotcl r0
 57 div7:
 58         div1 r5,r4
 59 div6:
 60                     div1 r5,r4; div1 r5,r4; div1 r5,r4
 61         div1 r5,r4; div1 r5,r4; rts;        div1 r5,r4
 62 
 63 divx3:
 64         rotcl r0
 65         div1 r5,r4
 66         rotcl r0
 67         div1 r5,r4
 68         rotcl r0
 69         rts
 70         div1 r5,r4
 71 
 72 large_divisor:
 73         mov.l r5,@-r15
 74 sdiv_large_divisor:
 75         xor r4,r0
 76         .rept 4
 77         rotcl r0
 78         bsr divx3
 79         div1 r5,r4
 80         .endr
 81         mov.l @r15+,r5
 82         mov.l @r15+,r4
 83         jmp @r1
 84         rotcl r0
 85 
 86         .global __sdivsi3_i4i
 87         .global __sdivsi3_i4
 88         .global __sdivsi3
 89         .set    __sdivsi3_i4, __sdivsi3_i4i
 90         .set    __sdivsi3, __sdivsi3_i4i
 91 __sdivsi3_i4i:
 92         mov.l r4,@-r15
 93         cmp/pz r5
 94         mov.l r5,@-r15
 95         bt/s pos_divisor
 96         cmp/pz r4
 97         neg r5,r5
 98         extu.w r5,r0
 99         bt/s neg_result
100         cmp/eq r5,r0
101         neg r4,r4
102 pos_result:
103         swap.w r4,r0
104         bra sdiv_check_divisor
105         sts pr,r1
106 pos_divisor:
107         extu.w r5,r0
108         bt/s pos_result
109         cmp/eq r5,r0
110         neg r4,r4
111 neg_result:
112         mova negate_result,r0
113         ;
114         mov r0,r1
115         swap.w r4,r0
116         lds r2,macl
117         sts pr,r2
118 sdiv_check_divisor:
119         shlr16 r4
120         bf/s sdiv_large_divisor
121         div0u
122         bra sdiv_small_divisor
123         shll16 r5
124         .balign 4
125 negate_result:
126         neg r0,r0
127         jmp @r2
128         sts macl,r2

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