1 /* libgcc routines for R8C/M16C/M32C
2 Copyright (C) 2005, 2009
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 sint32_type __attribute__ ((mode (SI)));
33 typedef unsigned int uint32_type __attribute__ ((mode (SI)));
34 typedef int word_type __attribute__ ((mode (__word__)));
36 uint32_type udivmodsi4 (uint32_type, uint32_type, word_type);
37 sint32_type __divsi3 (sint32_type, sint32_type);
38 sint32_type __modsi3 (sint32_type, sint32_type);
41 udivmodsi4 (uint32_type num, uint32_type den, word_type modwanted)
46 while (den < num && bit && !(den & (1L << 31)))
67 __divsi3 (sint32_type a, sint32_type b)
84 res = udivmodsi4 (a, b, 0);
93 __modsi3 (sint32_type a, sint32_type b)
107 res = udivmodsi4 (a, b, 1);
115 /* See the comment by the definition of LIBGCC2_UNITS_PER_WORD in
116 m32c.h for why we are creating extra versions of some of the
117 functions defined in libgcc2.c. */
119 #define LIBGCC2_UNITS_PER_WORD 2
125 #define L_popcountsi2
130 __udivsi3 (uint32_type a, uint32_type b)
132 return udivmodsi4 (a, b, 0);
136 __umoddi3 (uint32_type a, uint32_type b)
138 return udivmodsi4 (a, b, 1);