1
dnl Intel Pentium mpn_com_n -- mpn ones complement.
3
dnl Copyright 1996, 2001, 2002 Free Software Foundation, Inc.
5
dnl This file is part of the GNU MP Library.
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 Lesser General Public License as
9
dnl published by the Free Software Foundation; either version 2.1 of the
10
dnl License, or (at your option) any later version.
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 Lesser General Public License for more details.
17
dnl You should have received a copy of the GNU Lesser 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.
22
include(`../config.m4')
25
C P5: 1.75 cycles/limb
31
C void mpn_com_n (mp_ptr dst, mp_srcptr src, mp_size_t size);
33
C This code is similar to mpn_copyi, basically there's just some "xorl
34
C $GMP_NUMB_MASK"s inserted.
38
C On P55 some MMX code could be 1.25 c/l (8 limb unrolled) if src and dst
39
C are the same alignment mod 8, but it doesn't seem worth the trouble for
40
C just that case (there'd need to be some plain integer available too for
41
C the unaligned case).
43
defframe(PARAM_SIZE,12)
44
defframe(PARAM_SRC, 8)
45
defframe(PARAM_DST, 4)
53
pushl %esi FRAME_pushl()
54
pushl %edi FRAME_pushl()
56
leal (%eax,%ecx,4), %eax
57
xorl $-1, %ecx C -size-1
60
addl $8, %ecx C -size+7
64
movl (%edx), %esi C fetch destination cache line
70
C ecx counter, limbs, negative
71
C edx dst, incrementing
76
movl 28(%edx), %esi C destination prefetch
79
movl -28(%eax,%ecx,4), %esi
80
movl -24(%eax,%ecx,4), %edi
81
xorl $GMP_NUMB_MASK, %esi
82
xorl $GMP_NUMB_MASK, %edi
86
movl -20(%eax,%ecx,4), %esi
87
movl -16(%eax,%ecx,4), %edi
88
xorl $GMP_NUMB_MASK, %esi
89
xorl $GMP_NUMB_MASK, %edi
93
movl -12(%eax,%ecx,4), %esi
94
movl -8(%eax,%ecx,4), %edi
95
xorl $GMP_NUMB_MASK, %esi
96
xorl $GMP_NUMB_MASK, %edi
100
movl -4(%eax,%ecx,4), %esi
101
movl (%eax,%ecx,4), %edi
102
xorl $GMP_NUMB_MASK, %esi
103
xorl $GMP_NUMB_MASK, %edi
113
C ecx 0 to 7, representing respectively 7 to 0 limbs remaining
114
C edx dst, next location to store
121
movl -12(%eax,%ecx,4), %esi
122
movl -8(%eax,%ecx,4), %edi
123
xorl $GMP_NUMB_MASK, %esi
124
xorl $GMP_NUMB_MASK, %edi
128
movl -4(%eax,%ecx,4), %esi
129
movl (%eax,%ecx,4), %edi
130
xorl $GMP_NUMB_MASK, %esi
131
xorl $GMP_NUMB_MASK, %edi
144
movl -4(%eax,%ecx,4), %esi
145
movl (%eax,%ecx,4), %edi
146
xorl $GMP_NUMB_MASK, %esi
147
xorl $GMP_NUMB_MASK, %edi
160
xorl $GMP_NUMB_MASK, %ecx