| /*===-- divmodsi4.S - 32-bit signed integer divide and modulus ------------===// |
| * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| * See https://llvm.org/LICENSE.txt for license information. |
| * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| *===----------------------------------------------------------------------===// |
| * This file implements the __divmodsi4 (32-bit signed integer divide and |
| * modulus) function for the ARM architecture. A naive digit-by-digit |
| * computation is employed for simplicity. |
| *===----------------------------------------------------------------------===*/ |
| #define ESTABLISH_FRAME \ |
| #define CLEAR_FRAME_AND_RETURN \ |
| @ int __divmodsi4(int divident, int divisor, int *remainder) |
| @ Calculate the quotient and remainder of the (signed) division. The return |
| @ value is the quotient, the remainder is placed in the variable. |
| DEFINE_COMPILERRT_FUNCTION(__divmodsi4) |
| #if __ARM_ARCH_EXT_IDIV__ |
| // Set aside the sign of the quotient and modulus, and the address for the |
| // Take the absolute value of a and b via abs(x) = (x^(x >> 31)) - (x >> 31). |
| bl SYMBOL_NAME(__udivmodsi4) |
| // Apply the sign of quotient and modulus |
| END_COMPILERRT_FUNCTION(__divmodsi4) |