~ubuntu-branches/ubuntu/intrepid/ecl/intrepid

« back to all changes in this revision

Viewing changes to msvc/gmp/mpn/x86i/pentium4/sse2/mod_34lsub1.asm

  • Committer: Bazaar Package Importer
  • Author(s): Peter Van Eynde
  • Date: 2006-05-17 02:46:26 UTC
  • Revision ID: james.westby@ubuntu.com-20060517024626-lljr08ftv9g9vefl
Tags: upstream-0.9h-20060510
ImportĀ upstreamĀ versionĀ 0.9h-20060510

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
;  Copyright 2000, 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_mod_34lsub1
 
26
%ifdef  DLL
 
27
        export  ___gmpn_mod_34lsub1
 
28
%endif
 
29
 
 
30
        align   16
 
31
___gmpn_mod_34lsub1: 
 
32
    mov     ecx,[8+esp]
 
33
    mov     edx,[4+esp]
 
34
    mov     eax,[edx]
 
35
    sub     ecx,2
 
36
    ja      three_or_more
 
37
    jne     one
 
38
    mov     edx,[4+edx]
 
39
    mov     ecx,eax
 
40
    shr     eax,24
 
41
    and     ecx,0x00FFFFFF
 
42
    add     eax,ecx
 
43
    mov     ecx,edx
 
44
    shl     edx,8
 
45
    shr     ecx,16
 
46
    add     eax,ecx
 
47
    and     edx,0x00FFFF00
 
48
    add     eax,edx
 
49
one:ret
 
50
 
 
51
three_or_more: 
 
52
    pxor    mm0,mm0
 
53
    pxor    mm1,mm1
 
54
    pxor    mm2,mm2
 
55
    pcmpeqd mm7,mm7
 
56
    psrlq   mm7,32
 
57
    pcmpeqd mm6,mm6
 
58
    psrlq   mm6,40
 
59
 
 
60
top: 
 
61
        movd    mm3,[edx]
 
62
        paddq   mm0,mm3
 
63
        movd    mm3,[4+edx]
 
64
        paddq   mm1,mm3
 
65
    movd    mm3,[8+edx]
 
66
        paddq   mm2,mm3
 
67
    add     edx,12
 
68
    sub     ecx,3
 
69
    ja      top
 
70
    add     ecx,1
 
71
    js      combine
 
72
    movd    mm3,[edx]
 
73
        paddq   mm0,mm3
 
74
        jz      combine
 
75
        movd    mm3,[4+edx]
 
76
        paddq   mm1,mm3
 
77
 
 
78
combine: 
 
79
    movq    mm3,mm7
 
80
    pand    mm3,mm0
 
81
    movq    mm4,mm7
 
82
    pand    mm4,mm1
 
83
    movq    mm5,mm7
 
84
    pand    mm5,mm2
 
85
    psrlq   mm0,32
 
86
    psrlq   mm1,32
 
87
    psrlq   mm2,32
 
88
        paddq   mm4,mm0
 
89
        paddq   mm5,mm1
 
90
        paddq   mm3,mm2
 
91
    psllq   mm4,8
 
92
    psllq   mm5,16
 
93
        paddq   mm3,mm4
 
94
        paddq   mm3,mm5
 
95
    pand    mm6,mm3
 
96
    psrlq   mm3,24
 
97
        paddq   mm3,mm6
 
98
    movd    eax,mm3
 
99
    emms
 
100
    ret
 
101
 
 
102
        end