OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [config/] [or32/] [or32.S] - Blame information for rev 154

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 38 julius
/*
2
 * Assembly functions for software multiplication and devision.
3
 */
4
 
5
#define ENTRY(symbol)   \
6
        .align 4        ;\
7
        .global symbol  ;\
8
symbol:
9
 
10
#ifdef L__mulsi3
11
ENTRY(___mulsi3)
12
        l.addi r11,r0,0x0
13
        l.sfne r3,r11
14
        l.bnf 3f
15
        l.ori r5,r3,0x0
16
        l.addi r6,r0,0x0
17
1:
18
        l.andi r3,r5,0x1
19
        l.sfeq r3,r6
20
        l.bf 2f
21
        l.srli r5,r5,0x1
22
        l.add r11,r11,r4
23
2:
24
        l.sfne r5,r6
25
        l.bf 1b
26
        l.slli r4,r4,0x1
27
3:
28
        l.jr r9
29
        l.nop 0x0
30
#endif
31
 
32
#ifdef L__udivsi3
33
ENTRY(___udivsi3)
34
        l.addi          r1,r1,-4
35
        l.sw            0(r1),r9
36
        l.addi          r11,r0,0
37
        l.addi          r8,r4,0
38
        l.addi          r5,r3,0
39
        l.sfne          r8,r11
40
        l.bnf           4f
41
        l.addi          r7,r0,0
42
        l.sfgtu         r8,r5
43
        l.bf            5f
44
        l.sfeq          r8,r5
45
        l.bf            6f
46
        l.sfltu         r11,r8
47
        l.bnf           2f
48
        l.addi          r13,r0,32
49
        l.movhi         r9,hi(0x80000000)
50
        l.addi          r6,r0,-1
51
1:
52
        l.and           r3,r5,r9
53
        l.slli          r4,r7,1
54
        l.addi          r15,r5,0
55
        l.srli          r3,r3,31
56
        l.add           r13,r13,r6
57
        l.or            r7,r4,r3
58
        l.sfltu         r7,r8
59
        l.bf            1b
60
        l.slli          r5,r5,1
61
2:
62
        l.srli          r7,r7,1
63
        l.addi          r13,r13,1
64
        l.addi          r9,r0,0
65
        l.sfltu         r9,r13
66
        l.bnf           4f
67
        l.addi          r5,r15,0
68
        l.movhi         r15,hi(0x80000000)
69
        l.addi          r17,r0,0
70
3:
71
        l.and           r3,r5,r15
72
        l.slli          r4,r7,1
73
        l.srli          r3,r3,31
74
        l.or            r7,r4,r3
75
        l.sub           r6,r7,r8
76
        l.and           r3,r6,r15
77
        l.srli          r3,r3,31
78
        l.addi          r4,r0,0
79
        l.sfne          r3,r4
80
        l.bf            1f
81
        l.slli          r3,r11,1
82
        l.addi          r4,r0,1
83
1:
84
        l.slli          r5,r5,1
85
        l.sfne          r4,r17
86
        l.bnf           2f
87
        l.or            r11,r3,r4
88
        l.addi          r7,r6,0
89
2:
90
        l.addi          r9,r9,1
91
        l.sfltu         r9,r13
92
        l.bf            3b
93
        l.nop           0
94
        l.j             4f
95
        l.nop           0
96
6:
97
        l.j             4f
98
        l.addi          r11,r0,1
99
5:
100
        l.addi          r7,r5,0
101
4:
102
        l.lwz           r9,0(r1)
103
        l.jr            r9
104
        l.addi          r1,r1,4
105
#endif
106
 
107
 
108
#ifdef L__divsi3
109
ENTRY(___divsi3)
110
        l.addi          r1,r1,-8
111
        l.sw            0(r1),r9
112
        l.sw            4(r1),r14
113
        l.addi          r5,r3,0
114
        l.addi          r14,r0,0
115
        l.sflts         r5,r0
116
        l.bnf           1f
117
        l.addi          r3,r0,0
118
        l.addi          r14,r0,1
119
        l.sub           r5,r0,r5
120
1:
121
        l.sflts         r4,r0
122
        l.bnf           1f
123
        l.nop           0
124
        l.addi          r14,r14,1
125
        l.sub           r4,r0,r4
126
1:
127
        l.jal           ___udivsi3
128
        l.addi          r3,r5,0
129
        l.sfeqi         r14,1
130
        l.bnf           1f
131
        l.nop           0
132
        l.sub           r11,r0,r11
133
1:
134
        l.lwz           r9,0(r1)
135
        l.lwz           r14,4(r1)
136
        l.jr            r9
137
        l.addi          r1,r1,8
138
#endif
139
 
140
 
141
#ifdef L__umodsi3
142
ENTRY(___umodsi3)
143
        l.addi          r1,r1,-4
144
        l.sw            0(r1),r9
145
        l.jal           ___udivsi3
146
        l.nop           0
147
        l.addi          r11,r7,0
148
        l.lwz           r9,0(r1)
149
        l.jr            r9
150
        l.addi          r1,r1,4
151
#endif
152
 
153
 
154
#ifdef L__modsi3
155
ENTRY(___modsi3)
156
        l.addi          r1,r1,-8
157
        l.sw            0(r1),r9
158
        l.sw            4(r1),r14
159
        l.addi          r14,r0,0
160
        l.sflts         r3,r0
161
        l.bnf           1f
162
        l.nop           0
163
        l.addi          r14,r0,1
164
        l.sub           r3,r0,r3
165
1:
166
        l.sflts         r4,r0
167
        l.bnf           1f
168
        l.nop           0
169
        l.sub           r4,r0,r4
170
1:
171
        l.jal           ___udivsi3
172
        l.nop           0
173
        l.sfeqi         r14,1
174
        l.bnf           1f
175
        l.addi          r11,r7,0
176
        l.sub           r11,r0,r11
177
1:
178
        l.lwz           r9,0(r1)
179
        l.lwz           r14,4(r1)
180
        l.jr            r9
181
        l.addi          r1,r1,8
182
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.