blob: 05ce806f7105b8c226e2aca3792d365d5c7102c4 [file] [log] [blame]
Edward O'Callaghan55836322009-08-07 20:30:09 +00001/* ===-- modsi3.c - Implement __modsi3 -------------------------------------===
2 *
3 * The LLVM Compiler Infrastructure
4 *
Howard Hinnant5b791f62010-11-16 22:13:33 +00005 * This file is dual licensed under the MIT and the University of Illinois Open
6 * Source Licenses. See LICENSE.TXT for details.
Edward O'Callaghan55836322009-08-07 20:30:09 +00007 *
8 * ===----------------------------------------------------------------------===
9 *
10 * This file implements __modsi3 for the compiler_rt library.
11 *
12 * ===----------------------------------------------------------------------===
13 */
Anton Korobeynikove63da932011-04-19 17:52:09 +000014#include "abi.h"
Daniel Dunbarfd089992009-06-26 16:47:03 +000015
16#include "int_lib.h"
17
Anton Korobeynikove63da932011-04-19 17:52:09 +000018su_int COMPILER_RT_ABI __divsi3(si_int a, si_int b);
Chris Lattner15bc34c2011-03-10 22:11:46 +000019
Edward O'Callaghan55836322009-08-07 20:30:09 +000020/* Returns: a % b */
Daniel Dunbarfd089992009-06-26 16:47:03 +000021
Anton Korobeynikove63da932011-04-19 17:52:09 +000022COMPILER_RT_ABI si_int
Daniel Dunbarfd089992009-06-26 16:47:03 +000023__modsi3(si_int a, si_int b)
24{
Chris Lattner15bc34c2011-03-10 22:11:46 +000025 return a - __divsi3(a, b) * b;
Daniel Dunbarfd089992009-06-26 16:47:03 +000026}