xref: /freebsd/contrib/llvm-project/compiler-rt/lib/builtins/hexagon/udivsi3.S (revision dd41de95a84d979615a2ef11df6850622bf6184e)
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	.macro FUNCTION_BEGIN name
10	.text
11        .p2align 5
12	.globl \name
13	.type  \name, @function
14\name:
15	.endm
16
17	.macro FUNCTION_END name
18	.size  \name, . - \name
19	.endm
20
21
22FUNCTION_BEGIN __hexagon_udivsi3
23	{
24		r2 = cl0(r0)
25		r3 = cl0(r1)
26		r5:4 = combine(#1,#0)
27		p0 = cmp.gtu(r1,r0)
28	}
29	{
30		r6 = sub(r3,r2)
31		r4 = r1
32		r1:0 = combine(r0,r4)
33		if (p0) jumpr r31
34	}
35	{
36		r3:2 = vlslw(r5:4,r6)
37		loop0(1f,r6)
38	}
39	.falign
401:
41	{
42		p0 = cmp.gtu(r2,r1)
43		if (!p0.new) r1 = sub(r1,r2)
44		if (!p0.new) r0 = add(r0,r3)
45		r3:2 = vlsrw(r3:2,#1)
46	}:endloop0
47	{
48		p0 = cmp.gtu(r2,r1)
49		if (!p0.new) r0 = add(r0,r3)
50		jumpr r31
51	}
52FUNCTION_END __hexagon_udivsi3
53
54  .globl __qdsp_udivsi3
55  .set   __qdsp_udivsi3, __hexagon_udivsi3
56