1 /* SPDX-License-Identifier: GPL-2.0-or-later WITH GCC-exception-2.0 */
2 #include <linux/linkage.h>
3 #include <asm/asmmacro.h>
12 bltui a3, 2, .Lle_one /* check if the divisor is <= 1 */
14 do_nsau a5, a2, a6, a7 /* dividend_shift = nsau (dividend) */
15 do_nsau a4, a3, a6, a7 /* divisor_shift = nsau (divisor) */
16 bgeu a5, a4, .Lspecial
18 sub a4, a4, a5 /* count = divisor_shift - dividend_shift */
20 sll a3, a3 /* divisor <<= count */
22 /* test-subtract-and-shift loop */
25 #endif /* XCHAL_HAVE_LOOPS */
27 bltu a2, a3, .Lzerobit
34 #endif /* !XCHAL_HAVE_LOOPS */
39 sub a2, a2, a3 /* subtract once more if dividend >= divisor */
46 /* Divide by zero: Use an illegal instruction to force an exception.
47 The subsequent "DIV0" string can be recognized by the exception
48 handler to identify the real cause of the exception. */
54 #endif /* XCHAL_HAVE_DIV32 */