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

« back to all changes in this revision

Viewing changes to src/gmp/mpn/x86/pentium4/sse2/diveby3.asm

  • Committer: Bazaar Package Importer
  • Author(s): Peter Van Eynde
  • Date: 2007-04-09 11:51:51 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070409115151-ql8cr0kalzx1jmla
Tags: 0.9i-20070324-2
Upload to unstable. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
dnl  Intel Pentium-4 mpn_divexact_by3 -- mpn exact division by 3.
2
2
 
3
3
dnl  Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
4
 
dnl 
 
4
dnl
5
5
dnl  This file is part of the GNU MP Library.
6
 
dnl 
7
 
dnl  The GNU MP Library is free software; you can redistribute it and/or
8
 
dnl  modify it under the terms of the GNU Library General Public License as
9
 
dnl  published by the Free Software Foundation; either version 2 of the
10
 
dnl  License, or (at your option) any later version.
11
 
dnl 
12
 
dnl  The GNU MP Library is distributed in the hope that it will be useful,
13
 
dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 
dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
 
dnl  Library General Public License for more details.
16
 
dnl 
17
 
dnl  You should have received a copy of the GNU Library General Public
18
 
dnl  License along with the GNU MP Library; see the file COPYING.LIB.  If
19
 
dnl  not, write to the Free Software Foundation, Inc., 59 Temple Place -
20
 
dnl  Suite 330, Boston, MA 02111-1307, USA.
 
6
dnl
 
7
dnl  The GNU MP Library is free software; you can redistribute it and/or modify
 
8
dnl  it under the terms of the GNU Lesser General Public License as published
 
9
dnl  by the Free Software Foundation; either version 2 of the License, or (at
 
10
dnl  your option) any later version.
 
11
dnl
 
12
dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 
13
dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 
14
dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
 
15
dnl  License for more details.
 
16
dnl
 
17
dnl  You should have received a copy of the GNU Lesser General Public License
 
18
dnl  along with the GNU MP Library; see the file COPYING.LIB.  If not, write to
 
19
dnl  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
20
dnl  Boston, MA 02110-1301, USA.
21
21
 
22
22
include(`../config.m4')
23
23
 
44
44
C mpn/generic/diveby3.c, with a modified 3*q calculation that can give
45
45
C high(3*q)*inv too.
46
46
 
47
 
 
48
47
defframe(PARAM_CARRY,16)
49
48
defframe(PARAM_SIZE, 12)
50
49
defframe(PARAM_SRC,   8)
51
50
defframe(PARAM_DST,   4)
52
51
 
53
 
        RODATA
54
 
C multiplicative inverse of 3, modulo 2^32
55
 
        ALIGN(4)
56
 
L(inverse):
57
 
        .long   0xAAAAAAAB
58
 
 
59
52
        TEXT
60
53
        ALIGN(16)
61
54
 
66
59
        pxor    %mm0, %mm0
67
60
 
68
61
        movd    PARAM_CARRY, %mm1
 
62
        movl    $0xAAAAAAAB, %ecx
 
63
 
 
64
        movl    PARAM_DST, %edx
69
65
        pcmpeqd %mm6, %mm6
70
66
 
71
 
        movl    $0xAAAAAAAB, %edx
72
 
        movd    %edx, %mm7
 
67
        movd    %ecx, %mm7
 
68
        movl    PARAM_SIZE, %ecx
73
69
 
74
 
        movl    PARAM_DST, %edx
75
70
        psrlq   $32, %mm6               C 0x00000000FFFFFFFF
76
71
 
77
 
        movl    PARAM_SIZE, %ecx
78
72
 
79
73
L(top):
80
74
        C eax   src, incrementing
85
79
        C mm0   carry bit
86
80
        C mm1   carry limb
87
81
        C mm6   0x00000000FFFFFFFF
88
 
        C mm7   inverse
 
82
        C mm7   0xAAAAAAAB, inverse of 3
89
83
 
90
84
        movd    (%eax), %mm2
91
85
        addl    $4, %eax