5113f6f70
김현기
kernel add
|
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
|
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/types.h>
#include <asm/byteorder.h>
#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
__asm__ ("addcc %r4,%5,%1
\t" \
"addx %r2,%3,%0
" \
: "=r" (sh), \
"=&r" (sl) \
: "%rJ" ((USItype)(ah)), \
"rI" ((USItype)(bh)), \
"%rJ" ((USItype)(al)), \
"rI" ((USItype)(bl)) \
: "cc")
#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
__asm__ ("subcc %r4,%5,%1
\t" \
"subx %r2,%3,%0
" \
: "=r" (sh), \
"=&r" (sl) \
: "rJ" ((USItype)(ah)), \
"rI" ((USItype)(bh)), \
"rJ" ((USItype)(al)), \
"rI" ((USItype)(bl)) \
: "cc")
#define umul_ppmm(w1, w0, u, v) \
__asm__ ("! Inlined umul_ppmm
\t" \
"wr %%g0,%2,%%y ! SPARC has 0-3 delay insn after a wr
\t" \
"sra %3,31,%%g2 ! Don't move this insn
\t" \
"and %2,%%g2,%%g2 ! Don't move this insn
\t" \
"andcc %%g0,0,%%g1 ! Don't move this insn
\t" \
"mulscc %%g1,%3,%%g1
\t" \
"mulscc %%g1,%3,%%g1
\t" \
"mulscc %%g1,%3,%%g1
\t" \
"mulscc %%g1,%3,%%g1
\t" \
"mulscc %%g1,%3,%%g1
\t" \
"mulscc %%g1,%3,%%g1
\t" \
"mulscc %%g1,%3,%%g1
\t" \
"mulscc %%g1,%3,%%g1
\t" \
"mulscc %%g1,%3,%%g1
\t" \
"mulscc %%g1,%3,%%g1
\t" \
"mulscc %%g1,%3,%%g1
\t" \
"mulscc %%g1,%3,%%g1
\t" \
"mulscc %%g1,%3,%%g1
\t" \
"mulscc %%g1,%3,%%g1
\t" \
"mulscc %%g1,%3,%%g1
\t" \
"mulscc %%g1,%3,%%g1
\t" \
"mulscc %%g1,%3,%%g1
\t" \
"mulscc %%g1,%3,%%g1
\t" \
"mulscc %%g1,%3,%%g1
\t" \
"mulscc %%g1,%3,%%g1
\t" \
"mulscc %%g1,%3,%%g1
\t" \
"mulscc %%g1,%3,%%g1
\t" \
"mulscc %%g1,%3,%%g1
\t" \
"mulscc %%g1,%3,%%g1
\t" \
"mulscc %%g1,%3,%%g1
\t" \
"mulscc %%g1,%3,%%g1
\t" \
"mulscc %%g1,%3,%%g1
\t" \
"mulscc %%g1,%3,%%g1
\t" \
"mulscc %%g1,%3,%%g1
\t" \
"mulscc %%g1,%3,%%g1
\t" \
"mulscc %%g1,%3,%%g1
\t" \
"mulscc %%g1,%3,%%g1
\t" \
"mulscc %%g1,0,%%g1
\t" \
"add %%g1,%%g2,%0
\t" \
"rd %%y,%1
" \
: "=r" (w1), \
"=r" (w0) \
: "%rI" ((USItype)(u)), \
"r" ((USItype)(v)) \
: "%g1", "%g2", "cc")
/* It's quite necessary to add this much assembler for the sparc.
The default udiv_qrnnd (in C) is more than 10 times slower! */
#define udiv_qrnnd(q, r, n1, n0, d) \
__asm__ ("! Inlined udiv_qrnnd
\t" \
"mov 32,%%g1
\t" \
"subcc %1,%2,%%g0
\t" \
"1: bcs 5f
\t" \
"addxcc %0,%0,%0 ! shift n1n0 and a q-bit in lsb
\t" \
"sub %1,%2,%1 ! this kills msb of n
\t" \
"addx %1,%1,%1 ! so this can't give carry
\t" \
"subcc %%g1,1,%%g1
\t" \
"2: bne 1b
\t" \
"subcc %1,%2,%%g0
\t" \
"bcs 3f
\t" \
"addxcc %0,%0,%0 ! shift n1n0 and a q-bit in lsb
\t" \
"b 3f
\t" \
"sub %1,%2,%1 ! this kills msb of n
\t" \
"4: sub %1,%2,%1
\t" \
"5: addxcc %1,%1,%1
\t" \
"bcc 2b
\t" \
"subcc %%g1,1,%%g1
\t" \
"! Got carry from n. Subtract next step to cancel this carry.
\t" \
"bne 4b
\t" \
"addcc %0,%0,%0 ! shift n1n0 and a 0-bit in lsb
\t" \
"sub %1,%2,%1
\t" \
"3: xnor %0,0,%0
\t" \
"! End of inline udiv_qrnnd
" \
: "=&r" (q), \
"=&r" (r) \
: "r" ((USItype)(d)), \
"1" ((USItype)(n1)), \
"0" ((USItype)(n0)) : "%g1", "cc")
#define UDIV_NEEDS_NORMALIZATION 0
#define abort() \
return 0
#ifdef __BIG_ENDIAN
#define __BYTE_ORDER __BIG_ENDIAN
#else
#define __BYTE_ORDER __LITTLE_ENDIAN
#endif
|