Annotation of OpenXM_contrib/gmp/mpn/x86/k6/mmx/com_n.asm, Revision 1.1.1.2
1.1 maekawa 1: dnl AMD K6-2 mpn_com_n -- mpn bitwise one's complement.
2:
1.1.1.2 ! ohara 3: dnl Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
1.1 maekawa 4: dnl
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 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.
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 Lesser General Public License for more details.
16: dnl
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.
21:
22: include(`../config.m4')
23:
1.1.1.2 ! ohara 24: NAILS_SUPPORT(0-31)
! 25:
! 26:
! 27: C alignment dst/src, A=0mod8 N=4mod8
! 28: C A/A A/N N/A N/N
! 29: C K6-2 1.0 1.18 1.18 1.18 cycles/limb
! 30: C K6 1.5 1.85 1.75 1.85
! 31:
1.1 maekawa 32:
33: C void mpn_com_n (mp_ptr dst, mp_srcptr src, mp_size_t size);
34: C
35: C Take the bitwise ones-complement of src,size and write it to dst,size.
36:
37: defframe(PARAM_SIZE,12)
38: defframe(PARAM_SRC, 8)
39: defframe(PARAM_DST, 4)
40:
1.1.1.2 ! ohara 41: TEXT
! 42: ALIGN(16)
1.1 maekawa 43: PROLOGUE(mpn_com_n)
44: deflit(`FRAME',0)
45:
46: movl PARAM_SIZE, %ecx
47: movl PARAM_SRC, %eax
48: movl PARAM_DST, %edx
49: shrl %ecx
50: jnz L(two_or_more)
51:
52: movl (%eax), %eax
1.1.1.2 ! ohara 53: notl_or_xorl_GMP_NUMB_MASK( %eax)
1.1 maekawa 54: movl %eax, (%edx)
55: ret
56:
57:
58: L(two_or_more):
1.1.1.2 ! ohara 59: pushl %ebx FRAME_pushl()
! 60: pcmpeqd %mm7, %mm7 C all ones
! 61:
1.1 maekawa 62: movl %ecx, %ebx
1.1.1.2 ! ohara 63: ifelse(GMP_NAIL_BITS,0,,
! 64: ` psrld $GMP_NAIL_BITS, %mm7') C clear nails
1.1 maekawa 65:
66:
67:
1.1.1.2 ! ohara 68: ALIGN(8)
1.1 maekawa 69: L(top):
70: C eax src
71: C ebx floor(size/2)
72: C ecx counter
73: C edx dst
1.1.1.2 ! ohara 74: C
! 75: C mm0 scratch
! 76: C mm7 mask
1.1 maekawa 77:
78: movq -8(%eax,%ecx,8), %mm0
79: pxor %mm7, %mm0
80: movq %mm0, -8(%edx,%ecx,8)
81: loop L(top)
82:
83:
84: jnc L(no_extra)
85: movl (%eax,%ebx,8), %eax
1.1.1.2 ! ohara 86: notl_or_xorl_GMP_NUMB_MASK( %eax)
1.1 maekawa 87: movl %eax, (%edx,%ebx,8)
88: L(no_extra):
89:
90: popl %ebx
91: emms_or_femms
92: ret
93:
94: EPILOGUE()
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>