I would like to convert this code from NASM 32-bit SSE to NASM 64-AVX. Is it possible to find a way to do it easily?
For conversion into 64-bit code, I would attempt to completely rewrite the 32-bit code. However, I assume this is very hard work, and I suppose that there is an almost automatic way to do everything.
Are you aware of any kind of process like this? For example replacing the name of the registers?
Example:
- Change
eax
torax
,ebx
torbx
, and so on... - Change
movaps
withvmovaps
and so on... - ...
Here is my 32-bit NASM source code:
section .text
global test
a equ 8
b equ 12
num equ 16
spuri equ 20
result equ 24
test:
push ebp
mov ebp, esp
push ebx
push esi
push edi
mov esi, [ebp+a]
mov edi, [ebp+b]
mov ebx, 0
mov ecx, [ebp+num]
mov edx, [ebp+spuri]
mov eax,[ebp+result]
xorps xmm1,xmm1
xorps xmm3,xmm3
loop1:
cmp ecx,0
je end
movups xmm0, [esi+ebx]
movups xmm6, [edi+ebx]
subps xmm0, xmm6
mulps xmm0, xmm0
sqrtps xmm0, xmm0
addps xmm1, xmm0
add ebx, 16
dec ecx
jnz loop1
end:
haddps xmm1,xmm1
haddps xmm1,xmm1
addps xmm1,xmm3
movups [eax],xmm1
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
I have tried to convert this code but without any good result.