10b57cec5SDimitry Andric //===-- divsi3.c - Implement __divsi3 -------------------------------------===// 20b57cec5SDimitry Andric // 30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 60b57cec5SDimitry Andric // 70b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 80b57cec5SDimitry Andric // 90b57cec5SDimitry Andric // This file implements __divsi3 for the compiler_rt library. 100b57cec5SDimitry Andric // 110b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 120b57cec5SDimitry Andric 130b57cec5SDimitry Andric #include "int_lib.h" 140b57cec5SDimitry Andric 150b57cec5SDimitry Andric // Returns: a / b 160b57cec5SDimitry Andric 17*e8d8bef9SDimitry Andric #define fixint_t si_int 18*e8d8bef9SDimitry Andric #define fixuint_t su_int 190b57cec5SDimitry Andric // On CPUs without unsigned hardware division support, 200b57cec5SDimitry Andric // this calls __udivsi3 (notice the cast to su_int). 210b57cec5SDimitry Andric // On CPUs with unsigned hardware division support, 220b57cec5SDimitry Andric // this uses the unsigned division instruction. 23*e8d8bef9SDimitry Andric #define COMPUTE_UDIV(a, b) ((su_int)(a) / (su_int)(b)) 24*e8d8bef9SDimitry Andric #include "int_div_impl.inc" 25*e8d8bef9SDimitry Andric __divsi3(si_int a,si_int b)26*e8d8bef9SDimitry AndricCOMPILER_RT_ABI si_int __divsi3(si_int a, si_int b) { return __divXi3(a, b); } 270b57cec5SDimitry Andric 280b57cec5SDimitry Andric #if defined(__ARM_EABI__) 290b57cec5SDimitry Andric COMPILER_RT_ALIAS(__divsi3, __aeabi_idiv) 300b57cec5SDimitry Andric #endif 31