matrix multiplication
From: AsYoDe (heeeeres_at_johny.pl)
Date: 04/16/04
- Next message: Ro : "Re: return value"
- Previous message: Kevin G. Rhoads: "Re: floppy based assembler ?"
- Next in thread: Daniel Pfeffer: "Re: matrix multiplication"
- Reply: Daniel Pfeffer: "Re: matrix multiplication"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 16 Apr 2004 17:56:49 +0000 (UTC)
Hi.
About 2 hours ago I wrote following code.
How can even more optimize it not using
mmx instructions?
Sorry for my english,
and thx from advance.
AsYoDe
--code-- [NASM syntax]
xor eax, eax xor ebx, ebx
xor ecx, ecx
xor edx, edx
xor esi, esi
;array A i[ebx] wiersz, k[edi] kolumna
;array B k[edi] wiersz, j[ecx] kolumna
;array C i, j
;esi contains addictions of mul result
mov ebx, 4 ;we beginning from the end
loop1:
dec ebx
mov ecx, 4
loop2:
dec ecx
mov edi, 4
xor esi, esi ;
loop3:
dec edi ;
mov ax, [A + 4*ebx + edi] ;load value from A
mov dx, [B + 4*edi + ecx] ;from B
mul dx
shl edx, 8 ;shift bits to the MS part of register
mov dx, ax ; now in edx i have complete result
add esi, edx ;add the result
test edi, FFFFFFFFh
jnz loop3 ;if edi<>0 then repeat loop
mov [C + 4*ebx + ecx], esi ;write result to the C
test ecx, FFFFFFFFh ;
jnz loop2 ;if index <>0 then repeat
test ebx, FFFFFFFFh ;
jnz loop1 ;the same for i index
- Next message: Ro : "Re: return value"
- Previous message: Kevin G. Rhoads: "Re: floppy based assembler ?"
- Next in thread: Daniel Pfeffer: "Re: matrix multiplication"
- Reply: Daniel Pfeffer: "Re: matrix multiplication"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|