summaryrefslogtreecommitdiffstats
path: root/src/arch/arm32/libgcc/lldivmod.S
blob: c9c224506201f71616ad8ea2d4c5f1ea035c1627 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )

	.section ".note.GNU-stack", "", %progbits
	.thumb

/**
 * Unsigned long long division
 *
 * @v r1:r0		Dividend
 * @v r3:r2		Divisor
 * @ret r1:r0		Quotient
 * @ret r3:r2		Remainder
 */
	.section ".text.__aeabi_uldivmod", "ax", %progbits
	.globl	__aeabi_uldivmod
	.type	__aeabi_uldivmod, %function
__aeabi_uldivmod:
	/* Allocate stack space for remainder and pointer to remainder */
	push	{r0, r1, r2, r3, r4, lr}
	/* Call __udivmoddi4() */
	add	r4, sp, #8
	str	r4, [sp]
	bl	__udivmoddi4
	/* Retrieve remainder and return */
	add	sp, sp, #8
	pop	{r2, r3, r4, pc}
	.size	__aeabi_uldivmod, . - __aeabi_uldivmod

/**
 * Signed long long division
 *
 * @v r1:r0		Dividend
 * @v r3:r2		Divisor
 * @ret r1:r0		Quotient
 * @ret r3:r2		Remainder
 */
	.section ".text.__aeabi_ldivmod", "ax", %progbits
	.globl	__aeabi_ldivmod
	.type	__aeabi_ldivmod, %function
__aeabi_ldivmod:
	/* Allocate stack space for remainder and pointer to remainder */
	push	{r0, r1, r2, r3, r4, lr}
	/* Call __divmoddi4() */
	add	r4, sp, #8
	str	r4, [sp]
	bl	__divmoddi4
	/* Retrieve remainder and return */
	add	sp, sp, #8
	pop	{r2, r3, r4, pc}
	.size	__aeabi_ldivmod, . - __aeabi_ldivmod