1 //===-- divmodsi4.c - Implement __divmodsi4 2 //--------------------------------===// 3 // 4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 5 // See https://llvm.org/LICENSE.txt for license information. 6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 7 // 8 //===----------------------------------------------------------------------===// 9 // 10 // This file implements __divmodsi4 for the compiler_rt library. 11 // 12 //===----------------------------------------------------------------------===// 13 14 #include "int_lib.h" 15 16 // Returns: a / b, *rem = a % b 17 18 COMPILER_RT_ABI si_int __divmodsi4(si_int a, si_int b, si_int *rem) { 19 si_int d = __divsi3(a, b); 20 *rem = a - (d * b); 21 return d; 22 } 23