| 1 |
|
| 2 |
; Copyright 1992, 1994, 1997, 1999, 2000, 2001, 2002 Free Software |
| 3 |
; Foundation, Inc. |
| 4 |
; |
| 5 |
; This file is part of the GNU MP Library. |
| 6 |
; |
| 7 |
; The GNU MP Library is free software; you can redistribute it and/or |
| 8 |
; modify it under the terms of the GNU Lesser General Public License as |
| 9 |
; published by the Free Software Foundation; either version 2.1 of the |
| 10 |
; License, or (at your option) any later version. |
| 11 |
; |
| 12 |
; The GNU MP Library is distributed in the hope that it will be useful, |
| 13 |
; but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 |
; Lesser General Public License for more details. |
| 16 |
; |
| 17 |
; You should have received a copy of the GNU Lesser General Public |
| 18 |
; License along with the GNU MP Library; see the file COPYING.LIB. If |
| 19 |
; not, write to the Free Software Foundation, Inc., 59 Temple Place - |
| 20 |
; Suite 330, Boston, MA 02111-1307, USA. |
| 21 |
; |
| 22 |
; Translation of AT&T syntax code by Brian Gladman |
| 23 |
|
| 24 |
%include "x86i.inc" |
| 25 |
|
| 26 |
%define PARAM_MULTIPLIER esp+frame+16 |
| 27 |
%define PARAM_SIZE esp+frame+12 |
| 28 |
%define PARAM_SRC esp+frame+8 |
| 29 |
%define PARAM_DST esp+frame+4 |
| 30 |
%assign frame 16 |
| 31 |
|
| 32 |
%macro mac_sub 3 |
| 33 |
|
| 34 |
global %1%3 |
| 35 |
%ifdef DLL |
| 36 |
export %1%3 |
| 37 |
%endif |
| 38 |
|
| 39 |
align 8 |
| 40 |
%1%3: |
| 41 |
push edi |
| 42 |
push esi |
| 43 |
push ebx |
| 44 |
push ebp |
| 45 |
mov edi,[PARAM_DST] |
| 46 |
mov esi,[PARAM_SRC] |
| 47 |
mov ecx,[PARAM_SIZE] |
| 48 |
xor ebx,ebx |
| 49 |
and ecx,3 |
| 50 |
jz %%2 |
| 51 |
%%1: |
| 52 |
mov eax,[esi] |
| 53 |
mul dword [PARAM_MULTIPLIER] |
| 54 |
lea esi,[4+esi] |
| 55 |
add eax,ebx |
| 56 |
mov ebx,0 |
| 57 |
adc edx,ebx |
| 58 |
%2 [edi],eax |
| 59 |
adc ebx,edx ; propagate carry into cylimb |
| 60 |
lea edi,[4+edi] |
| 61 |
dec ecx |
| 62 |
jnz %%1 |
| 63 |
%%2: |
| 64 |
mov ecx,[PARAM_SIZE] |
| 65 |
shr ecx,2 |
| 66 |
jz %%4 |
| 67 |
|
| 68 |
align 8 |
| 69 |
%%3: |
| 70 |
mov eax,[esi] |
| 71 |
mul dword [PARAM_MULTIPLIER] |
| 72 |
add ebx,eax |
| 73 |
mov ebp,0 |
| 74 |
adc ebp,edx |
| 75 |
mov eax,[4+esi] |
| 76 |
mul dword [PARAM_MULTIPLIER] |
| 77 |
%2 [edi],ebx |
| 78 |
adc ebp,eax ; new lo + cylimb |
| 79 |
mov ebx,0 |
| 80 |
adc ebx,edx |
| 81 |
mov eax,[8+esi] |
| 82 |
mul dword [PARAM_MULTIPLIER] |
| 83 |
%2 [4+edi],ebp |
| 84 |
adc ebx,eax ; new lo + cylimb |
| 85 |
mov ebp,0 |
| 86 |
adc ebp,edx |
| 87 |
mov eax,[12+esi] |
| 88 |
mul dword [PARAM_MULTIPLIER] |
| 89 |
%2 [8+edi],ebx |
| 90 |
adc ebp,eax ; new lo + cylimb |
| 91 |
mov ebx,0 |
| 92 |
adc ebx,edx |
| 93 |
%2 [12+edi],ebp |
| 94 |
adc ebx,0 ; propagate carry into cylimb |
| 95 |
lea esi,[16+esi] |
| 96 |
lea edi,[16+edi] |
| 97 |
dec ecx |
| 98 |
jnz %%3 |
| 99 |
%%4: |
| 100 |
mov eax,ebx |
| 101 |
pop ebp |
| 102 |
pop ebx |
| 103 |
pop esi |
| 104 |
pop edi |
| 105 |
ret |
| 106 |
%endmacro |
| 107 |
|
| 108 |
section .text |
| 109 |
|
| 110 |
mac_sub ___g,add,mpn_addmul_1 |
| 111 |
mac_sub ___g,sub,mpn_submul_1 |
| 112 |
|
| 113 |
end |