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
11 .macro FUNCTION_BEGIN name
12 .text
13 .p2align 5
14 .globl \name
15 .type \name, @function
16\name:
17 .endm
18
19 .macro FUNCTION_END name
20 .size \name, . - \name
21 .endm
22
23
24FUNCTION_BEGIN __hexagon_modsi3
25 {
26 p2 = cmp.ge(r0,#0)
27 r2 = abs(r0)
28 r1 = abs(r1)
29 }
30 {
31 r3 = cl0(r2)
32 r4 = cl0(r1)
33 p0 = cmp.gtu(r1,r2)
34 }
35 {
36 r3 = sub(r4,r3)
37 if (p0) jumpr r31
38 }
39 {
40 p1 = cmp.eq(r3,#0)
41 loop0(1f,r3)
42 r0 = r2
43 r2 = lsl(r1,r3)
44 }
45 .falign
461:
47 {
48 p0 = cmp.gtu(r2,r0)
49 if (!p0.new) r0 = sub(r0,r2)
50 r2 = lsr(r2,#1)
51 if (p1) r1 = #0
52 }:endloop0
53 {
54 p0 = cmp.gtu(r2,r0)
55 if (!p0.new) r0 = sub(r0,r1)
56 if (p2) jumpr r31
57 }
58 {
59 r0 = neg(r0)
60 jumpr r31
61 }
62FUNCTION_END __hexagon_modsi3
63
64 .globl __qdsp_modsi3
65 .set __qdsp_modsi3, __hexagon_modsi3
66

source code of compiler-rt/lib/builtins/hexagon/modsi3.S