1
2#include <linux/linkage.h>
3
4
5
6
7
8
9
10
11 .text
12 .globl __modsi3
13 .type __modsi3, @function
14 .ent __modsi3
15
16__modsi3:
17 .frame r1, 0, r15
18
19 addik r1, r1, -16
20 swi r28, r1, 0
21 swi r29, r1, 4
22 swi r30, r1, 8
23 swi r31, r1, 12
24
25 beqi r6, div_by_zero
26 beqi r5, result_is_zero
27 bgeid r5, r5_pos
28
29 add r28, r5, r0
30 rsubi r5, r5, 0
31r5_pos:
32 bgei r6, r6_pos
33 rsubi r6, r6, 0
34r6_pos:
35 addik r3, r0, 0
36 addik r30, r0, 0
37 addik r29, r0, 32
38
39div1:
40 add r5, r5, r5
41 bgeid r5, div1
42 addik r29, r29, -1
43div2:
44
45 add r5, r5, r5
46 addc r3, r3, r3
47 rsub r31, r6, r3
48 blti r31, mod_too_small
49
50 or r3, r0, r31
51 addik r30, r30, 1
52mod_too_small:
53 addik r29, r29, -1
54 beqi r29, loop_end
55 add r30, r30, r30
56 bri div2
57loop_end:
58 bgei r28, return_here
59 brid return_here
60 rsubi r3, r3, 0
61div_by_zero:
62result_is_zero:
63 or r3, r0, r0
64return_here:
65
66 lwi r28, r1, 0
67 lwi r29, r1, 4
68 lwi r30, r1, 8
69 lwi r31, r1, 12
70 rtsd r15, 8
71 addik r1, r1, 16
72
73.size __modsi3, . - __modsi3
74.end __modsi3
75