1 /* Copyright (C) 2006 Free Software Foundation, Inc.
3 This file is free software; you can redistribute it and/or modify it
4 under the terms of the GNU General Public License as published by the
5 Free Software Foundation; either version 2, or (at your option) any
8 In addition to the permissions in the GNU General Public License, the
9 Free Software Foundation gives you unlimited permission to link the
10 compiled version of this file into combinations with other programs,
11 and to distribute those combinations without any restriction coming
12 from the use of this file. (The General Public License restrictions
13 do apply in other respects; for example, they cover modification of
14 the file, and distribution when not linked into a combine
17 This file is distributed in the hope that it will be useful, but
18 WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 General Public License for more details.
22 You should have received a copy of the GNU General Public License
23 along with this program; see the file COPYING. If not, write to
24 with this program; If not, see <http://www.gnu.org/licenses/>. */
26 /* Moderately Space-optimized libgcc routines for the Renesas SH /
27 STMicroelectronics ST40 CPUs.
28 Contributed by J"orn Rennecke joern.rennecke@st.com. */
30 /* Size: 186 bytes jointly for udivsi3_i4i and sdivsi3_i4i
32 udiv small divisor: 55 cycles
33 udiv large divisor: 52 cycles
34 sdiv small divisor, positive result: 59 cycles
35 sdiv large divisor, positive result: 56 cycles
36 sdiv small divisor, negative result: 65 cycles (*)
37 sdiv large divisor, negative result: 62 cycles (*)
38 (*): r2 is restored in the rts delay slot and has a lingering latency
39 of two more cycles. */
41 .global ___udivsi3_i4i
43 .set ___udivsi3_i4, ___udivsi3_i4i
78 div1 r5,r4; div1 r5,r4; div1 r5,r4
79 div1 r5,r4; div1 r5,r4; rts; div1 r5,r4
104 .global __sdivsi3_i4i
107 .set __sdivsi3_i4, __sdivsi3_i4i
108 .set __sdivsi3, __sdivsi3_i4i
122 bra sdiv_check_divisor
130 mova negate_result,r0
138 bf/s sdiv_large_divisor
140 bra sdiv_small_divisor