1219719Sed/*===-- divmodsi4.c - Implement __divmodsi4 --------------------------------===
2219719Sed *
3219719Sed *                    The LLVM Compiler Infrastructure
4219719Sed *
5219719Sed * This file is dual licensed under the MIT and the University of Illinois Open
6219719Sed * Source Licenses. See LICENSE.TXT for details.
7219719Sed *
8219719Sed * ===----------------------------------------------------------------------===
9219719Sed *
10219719Sed * This file implements __divmodsi4 for the compiler_rt library.
11219719Sed *
12219719Sed * ===----------------------------------------------------------------------===
13219719Sed */
14219719Sed
15219719Sed#include "int_lib.h"
16219719Sed
17222625Sedextern COMPILER_RT_ABI si_int __divsi3(si_int a, si_int b);
18219719Sed
19219719Sed
20219719Sed/* Returns: a / b, *rem = a % b  */
21219719Sed
22222625SedCOMPILER_RT_ABI si_int
23219719Sed__divmodsi4(si_int a, si_int b, si_int* rem)
24219719Sed{
25219719Sed  si_int d = __divsi3(a,b);
26219719Sed  *rem = a - (d*b);
27219719Sed  return d;
28219719Sed}
29219719Sed
30219719Sed
31