aboutsummaryrefslogtreecommitdiff
path: root/pk/fp_asm.S
blob: 0a9f34b2d1f9e8dba211eba203f49c1b97849d8c (plain)
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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
// See LICENSE for license details.

#define get_f32(which) fmv.x.s a0, which; ret
#define put_f32(which) fmv.s.x which, a0; ret
#ifdef __riscv64
# define get_f64(which) fmv.x.d a0, which; ret
# define put_f64(which) fmv.d.x which, a0; ret
#else
# define get_f64(which) fsd which, 0(a0); ret
# define put_f64(which) fld which, 0(a0); ret
#endif

  .text
  .globl get_f32_reg
  get_f32_reg:
    get_f32(f0)
    get_f32(f1)
    get_f32(f2)
    get_f32(f3)
    get_f32(f4)
    get_f32(f5)
    get_f32(f6)
    get_f32(f7)
    get_f32(f8)
    get_f32(f9)
    get_f32(f10)
    get_f32(f11)
    get_f32(f12)
    get_f32(f13)
    get_f32(f14)
    get_f32(f15)
    get_f32(f16)
    get_f32(f17)
    get_f32(f18)
    get_f32(f19)
    get_f32(f20)
    get_f32(f21)
    get_f32(f22)
    get_f32(f23)
    get_f32(f24)
    get_f32(f25)
    get_f32(f26)
    get_f32(f27)
    get_f32(f28)
    get_f32(f29)
    get_f32(f30)
    get_f32(f31)
  
  .text
  .globl put_f32_reg
  put_f32_reg:
    put_f32(f0)
    put_f32(f1)
    put_f32(f2)
    put_f32(f3)
    put_f32(f4)
    put_f32(f5)
    put_f32(f6)
    put_f32(f7)
    put_f32(f8)
    put_f32(f9)
    put_f32(f10)
    put_f32(f11)
    put_f32(f12)
    put_f32(f13)
    put_f32(f14)
    put_f32(f15)
    put_f32(f16)
    put_f32(f17)
    put_f32(f18)
    put_f32(f19)
    put_f32(f20)
    put_f32(f21)
    put_f32(f22)
    put_f32(f23)
    put_f32(f24)
    put_f32(f25)
    put_f32(f26)
    put_f32(f27)
    put_f32(f28)
    put_f32(f29)
    put_f32(f30)
    put_f32(f31)
  
  .text
  .globl get_f64_reg
  get_f64_reg:
    get_f64(f0)
    get_f64(f1)
    get_f64(f2)
    get_f64(f3)
    get_f64(f4)
    get_f64(f5)
    get_f64(f6)
    get_f64(f7)
    get_f64(f8)
    get_f64(f9)
    get_f64(f10)
    get_f64(f11)
    get_f64(f12)
    get_f64(f13)
    get_f64(f14)
    get_f64(f15)
    get_f64(f16)
    get_f64(f17)
    get_f64(f18)
    get_f64(f19)
    get_f64(f20)
    get_f64(f21)
    get_f64(f22)
    get_f64(f23)
    get_f64(f24)
    get_f64(f25)
    get_f64(f26)
    get_f64(f27)
    get_f64(f28)
    get_f64(f29)
    get_f64(f30)
    get_f64(f31)
  
  .text
  .globl put_f64_reg
  put_f64_reg:
    put_f64(f0)
    put_f64(f1)
    put_f64(f2)
    put_f64(f3)
    put_f64(f4)
    put_f64(f5)
    put_f64(f6)
    put_f64(f7)
    put_f64(f8)
    put_f64(f9)
    put_f64(f10)
    put_f64(f11)
    put_f64(f12)
    put_f64(f13)
    put_f64(f14)
    put_f64(f15)
    put_f64(f16)
    put_f64(f17)
    put_f64(f18)
    put_f64(f19)
    put_f64(f20)
    put_f64(f21)
    put_f64(f22)
    put_f64(f23)
    put_f64(f24)
    put_f64(f25)
    put_f64(f26)
    put_f64(f27)
    put_f64(f28)
    put_f64(f29)
    put_f64(f30)
    put_f64(f31)
  
	.text
	.globl	get_fp_state
get_fp_state:

	fsd		f0 ,  0(a0)
	fsd		f1 ,  8(a0)
	fsd		f2 , 16(a0)
	fsd		f3 , 24(a0)
	fsd		f4 , 32(a0)
	fsd		f5 , 40(a0)
	fsd		f6 , 48(a0)
	fsd		f7 , 56(a0)
	fsd		f8 , 64(a0)
	fsd		f9 , 72(a0)
	fsd		f10, 80(a0)
	fsd		f11, 88(a0)
	fsd		f12, 96(a0)
	fsd		f13,104(a0)
	fsd		f14,112(a0)
	fsd		f15,120(a0)
	fsd		f16,128(a0)
	fsd		f17,136(a0)
	fsd		f18,144(a0)
	fsd		f19,152(a0)
	fsd		f20,160(a0)
	fsd		f21,168(a0)
	fsd		f22,176(a0)
	fsd		f23,184(a0)
	fsd		f24,192(a0)
	fsd		f25,200(a0)
	fsd		f26,208(a0)
	fsd		f27,216(a0)
	fsd		f28,224(a0)
	fsd		f29,232(a0)
	fsd		f30,240(a0)
	fsd		f31,248(a0)

	frsr	a0
	ret

	.globl	put_fp_state
put_fp_state:

	fld		f0 ,  0(a0)
	fld		f1 ,  8(a0)
	fld		f2 , 16(a0)
	fld		f3 , 24(a0)
	fld		f4 , 32(a0)
	fld		f5 , 40(a0)
	fld		f6 , 48(a0)
	fld		f7 , 56(a0)
	fld		f8 , 64(a0)
	fld		f9 , 72(a0)
	fld		f10, 80(a0)
	fld		f11, 88(a0)
	fld		f12, 96(a0)
	fld		f13,104(a0)
	fld		f14,112(a0)
	fld		f15,120(a0)
	fld		f16,128(a0)
	fld		f17,136(a0)
	fld		f18,144(a0)
	fld		f19,152(a0)
	fld		f20,160(a0)
	fld		f21,168(a0)
	fld		f22,176(a0)
	fld		f23,184(a0)
	fld		f24,192(a0)
	fld		f25,200(a0)
	fld		f26,208(a0)
	fld		f27,216(a0)
	fld		f28,224(a0)
	fld		f29,232(a0)
	fld		f30,240(a0)
	fld		f31,248(a0)

	fssr	a1

	ret