xref: /llvm-project/compiler-rt/lib/builtins/modsi3.c (revision 0ba22f51d128bee9d69756c56c4678097270e10b)
1*0ba22f51SPetr Hosek //===-- modsi3.c - Implement __modsi3 -------------------------------------===//
2*0ba22f51SPetr Hosek //
3*0ba22f51SPetr Hosek // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*0ba22f51SPetr Hosek // See https://llvm.org/LICENSE.txt for license information.
5*0ba22f51SPetr Hosek // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*0ba22f51SPetr Hosek //
7*0ba22f51SPetr Hosek //===----------------------------------------------------------------------===//
8*0ba22f51SPetr Hosek //
9*0ba22f51SPetr Hosek // This file implements __modsi3 for the compiler_rt library.
10*0ba22f51SPetr Hosek //
11*0ba22f51SPetr Hosek //===----------------------------------------------------------------------===//
12a6b264b5SAlexey Samsonov 
13a6b264b5SAlexey Samsonov #include "int_lib.h"
14a6b264b5SAlexey Samsonov 
15*0ba22f51SPetr Hosek // Returns: a % b
16a6b264b5SAlexey Samsonov 
__modsi3(si_int a,si_int b)17082b89b2SPetr Hosek COMPILER_RT_ABI si_int __modsi3(si_int a, si_int b) {
18a6b264b5SAlexey Samsonov   return a - __divsi3(a, b) * b;
19a6b264b5SAlexey Samsonov }
20