1 /* libgcc routines for R8C/M16C/M32C
3 Free Software Foundation, Inc.
4 Contributed by Red Hat.
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it
9 under the terms of the GNU General Public License as published
10 by the Free Software Foundation; either version 2, or (at your
11 option) any later version.
13 In addition to the permissions in the GNU General Public License,
14 the Free Software Foundation gives you unlimited permission to link
15 the compiled version of this file into combinations with other
16 programs, and to distribute those combinations without any
17 restriction coming from the use of this file. (The General Public
18 License restrictions do apply in other respects; for example, they
19 cover modification of the file, and distribution when not linked
20 into a combine executable.)
22 GCC is distributed in the hope that it will be useful, but WITHOUT
23 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
24 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
25 License for more details.
27 You should have received a copy of the GNU General Public License
28 along with GCC; see the file COPYING. If not, write to the Free
29 Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
32 typedef int HItype
__attribute__ ((mode (HI
)));
33 typedef unsigned int UHItype
__attribute__ ((mode (HI
)));
34 typedef int SItype
__attribute__ ((mode (SI
)));
35 typedef unsigned int USItype
__attribute__ ((mode (SI
)));
37 typedef int word_type
__attribute__ ((mode (__word__
)));
39 USItype
udivmodsi4 (USItype num
, USItype den
, word_type modwanted
);
40 SItype
__divsi3 (SItype a
, SItype b
);
41 SItype
__modsi3 (SItype a
, SItype b
);
42 SItype
__udivsi3 (SItype a
, SItype b
);
43 SItype
__umodsi3 (SItype a
, SItype b
);
46 udivmodsi4 (USItype num
, USItype den
, word_type modwanted
)
51 while (den
< num
&& bit
&& !(den
& (1L << 31)))
74 __divsi3 (SItype a
, SItype b
)
91 res
= udivmodsi4 (a
, b
, 0);
102 __modsi3 (SItype a
, SItype b
)
116 res
= udivmodsi4 (a
, b
, 1);
128 __udivsi3 (SItype a
, SItype b
)
130 return udivmodsi4 (a
, b
, 0);
136 __umodsi3 (SItype a
, SItype b
)
138 return udivmodsi4 (a
, b
, 1);