1 | //===----------------------Hexagon builtin routine ------------------------===// |
2 | // |
3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | // See https://llvm.org/LICENSE.txt for license information. |
5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | |
10 | .macro FUNCTION_BEGIN name |
11 | .text |
12 | .p2align 5 |
13 | .globl \name |
14 | .type \name, @function |
15 | \name: |
16 | .endm |
17 | |
18 | .macro FUNCTION_END name |
19 | .size \name, . - \name |
20 | .endm |
21 | |
22 | |
23 | FUNCTION_BEGIN __hexagon_umodsi3 |
24 | { |
25 | r2 = cl0(r0) |
26 | r3 = cl0(r1) |
27 | p0 = cmp.gtu(r1,r0) |
28 | } |
29 | { |
30 | r2 = sub(r3,r2) |
31 | if (p0) jumpr r31 |
32 | } |
33 | { |
34 | loop0(1f,r2) |
35 | p1 = cmp.eq(r2,#0) |
36 | r2 = lsl(r1,r2) |
37 | } |
38 | .falign |
39 | 1: |
40 | { |
41 | p0 = cmp.gtu(r2,r0) |
42 | if (!p0.new) r0 = sub(r0,r2) |
43 | r2 = lsr(r2,#1) |
44 | if (p1) r1 = #0 |
45 | }:endloop0 |
46 | { |
47 | p0 = cmp.gtu(r2,r0) |
48 | if (!p0.new) r0 = sub(r0,r1) |
49 | jumpr r31 |
50 | } |
51 | FUNCTION_END __hexagon_umodsi3 |
52 | |
53 | .globl __qdsp_umodsi3 |
54 | .set __qdsp_umodsi3, __hexagon_umodsi3 |
55 | |