]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/compiler-rt/lib/builtins/hexagon/divsi3.S
Merge clang 7.0.1 and several follow-up changes
[FreeBSD/FreeBSD.git] / contrib / compiler-rt / lib / builtins / hexagon / divsi3.S
1 //===----------------------Hexagon builtin routine ------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10
11
12         .macro FUNCTION_BEGIN name
13         .text
14         .p2align 5
15         .globl \name
16         .type  \name, @function
17 \name:
18         .endm
19
20         .macro FUNCTION_END name
21         .size  \name, . - \name
22         .endm
23
24
25 FUNCTION_BEGIN __hexagon_divsi3
26         {
27                 p0 = cmp.ge(r0,#0)
28                 p1 = cmp.ge(r1,#0)
29                 r1 = abs(r0)
30                 r2 = abs(r1)
31         }
32         {
33                 r3 = cl0(r1)
34                 r4 = cl0(r2)
35                 r5 = sub(r1,r2)
36                 p2 = cmp.gtu(r2,r1)
37         }
38 #if (__HEXAGON_ARCH__ == 60)
39         {
40                 r0 = #0
41                 p1 = xor(p0,p1)
42                 p0 = cmp.gtu(r2,r5)
43         }
44                 if (p2) jumpr r31
45 #else
46         {
47                 r0 = #0
48                 p1 = xor(p0,p1)
49                 p0 = cmp.gtu(r2,r5)
50                 if (p2) jumpr r31
51         }
52 #endif
53         {
54                 r0 = mux(p1,#-1,#1)
55                 if (p0) jumpr r31
56                 r4 = sub(r4,r3)
57                 r3 = #1
58         }
59         {
60                 r0 = #0
61                 r3:2 = vlslw(r3:2,r4)
62                 loop0(1f,r4)
63         }
64         .falign
65 1:
66         {
67                 p0 = cmp.gtu(r2,r1)
68                 if (!p0.new) r1 = sub(r1,r2)
69                 if (!p0.new) r0 = add(r0,r3)
70                 r3:2 = vlsrw(r3:2,#1)
71         }:endloop0
72         {
73                 p0 = cmp.gtu(r2,r1)
74                 if (!p0.new) r0 = add(r0,r3)
75                 if (!p1) jumpr r31
76         }
77         {
78                 r0 = neg(r0)
79                 jumpr r31
80         }
81 FUNCTION_END __hexagon_divsi3
82
83   .globl __qdsp_divsi3
84   .set   __qdsp_divsi3, __hexagon_divsi3