| /*===-- modsi3.S - 32-bit signed integer 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 __modsi3 (32-bit signed integer modulus) function |
| * for the ARM architecture as a wrapper around the unsigned routine. |
| *===----------------------------------------------------------------------===*/ |
| #define ESTABLISH_FRAME \ |
| #define CLEAR_FRAME_AND_RETURN \ |
| @ int __modsi3(int divident, int divisor) |
| @ Calculate and return the remainder of the (signed) division. |
| DEFINE_COMPILERRT_FUNCTION(__modsi3) |
| #if __ARM_ARCH_EXT_IDIV__ |
| // Set aside the sign of the dividend. |
| // Take absolute value of a and b via abs(x) = (x^(x >> 31)) - (x >> 31). |
| bl SYMBOL_NAME(__umodsi3) |
| // Apply sign of dividend to result and return. |
| END_COMPILERRT_FUNCTION(__modsi3) |