1 /* Copyright (C) 2006 Free Software Foundation, Inc.
3 * SPDX-License-Identifier: GPL-2.0+
6 /* Moderately Space-optimized libgcc routines for the Renesas SH /
7 STMicroelectronics ST40 CPUs.
8 Contributed by J"orn Rennecke joern.rennecke@st.com. */
10 /* Size: 186 bytes jointly for udivsi3_i4i and sdivsi3_i4i
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. */
23 .set __udivsi3_i4, __udivsi3_i4i
24 .type __udivsi3_i4i, @function
25 .type __sdivsi3_i4i, @function
60 div1 r5,r4; div1 r5,r4; div1 r5,r4
61 div1 r5,r4; div1 r5,r4; rts; div1 r5,r4
89 .set __sdivsi3_i4, __sdivsi3_i4i
90 .set __sdivsi3, __sdivsi3_i4i
104 bra sdiv_check_divisor
112 mova negate_result,r0
120 bf/s sdiv_large_divisor
122 bra sdiv_small_divisor