| 1 |
|
| 2 |
; Copyright 2001, 2002 Free Software Foundation, Inc. |
| 3 |
; |
| 4 |
; This file is part of the GNU MP Library. |
| 5 |
; |
| 6 |
; The GNU MP Library is free software; you can redistribute it and/or |
| 7 |
; modify it under the terms of the GNU Lesser General Public License as |
| 8 |
; published by the Free Software Foundation; either version 2.1 of the |
| 9 |
; License, or (at your option) any later version. |
| 10 |
; |
| 11 |
; The GNU MP Library is distributed in the hope that it will be useful, |
| 12 |
; but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 |
; Lesser General Public License for more details. |
| 15 |
; |
| 16 |
; You should have received a copy of the GNU Lesser General Public |
| 17 |
; License along with the GNU MP Library; see the file COPYING.LIB. If |
| 18 |
; not, write to the Free Software Foundation, Inc., 59 Temple Place - |
| 19 |
; Suite 330, Boston, MA 02111-1307, USA. |
| 20 |
; |
| 21 |
; Translation of AT&T syntax code by Brian Gladman |
| 22 |
|
| 23 |
section .text |
| 24 |
|
| 25 |
global ___gmpn_mul_basecase |
| 26 |
%ifdef DLL |
| 27 |
export ___gmpn_mul_basecase |
| 28 |
%endif |
| 29 |
|
| 30 |
align 8 |
| 31 |
___gmpn_mul_basecase: |
| 32 |
mov eax,[8+esp] |
| 33 |
mov [8+esp],ebx |
| 34 |
pxor mm0,mm0 |
| 35 |
mov edx,[16+esp] |
| 36 |
mov [16+esp],esi |
| 37 |
mov ebx,[4+esp] |
| 38 |
mov [4+esp],ebp |
| 39 |
mov esi,eax |
| 40 |
movd mm7,[edx] |
| 41 |
mov ecx,[12+esp] |
| 42 |
mov ebp,[20+esp] |
| 43 |
mov [20+esp],edi |
| 44 |
mov edi,ebx |
| 45 |
|
| 46 |
mul1: |
| 47 |
movd mm1,[eax] |
| 48 |
add eax,4 |
| 49 |
pmuludq mm1,mm7 |
| 50 |
paddq mm0,mm1 |
| 51 |
movd [ebx],mm0 |
| 52 |
add ebx,4 |
| 53 |
psrlq mm0,32 |
| 54 |
sub ecx,1 |
| 55 |
jnz mul1 |
| 56 |
movd [ebx],mm0 |
| 57 |
sub ebp,1 |
| 58 |
jz done |
| 59 |
|
| 60 |
outer: |
| 61 |
mov eax,esi |
| 62 |
lea ebx,[4+edi] |
| 63 |
add edi,4 |
| 64 |
movd mm7,[4+edx] |
| 65 |
add edx,4 |
| 66 |
pxor mm0,mm0 |
| 67 |
mov ecx,[12+esp] |
| 68 |
|
| 69 |
inner: |
| 70 |
movd mm1,[eax] |
| 71 |
lea eax,[4+eax] |
| 72 |
movd mm2,[ebx] |
| 73 |
pmuludq mm1,mm7 |
| 74 |
paddq mm1,mm2 |
| 75 |
paddq mm0,mm1 |
| 76 |
sub ecx,1 |
| 77 |
movd [ebx],mm0 |
| 78 |
psrlq mm0,32 |
| 79 |
lea ebx,[4+ebx] |
| 80 |
jnz inner |
| 81 |
movd [ebx],mm0 |
| 82 |
sub ebp,1 |
| 83 |
jnz outer |
| 84 |
|
| 85 |
done: |
| 86 |
mov ebx,[8+esp] |
| 87 |
mov esi,[16+esp] |
| 88 |
mov edi,[20+esp] |
| 89 |
mov ebp,[4+esp] |
| 90 |
emms |
| 91 |
ret |
| 92 |
|
| 93 |
end |