| 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 Library General Public License as |
| 8 |
; published by the Free Software Foundation; either version 2 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 |
; Library General Public License for more details. |
| 15 |
; |
| 16 |
; You should have received a copy of the GNU Library 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_divexact_by3c |
| 26 |
%ifdef DLL |
| 27 |
export ___gmpn_divexact_by3c |
| 28 |
%endif |
| 29 |
|
| 30 |
align 16 |
| 31 |
___gmpn_divexact_by3c: |
| 32 |
mov eax,[8+esp] |
| 33 |
pxor mm0,mm0 |
| 34 |
movd mm1,[16+esp] |
| 35 |
pcmpeqd mm6,mm6 |
| 36 |
movd mm7,[val] |
| 37 |
mov edx,[4+esp] |
| 38 |
psrlq mm6,32 |
| 39 |
mov ecx,[12+esp] |
| 40 |
|
| 41 |
top: |
| 42 |
movd mm2,[eax] |
| 43 |
add eax,4 |
| 44 |
psubq mm2,mm0 |
| 45 |
psubq mm2,mm1 |
| 46 |
movq mm0,mm2 |
| 47 |
psrlq mm0,63 |
| 48 |
pmuludq mm2,mm7 |
| 49 |
movd [edx],mm2 |
| 50 |
add edx,4 |
| 51 |
movq mm1,mm6 |
| 52 |
pand mm1,mm2 |
| 53 |
pand mm2,mm6 |
| 54 |
psllq mm1,1 |
| 55 |
paddq mm1,mm2 |
| 56 |
psrlq mm1,32 |
| 57 |
sub ecx,1 |
| 58 |
jnz top |
| 59 |
paddd mm0,mm1 |
| 60 |
movd eax,mm0 |
| 61 |
emms |
| 62 |
ret |
| 63 |
|
| 64 |
section .data |
| 65 |
val: |
| 66 |
dd 0xAAAAAAAB |
| 67 |
|
| 68 |
end |