-
Notifications
You must be signed in to change notification settings - Fork 0
/
fftasm64.s
281 lines (265 loc) · 7.68 KB
/
fftasm64.s
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
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
; Copyright (c) <2012> <Leif Asbrink>
;
; Permission is hereby granted, free of charge, to any person
; obtaining a copy of this software and associated documentation
; files (the "Software"), to deal in the Software without restriction,
; including without limitation the rights to use, copy, modify,
; merge, publish, distribute, sublicense, and/or sell copies of
; the Software, and to permit persons to whom the Software is
; furnished to do so, subject to the following conditions:
;
; The above copyright notice and this permission notice shall be
; included in all copies or substantial portions of the Software.
;
; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
; OR OTHER DEALINGS IN THE SOFTWARE.
%ifdef OS_LINUX
extern lir_sched_yield
global asmbulk_of_dual_dif
global asmbulk_of_dif
%endif
%ifdef OS_WINDOWS
extern _lir_sched_yield
global _asmbulk_of_dual_dif
global _asmbulk_of_dif
lir_sched_yield equ _lir_sched_yield
%endif
TMP1 equ 0
TMP2 equ 4
TMP4 equ 8
TMP5 equ 12
TMP6 equ 16
TMP7 equ 20
TMP8 equ 24
TMP9 equ 28
TMP10 equ 32
TMP11 equ 36
section .text
asmbulk_of_dual_dif
_asmbulk_of_dual_dif
push rbp
mov rbp,rsp
push rdi
push rsi
push rdx
push rcx
push rbx
sub rsp,5CH
mov eax,[ebp+24] ;yield_flag
mov [TMP11+esp],eax
mov eax,[ebp+8] ;size
mov edi,[ebp+12] ;n
shl eax,1
mov ebx,[ebp+16] ;x
sub edi,2
mov ecx,[ebp+20] ;cosin table
mov [TMP5+esp],eax
shl eax,1
mov [TMP4+esp],edi
mov [TMP1+esp],eax
shl eax,1
mov [TMP6+esp],ebx
mov ebp,eax
mov [TMP10+esp],ecx
mov dword[TMP2+esp],16
mov dword[TMP7+esp],0
mov [TMP4+esp],edi
L$1:
cmp dword [TMP11+esp],0
jz LNY1
push rbp
call lir_sched_yield
pop rbp
LNY1:
mov eax,[TMP5+esp]
xor edx,edx
sal eax,3
sub eax,ebp
mov dword [TMP9+esp],eax
mov eax,dword [TMP1+esp]
mov dword [TMP8+esp],eax
L$2:
mov esi,edx
mov edi,dword [TMP1+esp]
add esi,dword [TMP6+esp]
add edi,esi
mov eax,dword [TMP8+esp]
mov ebx,dword [TMP10+esp]
add eax,esi
mov ecx,dword [TMP2+esp]
L$3: ;st0 st1 st2 st3 st4 st5 st6 st7
fld dword [esi] ; A
fsub dword [eax] ; U
fld dword [esi] ; A A
fadd dword [eax] ; a U
fstp dword [esi] ; U
fld st0 ; U U
fld dword [4+esi] ; C U U
fsub dword [4+eax] ; V U U
fld dword [4+esi] ; C V U U
fadd dword [4+eax] ; b V U U
fstp dword [4+esi] ; V U U
fld st0 ; V V U U
fld dword[ebx] ;sin V V U U
fmul st4,st0 ;sin V V U Us
fmulp st2,st0 ; V Vs U Us
fld dword[4+ebx] ;cos V Vs U Us
fmul st3,st0 ;cos V Vs Uc Us
fmulp st1,st0 ; Vc Vs Uc Us
faddp st3,st0 ; Vs Uc (Vc+Us)
fsubp st1,st0
fstp dword[eax]
fstp dword[4+eax]
;***********************
fld dword [esi+8] ; A
fsub dword [eax+8] ; U
fld dword [esi+8] ; A A
fadd dword [eax+8] ; a U
fstp dword [esi+8] ; U
fld st0 ; U U
fld dword [4+esi+8] ; C U U
fsub dword [4+eax+8] ; V U U
fld dword [4+esi+8] ; C V U U
fadd dword [4+eax+8] ; b V U U
fstp dword [4+esi+8] ; V U U
fld st0 ; V V U U
fld dword[ebx] ;sin V V U U
fmul st4,st0 ;sin V V U Us
fmulp st2,st0 ; V Vs U Us
fld dword[4+ebx] ;cos V Vs U Us
add ebx,ecx
fmul st3,st0 ;cos V Vs Uc Us
fmulp st1,st0 ; Vc Vs Uc Us
add eax,16
faddp st3,st0 ; Vs Uc (Vc+Us)
fsubp st1,st0
add esi,16
fstp dword[eax-8]
fstp dword[4+eax-8]
cmp esi,edi
jl near L$3
add edx,ebp
cmp edx,dword [TMP9+esp]
jle near L$2
shr ebp,1
shr dword [TMP1+esp],1
shl dword [TMP2+esp],1
mov edi,dword [TMP7+esp]
inc edi
mov dword [TMP7+esp],edi
cmp edi,dword [TMP4+esp]
jl near L$1
add rsp,5CH
pop rbx
pop rcx
pop rdx
pop rsi
pop rdi
pop rbp
ret
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
asmbulk_of_dif
_asmbulk_of_dif equ asmbulk_of_dif
push rbp
mov rbp,rsp
push rdi
push rsi
push rdx
push rcx
push rbx
sub rsp,5CH
mov eax,[ebp+24] ;yield_flag
mov [TMP11+esp],eax
mov eax,[ebp+8] ;size
mov edi,[ebp+12] ;n
mov ebx,[ebp+16] ;x
sub edi,2
mov ecx,[ebp+20] ;cosin table
mov [TMP5+esp],eax
shl eax,1
mov [TMP4+esp],edi
mov [TMP1+esp],eax
shl eax,1
mov [TMP6+esp],ebx
mov ebp,eax
mov [TMP10+esp],ecx
mov dword[TMP2+esp],16
mov dword[TMP7+esp],0
mov [TMP4+esp],edi
M$1:
cmp dword [TMP11+esp],0
jz MNY1
push rbp
call lir_sched_yield
pop rbp
MNY1:
mov eax,[TMP5+esp]
xor edx,edx
sal eax,3
sub eax,ebp
mov dword [TMP9+esp],eax
mov eax,dword [TMP1+esp]
mov dword [TMP8+esp],eax
M$2:
mov esi,edx
mov edi,dword [TMP1+esp]
add esi,dword [TMP6+esp]
add edi,esi
mov eax,dword [TMP8+esp]
mov ebx,dword [TMP10+esp]
add eax,esi
mov ecx,dword [TMP2+esp]
M$3: ;st0 st1 st2 st3 st4 st5 st6 st7
fld dword [esi] ; A
fsub dword [eax] ; U
fld dword [esi] ; A A
fadd dword [eax] ; a U
fstp dword [esi] ; U
fld st0 ; U U
fld dword [4+esi] ; C U U
fsub dword [4+eax] ; V U U
fld dword [4+esi] ; C V U U
fadd dword [4+eax] ; b V U U
fstp dword [4+esi] ; V U U
fld st0 ; V V U U
fld dword[ebx] ;sin V V U U
fmul st4,st0 ;sin V V U Us
fmulp st2,st0 ; V Vs U Us
fld dword[4+ebx] ;cos V Vs U Us
add ebx,ecx
fmul st3,st0 ;cos V Vs Uc Us
add eax,8
fmulp st1,st0 ; Vc Vs Uc Us
faddp st3,st0 ; Vs Uc (Vc+Us)
add esi,8
fsubp st1,st0
fstp dword[-8+eax]
fstp dword[-4+eax]
cmp esi,edi
jl near M$3
add edx,ebp
cmp edx,dword [TMP9+esp]
jle near M$2
shr ebp,1
shr dword [TMP1+esp],1
shl dword [TMP2+esp],1
mov edi,dword [TMP7+esp]
inc edi
mov dword [TMP7+esp],edi
cmp edi,dword [TMP4+esp]
jl near M$1
add rsp,5CH
pop rbx
pop rcx
pop rdx
pop rsi
pop rdi
pop rbp
ret