Update.
[glibc.git] / sysdeps / i386 / i686 / mempcpy.S
blob5760d9f9407076b274c50a8903d1a854de256e32
1 /* Copy memory block and return pointer to following byte.
2    For Intel 80x86, x>=6.
3    This file is part of the GNU C Library.
4    Copyright (C) 1998 Free Software Foundation, Inc.
5    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
7    The GNU C Library is free software; you can redistribute it and/or
8    modify it under the terms of the GNU Library General Public License as
9    published by the Free Software Foundation; either version 2 of the
10    License, or (at your option) any later version.
12    The GNU C Library is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15    Library General Public License for more details.
17    You should have received a copy of the GNU Library General Public
18    License along with the GNU C Library; see the file COPYING.LIB.  If not,
19    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20    Boston, MA 02111-1307, USA.  */
22 #include <sysdep.h>
23 #include "asm-syntax.h"
25 /* strtok:
26         INPUT PARAMETER:
27         dest            (sp + 4)
28         src             (sp + 8)
29         len             (sp + 12)
32 ENTRY(__mempcpy)
33         movl    %edi, %eax
34         movl    4(%esp), %edi
35         movl    %esi, %edx
36         movl    8(%esp), %esi
37         movl    12(%esp), %ecx
38         cld
39         shrl    $1, %ecx
40         jnc     1f
41         movsb
42 1:      shrl    $1, %ecx
43         jnc     2f
44         movsw
45 2:      rep
46         movsl
47         xchgl   %edi, %eax
48         movl    %edx, %esi
49         ret
50 END(mempcpy)
51 weak_alias (__mempcpy, mempcpy)