1 dnl Intel Pentium mpn_com -- mpn ones complement.
3 dnl Copyright 1996, 2001, 2002, 2006 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 3 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 License
18 dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
20 include(`../config.m4')
23 C P5: 1.75 cycles/limb
29 C void mpn_com (mp_ptr dst, mp_srcptr src, mp_size_t size);
31 C This code is similar to mpn_copyi, basically there's just some "xorl
32 C $GMP_NUMB_MASK"s inserted.
36 C On P55 some MMX code could be 1.25 c/l (8 limb unrolled) if src and dst
37 C are the same alignment mod 8, but it doesn't seem worth the trouble for
38 C just that case (there'd need to be some plain integer available too for
39 C the unaligned case).
41 defframe(PARAM_SIZE,12)
42 defframe(PARAM_SRC, 8)
43 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