xref: /openbmc/linux/arch/hexagon/lib/umodsi3.S (revision 0ad53fe3)
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Copyright (c) 2021, The Linux Foundation. All rights reserved.
4 */
5
6#include <linux/linkage.h>
7
8SYM_FUNC_START(__hexagon_umodsi3)
9        {
10                r2 = cl0(r0)
11                r3 = cl0(r1)
12                p0 = cmp.gtu(r1,r0)
13        }
14        {
15                r2 = sub(r3,r2)
16                if (p0) jumpr r31
17        }
18        {
19                loop0(1f,r2)
20                p1 = cmp.eq(r2,#0)
21                r2 = lsl(r1,r2)
22        }
23        .falign
241:
25        {
26                p0 = cmp.gtu(r2,r0)
27                if (!p0.new) r0 = sub(r0,r2)
28                r2 = lsr(r2,#1)
29                if (p1) r1 = #0
30        }:endloop0
31        {
32                p0 = cmp.gtu(r2,r0)
33                if (!p0.new) r0 = sub(r0,r1)
34                jumpr r31
35        }
36SYM_FUNC_END(__hexagon_umodsi3)
37