| 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 |
extern ___gmp_modlimb_invert_table |
| 26 |
global ___gmpn_modexact_1_odd |
| 27 |
global ___gmpn_modexact_1c_odd |
| 28 |
|
| 29 |
%ifdef DLL |
| 30 |
export ___gmpn_modexact_1_odd |
| 31 |
export ___gmpn_modexact_1c_odd |
| 32 |
%endif |
| 33 |
|
| 34 |
align 16 |
| 35 |
___gmpn_modexact_1c_odd: |
| 36 |
movd mm1,[16+esp] |
| 37 |
jmp start_1c |
| 38 |
|
| 39 |
align 16 |
| 40 |
___gmpn_modexact_1_odd: |
| 41 |
pxor mm1,mm1 |
| 42 |
|
| 43 |
start_1c: |
| 44 |
mov eax,[12+esp] |
| 45 |
movd mm7,[12+esp] |
| 46 |
shr eax,1 |
| 47 |
and eax,127 |
| 48 |
movzx eax,byte [___gmp_modlimb_invert_table+eax] |
| 49 |
movd mm6,eax |
| 50 |
movd mm0,eax |
| 51 |
pmuludq mm6,mm6 |
| 52 |
pmuludq mm6,mm7 |
| 53 |
paddd mm0,mm0 |
| 54 |
psubd mm0,mm6 |
| 55 |
pxor mm6,mm6 |
| 56 |
paddd mm6,mm0 |
| 57 |
pmuludq mm0,mm0 |
| 58 |
pmuludq mm0,mm7 |
| 59 |
paddd mm6,mm6 |
| 60 |
mov eax,[4+esp] |
| 61 |
mov ecx,[8+esp] |
| 62 |
psubd mm6,mm0 |
| 63 |
pxor mm0,mm0 |
| 64 |
|
| 65 |
top: |
| 66 |
movd mm2,[eax] |
| 67 |
add eax,4 |
| 68 |
psubq mm2,mm0 |
| 69 |
psubq mm2,mm1 |
| 70 |
movq mm0,mm2 |
| 71 |
psrlq mm0,63 |
| 72 |
pmuludq mm2,mm6 |
| 73 |
movq mm1,mm7 |
| 74 |
pmuludq mm1,mm2 |
| 75 |
psrlq mm1,32 |
| 76 |
sub ecx,1 |
| 77 |
jnz top |
| 78 |
|
| 79 |
done: |
| 80 |
paddq mm0,mm1 |
| 81 |
movd eax,mm0 |
| 82 |
emms |
| 83 |
ret |
| 84 |
|
| 85 |
end |