xref: /netbsd-src/sys/external/bsd/compiler_rt/dist/lib/builtins/divmodsi4.c (revision f7f78b3373aafafa211473d7733a8806c0e402c0)
1*156cd587Sjoerg /*===-- divmodsi4.c - Implement __divmodsi4 --------------------------------===
2*156cd587Sjoerg  *
3*156cd587Sjoerg  *                    The LLVM Compiler Infrastructure
4*156cd587Sjoerg  *
5*156cd587Sjoerg  * This file is dual licensed under the MIT and the University of Illinois Open
6*156cd587Sjoerg  * Source Licenses. See LICENSE.TXT for details.
7*156cd587Sjoerg  *
8*156cd587Sjoerg  * ===----------------------------------------------------------------------===
9*156cd587Sjoerg  *
10*156cd587Sjoerg  * This file implements __divmodsi4 for the compiler_rt library.
11*156cd587Sjoerg  *
12*156cd587Sjoerg  * ===----------------------------------------------------------------------===
13*156cd587Sjoerg  */
14*156cd587Sjoerg 
15*156cd587Sjoerg #include "int_lib.h"
16*156cd587Sjoerg 
17*156cd587Sjoerg /* Returns: a / b, *rem = a % b  */
18*156cd587Sjoerg 
19*156cd587Sjoerg COMPILER_RT_ABI si_int
__divmodsi4(si_int a,si_int b,si_int * rem)20*156cd587Sjoerg __divmodsi4(si_int a, si_int b, si_int* rem)
21*156cd587Sjoerg {
22*156cd587Sjoerg   si_int d = __divsi3(a,b);
23*156cd587Sjoerg   *rem = a - (d*b);
24*156cd587Sjoerg   return d;
25*156cd587Sjoerg }
26*156cd587Sjoerg 
27*156cd587Sjoerg 
28